Commit fe61a613 authored by unknown's avatar unknown

Merge sgluhov@bk-internal.mysql.com:/home/bk/mysql-4.1

into mysql.com:/home/gluh/MySQL/Merge/4.1

parents 2543c551 91ed9588
...@@ -66,3 +66,13 @@ a b ...@@ -66,3 +66,13 @@ a b
3 row 3 3 row 3
0 0
drop table t1; 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;
...@@ -31,4 +31,31 @@ load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated ...@@ -31,4 +31,31 @@ load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated
select * from t1; select * from t1;
drop table 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 # End of 4.1 tests
...@@ -429,6 +429,8 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields, ...@@ -429,6 +429,8 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields,
while ((sql_field= (Item_field*) it++)) while ((sql_field= (Item_field*) it++))
{ {
Field *field= sql_field->field; Field *field= sql_field->field;
if (field == table->next_number_field)
table->auto_increment_field_not_null= TRUE;
if (pos == read_info.row_end) if (pos == read_info.row_end)
{ {
thd->cuted_fields++; /* Not enough fields */ thd->cuted_fields++; /* Not enough fields */
...@@ -520,6 +522,8 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table, ...@@ -520,6 +522,8 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
length=(uint) (read_info.row_end-pos); length=(uint) (read_info.row_end-pos);
Field *field=sql_field->field; Field *field=sql_field->field;
if (field == table->next_number_field)
table->auto_increment_field_not_null= TRUE;
if (!read_info.enclosed && if (!read_info.enclosed &&
(enclosed_length && length == 4 && !memcmp(pos,"NULL",4)) || (enclosed_length && length == 4 && !memcmp(pos,"NULL",4)) ||
(length == 1 && read_info.found_null)) (length == 1 && read_info.found_null))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment