summaryrefslogtreecommitdiff
path: root/sql/sql_load.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2015-12-16 12:12:01 +0100
committerSergei Golubchik <serg@mariadb.org>2015-12-21 21:30:46 +0100
commitad5db17e882fea36dcae6f6e61996b5f9bf28962 (patch)
tree06fa978199bd8fb09874de989984381e28bb4715 /sql/sql_load.cc
parentde7636e1470848bb5d92437b7c6c7b9c4d6caedc (diff)
downloadmariadb-git-ad5db17e882fea36dcae6f6e61996b5f9bf28962.tar.gz
cleanup
* move common code to a new set_bad_null_error() function * move repeated comparison out of the loop * remove unused code * unused method Table_triggers_list::set_table * redundant condition (if (table) after table was dereferenced) * add an assert
Diffstat (limited to 'sql/sql_load.cc')
-rw-r--r--sql/sql_load.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 9cf82c1c6d0..aed26bd2fa5 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -767,7 +767,7 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
List_iterator_fast<Item> it(fields_vars);
Item_field *sql_field;
TABLE *table= table_list->table;
- bool err, progress_reports;
+ bool err, progress_reports, auto_increment_field_not_null=false;
ulonglong counter, time_to_report_progress;
DBUG_ENTER("read_fixed_length");
@@ -777,6 +777,12 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
if ((thd->progress.max_counter= read_info.file_length()) == ~(my_off_t) 0)
progress_reports= 0;
+ while ((sql_field= (Item_field*) it++))
+ {
+ if (table->field[sql_field->field->field_index] == table->next_number_field)
+ auto_increment_field_not_null= true;
+ }
+
while (!read_info.read_fixed_length())
{
if (thd->killed)
@@ -819,8 +825,7 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
while ((sql_field= (Item_field*) it++))
{
Field *field= sql_field->field;
- if (field == table->next_number_field)
- table->auto_increment_field_not_null= TRUE;
+ table->auto_increment_field_not_null= auto_increment_field_not_null;
/*
No fields specified in fields_vars list can be null in this format.
Mark field as not null, we should do this for each row because of
@@ -874,8 +879,7 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
(table->default_field && table->update_default_fields()))
DBUG_RETURN(1);
- switch (table_list->view_check_option(thd,
- ignore_check_option_errors)) {
+ switch (table_list->view_check_option(thd, ignore_check_option_errors)) {
case VIEW_CHECK_SKIP:
read_info.next_line();
goto continue_loop;