summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <gshchepa/uchum@gleb.loc>2007-05-08 00:53:01 +0500
committerunknown <gshchepa/uchum@gleb.loc>2007-05-08 00:53:01 +0500
commitfabad71995a8296d157742ab8b9189666f5d442d (patch)
tree89242676a5ab4a28633c9663f9e29fd64681c3ad /sql
parent44e54a30deccdef81f60b35546cb7f402d4367b9 (diff)
parent35659a285d3bf1c18798cd2819c18d3d6fca8e55 (diff)
downloadmariadb-git-fabad71995a8296d157742ab8b9189666f5d442d.tar.gz
Merge gleb.loc:/home/uchum/work/bk/mysql-5.0-opt
into gleb.loc:/home/uchum/work/bk/mysql-5.0-opt-27954
Diffstat (limited to 'sql')
-rw-r--r--sql/handler.cc7
-rw-r--r--sql/sql_class.h4
2 files changed, 11 insertions, 0 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index c6c31593a5f..867ac7ff778 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -1685,7 +1685,14 @@ void handler::restore_auto_increment()
{
THD *thd= table->in_use;
if (thd->next_insert_id)
+ {
thd->next_insert_id= thd->prev_insert_id;
+ if (thd->next_insert_id == 0)
+ {
+ /* we didn't generate a value, engine will be called again */
+ thd->clear_next_insert_id= 0;
+ }
+ }
}
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 12d7cb2368f..7dd46e2efe7 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -1431,6 +1431,10 @@ public:
*/
bool insert_id_used;
+ /*
+ clear_next_insert_id is set if engine was called at least once
+ for this statement to generate auto_increment value.
+ */
bool clear_next_insert_id;
/* for IS NULL => = last_insert_id() fix in remove_eq_conds() */
bool substitute_null_with_insert_id;