summaryrefslogtreecommitdiff
path: root/sql/table.h
diff options
context:
space:
mode:
Diffstat (limited to 'sql/table.h')
-rw-r--r--sql/table.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/sql/table.h b/sql/table.h
index dcef7769b6b..dbc3d6127ba 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -1701,6 +1701,30 @@ public:
Field **field_to_fill();
bool validate_default_values_of_unset_fields(THD *thd) const;
+ // Check if the value list is assignable to the explicit field list
+ static bool check_assignability_explicit_fields(List<Item> fields,
+ List<Item> values,
+ bool ignore);
+ // Check if the value list is assignable to all visible fields
+ bool check_assignability_all_visible_fields(List<Item> &values,
+ bool ignore) const;
+ /*
+ Check if the value list is assignable to:
+ - The explicit field list if fields.elements > 0, e.g.
+ INSERT INTO t1 (a,b) VALUES (1,2);
+ - All visible fields, if fields.elements==0, e.g.
+ INSERT INTO t1 VALUES (1,2);
+ */
+ bool check_assignability_opt_fields(List<Item> fields,
+ List<Item> values,
+ bool ignore) const
+ {
+ DBUG_ASSERT(values.elements);
+ return fields.elements ?
+ check_assignability_explicit_fields(fields, values, ignore) :
+ check_assignability_all_visible_fields(values, ignore);
+ }
+
bool insert_all_rows_into_tmp_table(THD *thd,
TABLE *tmp_table,
TMP_TABLE_PARAM *tmp_table_param,