fix RESIGNAL to save and pass the m_row_count too

This commit is contained in:
Sergei Golubchik 2021-10-08 18:44:04 +02:00
parent b73b736506
commit 9bbd328254
3 changed files with 7 additions and 4 deletions

View File

@ -1598,7 +1598,7 @@ ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
GET DIAGNOSTICS CONDITION 1 @num = ROW_NUMBER, @msg = MESSAGE_TEXT; GET DIAGNOSTICS CONDITION 1 @num = ROW_NUMBER, @msg = MESSAGE_TEXT;
SELECT @num, @msg; SELECT @num, @msg;
@num @msg @num @msg
1 Duplicate entry '1' for key 'PRIMARY' 2 Duplicate entry '1' for key 'PRIMARY'
DROP PROCEDURE sp; DROP PROCEDURE sp;
DROP TABLE t1; DROP TABLE t1;
# Checking more errors # Checking more errors

View File

@ -111,15 +111,18 @@ public:
/// Text message. /// Text message.
char *message; char *message;
/** Row number where the condition has happened */
ulong m_row_number;
/// The constructor. /// The constructor.
/// ///
/// @param _sql_condition The SQL condition. /// @param _sql_condition The SQL condition.
/// @param arena Query arena for SP /// @param arena Query arena for SP
Sql_condition_info(const Sql_condition *_sql_condition, Sql_condition_info(const Sql_condition *_sql_condition, Query_arena *arena)
Query_arena *arena)
:Sql_condition_identity(*_sql_condition) :Sql_condition_identity(*_sql_condition)
{ {
message= strdup_root(arena->mem_root, _sql_condition->get_message_text()); message= strdup_root(arena->mem_root, _sql_condition->get_message_text());
m_row_number= _sql_condition->m_row_number;
} }
}; };

View File

@ -441,7 +441,7 @@ bool Sql_cmd_resignal::execute(THD *thd)
} }
Sql_condition signaled_err(thd->mem_root, *signaled, signaled->message, Sql_condition signaled_err(thd->mem_root, *signaled, signaled->message,
da->current_row_for_warning()); signaled->m_row_number);
if (m_cond) if (m_cond)
{ {