summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authorunknown <kroki/tomash@moonlight.intranet>2006-10-03 13:38:16 +0400
committerunknown <kroki/tomash@moonlight.intranet>2006-10-03 13:38:16 +0400
commit37b5cbdc300e0444a3eac5e3c6c056e8cd18741f (patch)
tree27aed4f4fe18f8981e2f8a6f6b693ddca47cf40d /sql/sql_parse.cc
parentbe929087ec9a5b4e161591fcebab9687472779eb (diff)
downloadmariadb-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/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 1b69e266442..c62c286cfdb 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -5651,6 +5651,7 @@ void mysql_reset_thd_for_next_command(THD *thd)
thd->free_list= 0;
thd->select_number= 1;
thd->query_start_used= thd->insert_id_used=0;
+ thd->last_insert_id_used_bin_log= FALSE;
thd->is_fatal_error= thd->time_zone_used= 0;
thd->server_status&= ~ (SERVER_MORE_RESULTS_EXISTS |
SERVER_QUERY_NO_INDEX_USED |