mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +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:
@ -1340,11 +1340,20 @@ public:
|
||||
|
||||
/*
|
||||
last_insert_id_used is set when current statement calls
|
||||
LAST_INSERT_ID() or reads @@LAST_INSERT_ID, so that binary log
|
||||
LAST_INSERT_ID_EVENT be generated.
|
||||
LAST_INSERT_ID() or reads @@LAST_INSERT_ID.
|
||||
*/
|
||||
bool last_insert_id_used;
|
||||
|
||||
/*
|
||||
last_insert_id_used is set when current statement or any stored
|
||||
function called from this statement calls LAST_INSERT_ID() or
|
||||
reads @@LAST_INSERT_ID, so that binary log LAST_INSERT_ID_EVENT be
|
||||
generated. Required for statement-based binary log for issuing
|
||||
"SET LAST_INSERT_ID= #" before "SELECT func()", if func() reads
|
||||
LAST_INSERT_ID.
|
||||
*/
|
||||
bool last_insert_id_used_bin_log;
|
||||
|
||||
/*
|
||||
insert_id_used is set when current statement updates
|
||||
THD::last_insert_id, so that binary log INSERT_ID_EVENT be
|
||||
|
Reference in New Issue
Block a user