1
0
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:
kroki/tomash@moonlight.intranet
2006-10-03 13:38:16 +04:00
parent 5ea8adfae7
commit 8798b462b5
9 changed files with 61 additions and 12 deletions

View File

@ -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