summaryrefslogtreecommitdiff
path: root/sql/log.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/log.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/log.cc')
-rw-r--r--sql/log.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/log.cc b/sql/log.cc
index 1cd01865f9f..98829220f3d 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -1702,7 +1702,7 @@ bool MYSQL_LOG::write(Log_event *event_info)
if (thd)
{
- if (thd->last_insert_id_used)
+ if (thd->last_insert_id_used_bin_log)
{
Intvar_log_event e(thd,(uchar) LAST_INSERT_ID_EVENT,
thd->current_insert_id);
@@ -1994,7 +1994,7 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
tmp_errno=errno;
strmov(db,thd->db);
}
- if (thd->last_insert_id_used)
+ if (thd->last_insert_id_used_bin_log)
{
end=strmov(end,",last_insert_id=");
end=longlong10_to_str((longlong) thd->current_insert_id,end,-10);