From 91f62b34d40c007acb6eccc8bb42e43c5b60f424 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 16 Sep 2004 04:55:22 +0200 Subject: [PATCH] Optimzed handling of NO_AUTO_VALUE_ON_ZERO --- sql/ha_ndbcluster.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index d0154fd380a..da32476ae74 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -1526,11 +1526,6 @@ int ha_ndbcluster::write_row(byte *record) if (table->timestamp_default_now) update_timestamp(record+table->timestamp_default_now-1); has_auto_increment= (table->next_number_field && record == table->record[0]); - skip_auto_increment= - table->next_number_field && - table->next_number_field->val_int() != 0 || - table->auto_increment_field_not_null && - current_thd->variables.sql_mode & MODE_NO_AUTO_VALUE_ON_ZERO; if (!(op= trans->getNdbOperation((const NDBTAB *) m_table))) ERR_RETURN(trans->getNdbError()); @@ -1550,8 +1545,12 @@ int ha_ndbcluster::write_row(byte *record) { int res; - if (has_auto_increment) + if (has_auto_increment) + { + skip_auto_increment= false; update_auto_increment(); + skip_auto_increment= !auto_increment_column_changed; + } if ((res= set_primary_key(op))) return res;