mirror of
https://github.com/MariaDB/server.git
synced 2025-08-05 13:16:09 +03:00
MDEV-35953 mysql_stmt_errno() returns 0 after an error in mysql_stmt_execute()
The goal of the fix for MDEV-34718 was to avoid Diagnostics_area::reset_diagnostics_area() changing DA_OK_BULK to DA_EMPTY for bulk operations. But it was too indiscriminative and also didn't reset DA_ERROR if the bulk operation was in progress. This was leaving Diagnostics_area in the inconsistent state: the status was DA_ERROR, but sql_errno was 0. Fix it to reset the DA_ERROR status as reset_diagnostics_area() is supposed to do.
This commit is contained in:
@@ -318,18 +318,16 @@ Diagnostics_area::reset_diagnostics_area()
|
||||
#endif
|
||||
get_warning_info()->clear_error_condition();
|
||||
set_is_sent(false);
|
||||
/** Tiny reset in debug mode to see garbage right away */
|
||||
if (!is_bulk_op())
|
||||
/*
|
||||
For BULK DML operations (e.g. UPDATE) the data member m_status
|
||||
has the value DA_OK_BULK. Keep this value in order to handle
|
||||
m_affected_rows, m_statement_warn_count in correct way. Else,
|
||||
the number of rows and the number of warnings affected by
|
||||
the last statement executed as part of a trigger fired by the dml
|
||||
(e.g. UPDATE statement fires a trigger on AFTER UPDATE) would counts
|
||||
rows modified by trigger's statement.
|
||||
*/
|
||||
m_status= DA_EMPTY;
|
||||
/*
|
||||
For BULK DML operations (e.g. UPDATE) the data member m_status
|
||||
has the value DA_OK_BULK. Keep this value in order to handle
|
||||
m_affected_rows, m_statement_warn_count in correct way. Else,
|
||||
the number of rows and the number of warnings affected by
|
||||
the last statement executed as part of a trigger fired by the dml
|
||||
(e.g. UPDATE statement fires a trigger on AFTER UPDATE) would counts
|
||||
rows modified by trigger's statement.
|
||||
*/
|
||||
m_status= is_bulk_op() ? DA_OK_BULK : DA_EMPTY;
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user