diff options
author | unknown <evgen@moonbone.local> | 2007-04-07 00:13:27 +0400 |
---|---|---|
committer | unknown <evgen@moonbone.local> | 2007-04-07 00:13:27 +0400 |
commit | 35a0f4723418eae8b30fb375bfd6a5de9ef85ecf (patch) | |
tree | 39b77b60e33f6568dac86227150426c517f5d047 /sql/sql_load.cc | |
parent | d03c7d2d28fe86d88c30f8799b78cf966e5a3ab7 (diff) | |
download | mariadb-git-35a0f4723418eae8b30fb375bfd6a5de9ef85ecf.tar.gz |
Bug#27586: Wrong autoinc value assigned by LOAD DATA in the
NO_AUTO_VALUE_ON_ZERO mode.
The table->auto_increment_field_not_null variable wasn't reset after
reading a row which may lead to inserting a wrong value to the auto-increment
field to the following row.
The table->auto_increment_field_not_null variable is reset now right after a
row is being written in the read_fixed_length() and the read_sep_field()
functions.
Removed wrong setting of the table->auto_increment_field_not_null variable in
the read_sep_field() function.
mysql-test/t/loaddata.test:
Added a test case for the bug#27586: Wrong autoinc value assigned by LOAD DATA in the
NO_AUTO_VALUE_ON_ZERO mode.
mysql-test/r/loaddata.result:
Added a test case for the bug#27586: Wrong autoinc value assigned by LOAD DATA in the
NO_AUTO_VALUE_ON_ZERO mode.
sql/sql_load.cc:
Bug#27586: Wrong autoinc value assigned by LOAD DATA in the
NO_AUTO_VALUE_ON_ZERO mode.
The table->auto_increment_field_not_null variable is reset now right after a
row is being written in the read_fixed_length() and the read_sep_field()
functions.
Remove wrong setting of the table->auto_increment_field_not_null variable in
the read_sep_field() function.
Diffstat (limited to 'sql/sql_load.cc')
-rw-r--r-- | sql/sql_load.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 7a535381c01..e06235847ea 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -532,7 +532,7 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, Item_field *sql_field; TABLE *table= table_list->table; ulonglong id; - bool no_trans_update; + bool no_trans_update, err; DBUG_ENTER("read_fixed_length"); id= 0; @@ -624,7 +624,9 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, DBUG_RETURN(-1); } - if (write_record(thd, table, &info)) + err= write_record(thd, table, &info); + table->auto_increment_field_not_null= FALSE; + if (err) DBUG_RETURN(1); thd->no_trans_update= no_trans_update; @@ -669,7 +671,7 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, TABLE *table= table_list->table; uint enclosed_length; ulonglong id; - bool no_trans_update; + bool no_trans_update, err; DBUG_ENTER("read_sep_field"); enclosed_length=enclosed.length(); @@ -716,8 +718,6 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, DBUG_RETURN(1); } field->set_null(); - if (field == table->next_number_field) - table->auto_increment_field_not_null= TRUE; if (!field->maybe_null()) { if (field->type() == FIELD_TYPE_TIMESTAMP) @@ -803,8 +803,9 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, DBUG_RETURN(-1); } - - if (write_record(thd, table, &info)) + err= write_record(thd, table, &info); + table->auto_increment_field_not_null= FALSE; + if (err) DBUG_RETURN(1); /* If auto_increment values are used, save the first one for |