mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Fix for the patch for bug#21726: Incorrect result with multiple
invocations of LAST_INSERT_ID. Reding of LAST_INSERT_ID inside stored function wasn't noted by caller, and no LAST_INSERT_ID_EVENT was issued for binary log. The solution is to add THD::last_insert_id_used_bin_log, which is much like THD::last_insert_id_used, but is reset only for upper-level statements. This new variable is used to issue LAST_INSERT_ID_EVENT.
This commit is contained in:
@@ -179,9 +179,9 @@ THD::THD()
|
||||
lock_id(&main_lock_id),
|
||||
user_time(0), in_sub_stmt(0), global_read_lock(0), is_fatal_error(0),
|
||||
rand_used(0), time_zone_used(0),
|
||||
last_insert_id_used(0), insert_id_used(0), clear_next_insert_id(0),
|
||||
in_lock_tables(0), bootstrap(0), derived_tables_processing(FALSE),
|
||||
spcont(NULL)
|
||||
last_insert_id_used(0), last_insert_id_used_bin_log(0), insert_id_used(0),
|
||||
clear_next_insert_id(0), in_lock_tables(0), bootstrap(0),
|
||||
derived_tables_processing(FALSE), spcont(NULL)
|
||||
{
|
||||
stmt_arena= this;
|
||||
thread_stack= 0;
|
||||
@@ -560,7 +560,7 @@ bool THD::store_globals()
|
||||
THD::cleanup_after_query()
|
||||
|
||||
DESCRIPTION
|
||||
This function is used to reset thread data to it's default state.
|
||||
This function is used to reset thread data to its default state.
|
||||
|
||||
NOTE
|
||||
This function is not suitable for setting thread data to some
|
||||
@@ -568,6 +568,7 @@ bool THD::store_globals()
|
||||
different master threads may overwrite data of each other on
|
||||
slave.
|
||||
*/
|
||||
|
||||
void THD::cleanup_after_query()
|
||||
{
|
||||
last_insert_id_used= FALSE;
|
||||
@@ -582,6 +583,7 @@ void THD::cleanup_after_query()
|
||||
where= THD::DEFAULT_WHERE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Convert a string to another character set
|
||||
|
||||
|
||||
Reference in New Issue
Block a user