summaryrefslogtreecommitdiff
path: root/sql/sql_load.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_load.cc')
-rw-r--r--sql/sql_load.cc20
1 files changed, 13 insertions, 7 deletions
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 72fa7880268..0090f956521 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -149,7 +149,8 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
}
if (open_and_lock_tables(thd, table_list))
DBUG_RETURN(TRUE);
- if (setup_tables(thd, table_list, &unused_conds,
+ if (setup_tables(thd, &thd->lex->select_lex.context,
+ table_list, &unused_conds,
&thd->lex->select_lex.leaf_tables, FALSE))
DBUG_RETURN(-1);
if (!table_list->table || // do not suport join view
@@ -159,6 +160,11 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "LOAD");
DBUG_RETURN(TRUE);
}
+ if (table_list->prepare_where(thd, 0, TRUE) ||
+ table_list->prepare_check_option(thd))
+ {
+ DBUG_RETURN(TRUE);
+ }
/*
Let us emit an error if we are loading data to table which is used
in subselect in SET clause like we do it for INSERT.
@@ -190,8 +196,8 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
Let us also prepare SET clause, altough it is probably empty
in this case.
*/
- if (setup_fields(thd, 0, table_list, set_fields, 1, 0, 0) ||
- setup_fields(thd, 0, table_list, set_values, 1, 0, 0))
+ if (setup_fields(thd, 0, set_fields, 1, 0, 0) ||
+ setup_fields(thd, 0, set_values, 1, 0, 0))
DBUG_RETURN(TRUE);
}
else
@@ -204,9 +210,9 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
LOAD DATA
*/
table->file->ha_set_all_bits_in_write_set();
- if (setup_fields(thd, 0, table_list, fields_vars, 2, 0, 0) ||
- setup_fields(thd, 0, table_list, set_fields, 2, 0, 0) ||
- check_that_all_fields_are_given_values(thd, table))
+ if (setup_fields(thd, 0, fields_vars, 2, 0, 0) ||
+ setup_fields(thd, 0, set_fields, 2, 0, 0) ||
+ check_that_all_fields_are_given_values(thd, table, table_list))
DBUG_RETURN(TRUE);
/*
Check whenever TIMESTAMP field with auto-set feature specified
@@ -220,7 +226,7 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
check_that_all_fields_are_given_values() and setting use_timestamp
since it may update query_id for some fields.
*/
- if (setup_fields(thd, 0, table_list, set_values, 1, 0, 0))
+ if (setup_fields(thd, 0, set_values, 1, 0, 0))
DBUG_RETURN(TRUE);
}