diff options
author | kroki/tomash@moonlight.intranet <> | 2006-10-03 13:38:16 +0400 |
---|---|---|
committer | kroki/tomash@moonlight.intranet <> | 2006-10-03 13:38:16 +0400 |
commit | 8798b462b50e6b71c459cc960b24d1d788012f7d (patch) | |
tree | 27aed4f4fe18f8981e2f8a6f6b693ddca47cf40d /sql/log.cc | |
parent | 5ea8adfae7bbc54eb99aa3f7d4d4bd690d8f69a8 (diff) | |
download | mariadb-git-8798b462b50e6b71c459cc960b24d1d788012f7d.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.
Diffstat (limited to 'sql/log.cc')
-rw-r--r-- | sql/log.cc | 4 |
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); |