mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
MDEV-10075: Provide index of error causing error in array INSERT
Extended the parser for GET DIAGNOSTICS to use ERROR_INDEX to get warning/error index. Error information is stored in Sql_condition. So it can be used to store the index of warning/error too. THD::current_insert_index keeps a track of count for each row that is processed or going to be inserted in the table (or first row in case of prepare phase). When an error occurs, first we need to fetch corrected error index (using correct_error_index()) for an error number. This is needed because in prepare phase, the error may not be because of rows/values. In such case, correct value of error_index should be 0. Once correct value if fetched, assign it to Sql_condition::error_index when the object is created during error/warning. This error_index variable is returned when ERROR_INDEX is used in GET DIAGNOSTICS.
This commit is contained in:
committed by
Sergei Golubchik
parent
50e08f3da0
commit
ea06c67a49
@ -672,7 +672,8 @@ Sql_condition *Warning_info::push_warning(THD *thd,
|
||||
if (m_allow_unlimited_warnings ||
|
||||
m_warn_list.elements() < thd->variables.max_error_count)
|
||||
{
|
||||
cond= new (& m_warn_root) Sql_condition(& m_warn_root, *value, msg);
|
||||
cond= new (& m_warn_root) Sql_condition(& m_warn_root, *value, msg,
|
||||
thd->current_insert_index);
|
||||
if (cond)
|
||||
m_warn_list.push_back(cond);
|
||||
}
|
||||
|
Reference in New Issue
Block a user