diff options
author | unknown <kroki/tomash@moonlight.intranet> | 2006-10-03 13:38:16 +0400 |
---|---|---|
committer | unknown <kroki/tomash@moonlight.intranet> | 2006-10-03 13:38:16 +0400 |
commit | 37b5cbdc300e0444a3eac5e3c6c056e8cd18741f (patch) | |
tree | 27aed4f4fe18f8981e2f8a6f6b693ddca47cf40d /sql/item_func.cc | |
parent | be929087ec9a5b4e161591fcebab9687472779eb (diff) | |
download | mariadb-git-37b5cbdc300e0444a3eac5e3c6c056e8cd18741f.tar.gz |
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.
mysql-test/r/rpl_insert_id.result:
For bug#21726, add result for statement-based replication of function
calls.
mysql-test/t/rpl_insert_id.test:
For bug#21726, add test case for statement-based replication of function
calls.
sql/item_func.cc:
Set THD::last_insert_id_used_bin_log for issuing of LAST_INSERT_ID_EVENT.
sql/log.cc:
Issue LAST_INSERT_ID_EVENT if THD::last_insert_id_used_bin_log is set.
sql/set_var.cc:
Set THD::last_insert_id_used_bin_log for issuing of LAST_INSERT_ID_EVENT.
sql/sql_class.cc:
Initialize THD::last_insert_id_used_bin_log.
Fix typo, add whitespace.
sql/sql_class.h:
Add THD::last_insert_id_used_bin_log.
sql/sql_parse.cc:
Reset THD::last_insert_id_used_bin_log for upper-level statements.
sql/sql_select.cc:
Set THD::last_insert_id_used_bin_log for issuing of LAST_INSERT_ID_EVENT.
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r-- | sql/item_func.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index e395a7a3af5..a294bbd7a71 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -3362,6 +3362,7 @@ bool Item_func_last_insert_id::fix_fields(THD *thd, Item **ref) id of the previous statement in THD::current_insert_id. */ thd->last_insert_id_used= TRUE; + thd->last_insert_id_used_bin_log= TRUE; thd->current_insert_id= thd->last_insert_id; } null_value= FALSE; |