summaryrefslogtreecommitdiff
path: root/sql/sql_load.cc
diff options
context:
space:
mode:
authorunknown <gluh@eagle.intranet.mysql.r18.ru>2005-09-22 12:46:01 +0500
committerunknown <gluh@eagle.intranet.mysql.r18.ru>2005-09-22 12:46:01 +0500
commit91ed9588bf3c3dfddf9c4eee823b36e53c85a3f5 (patch)
treefe4c385481240d843f94d098b61952dba4865bf5 /sql/sql_load.cc
parentd440d5ea7ce70ecedeed2e6d2181e72d634c6cce (diff)
downloadmariadb-git-91ed9588bf3c3dfddf9c4eee823b36e53c85a3f5.tar.gz
Fix for bug#12053 LOAD DATA INFILE ignores NO_AUTO_VALUE_ON_ZERO setting
set auto_increment_field_not_null to true to preserve zero values for autoincrement fields during LOAD DATA execution if NO_AUTO_VALUE_ON_ZERO sql mode is set mysql-test/r/loaddata.result: Fix for bug#12053 LOAD DATA INFILE ignores NO_AUTO_VALUE_ON_ZERO setting test case mysql-test/t/loaddata.test: Fix for bug#12053 LOAD DATA INFILE ignores NO_AUTO_VALUE_ON_ZERO setting test case
Diffstat (limited to 'sql/sql_load.cc')
-rw-r--r--sql/sql_load.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 7b963c7ea31..f590038f899 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -429,6 +429,8 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields,
while ((sql_field= (Item_field*) it++))
{
Field *field= sql_field->field;
+ if (field == table->next_number_field)
+ table->auto_increment_field_not_null= TRUE;
if (pos == read_info.row_end)
{
thd->cuted_fields++; /* Not enough fields */
@@ -520,6 +522,8 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
length=(uint) (read_info.row_end-pos);
Field *field=sql_field->field;
+ if (field == table->next_number_field)
+ table->auto_increment_field_not_null= TRUE;
if (!read_info.enclosed &&
(enclosed_length && length == 4 && !memcmp(pos,"NULL",4)) ||
(length == 1 && read_info.found_null))