List:Internals« Previous MessageNext Message »
From:gluh Date:September 22 2005 9:46am
Subject:bk commit into 4.1 tree (gluh:1.2456) BUG#12053
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of gluh. When gluh does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2456 05/09/22 12:46:01 gluh@stripped +3 -0
  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

  sql/sql_load.cc
    1.85 05/09/22 12:45:57 gluh@stripped +4 -0
    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/t/loaddata.test
    1.10 05/09/22 12:45:57 gluh@stripped +27 -0
    Fix for bug#12053 LOAD DATA INFILE ignores NO_AUTO_VALUE_ON_ZERO setting
      test case

  mysql-test/r/loaddata.result
    1.15 05/09/22 12:45:57 gluh@stripped +10 -0
    Fix for bug#12053 LOAD DATA INFILE ignores NO_AUTO_VALUE_ON_ZERO setting
      test case

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	gluh
# Host:	eagle.intranet.mysql.r18.ru
# Root:	/home/gluh/MySQL/Merge/4.1

--- 1.84/sql/sql_load.cc	Tue Sep 20 17:19:58 2005
+++ 1.85/sql/sql_load.cc	Thu Sep 22 12:45:57 2005
@@ -429,6 +429,8 @@
     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 @@
       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))

--- 1.14/mysql-test/r/loaddata.result	Wed Jun 16 01:38:33 2004
+++ 1.15/mysql-test/r/loaddata.result	Thu Sep 22 12:45:57 2005
@@ -66,3 +66,13 @@
 3	row 3
 0	
 drop table t1;
+SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
+create table t1(id integer not null auto_increment primary key);
+insert into t1 values(0);
+select * from t1;
+id
+0
+select * from t1;
+id
+0
+SET @@SQL_MODE=@OLD_SQL_MODE;

--- 1.9/mysql-test/t/loaddata.test	Thu Sep 15 19:17:14 2005
+++ 1.10/mysql-test/t/loaddata.test	Thu Sep 22 12:45:57 2005
@@ -31,4 +31,31 @@
 select * from t1;
 drop table t1;
 
+
+#
+# Bug #12053 LOAD DATA INFILE ignores NO_AUTO_VALUE_ON_ZERO setting
+#
+SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
+create table t1(id integer not null auto_increment primary key);
+insert into t1 values(0);
+disable_query_log;
+eval SELECT * INTO OUTFILE '$MYSQL_TEST_DIR/var/tmp/t1' from t1;
+delete from t1;
+eval load data infile '$MYSQL_TEST_DIR/var/tmp/t1' into table t1;
+enable_query_log;
+select * from t1;
+--exec rm $MYSQL_TEST_DIR/var/tmp/t1
+
+disable_query_log;
+eval SELECT * INTO OUTFILE '$MYSQL_TEST_DIR/var/tmp/t1'
+FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\r\n'
+FROM t1;
+delete from t1;
+eval load data infile '$MYSQL_TEST_DIR/var/tmp/t1' into table t1
+FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\r\n';
+enable_query_log;
+select * from t1;
+--exec rm $MYSQL_TEST_DIR/var/tmp/t1
+SET @@SQL_MODE=@OLD_SQL_MODE;
+
 # End of 4.1 tests
Thread
bk commit into 4.1 tree (gluh:1.2456) BUG#12053gluh22 Sep