summaryrefslogtreecommitdiff
path: root/sql/handler.cc
diff options
context:
space:
mode:
authorunknown <vva@eagle.mysql.r18.ru>2003-07-28 10:57:46 -0400
committerunknown <vva@eagle.mysql.r18.ru>2003-07-28 10:57:46 -0400
commita56959a5b6b5e04e86b03e33fd4eb664322f9342 (patch)
tree03a3f7dcd401f3a989010a618471f93548dceedc /sql/handler.cc
parent9b675b8be0ab30ce9a4a0a16a0932f163d9f1d87 (diff)
downloadmariadb-git-a56959a5b6b5e04e86b03e33fd4eb664322f9342.tar.gz
changed for AUTO_VALUE_ON_ZERO
mysql-test/r/auto_increment.result: added test for AUTO_VALUE_ON_ZERO mysql-test/t/auto_increment.test: added test for AUTO_VALUE_ON_ZERO
Diffstat (limited to 'sql/handler.cc')
-rw-r--r--sql/handler.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index 7f4b63e7551..90fd754a4c5 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -697,14 +697,15 @@ void handler::update_auto_increment()
longlong nr;
THD *thd;
DBUG_ENTER("update_auto_increment");
- if (table->auto_increment_field_is_null)
- table->auto_increment_field_is_null= false;
- else if (table->next_number_field->val_int() != 0 ||
- current_thd->variables.sql_mode & MODE_NO_AUTO_VALUE_ON_ZERO)
+ if (table->next_number_field->val_int() != 0 ||
+ table->auto_increment_field_not_null &&
+ current_thd->variables.sql_mode & MODE_NO_AUTO_VALUE_ON_ZERO)
{
+ table->auto_increment_field_not_null= false;
auto_increment_column_changed=0;
DBUG_VOID_RETURN;
}
+ table->auto_increment_field_not_null= false;
thd=current_thd;
if ((nr=thd->next_insert_id))
thd->next_insert_id=0; // Clear after use