summaryrefslogtreecommitdiff
path: root/sql/sql_insert.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r--sql/sql_insert.cc22
1 files changed, 5 insertions, 17 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 599a892da9f..25c696bc476 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -790,9 +790,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
FALSE,
(fields.elements || !value_count ||
table_list->view != 0),
- !ignore && (thd->variables.sql_mode &
- (MODE_STRICT_TRANS_TABLES |
- MODE_STRICT_ALL_TABLES))))
+ !ignore && thd->is_strict_mode()))
goto abort;
/* mysql_prepare_insert set table_list->table if it was not set */
@@ -904,9 +902,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
}
}
- thd->abort_on_warning= (!ignore && (thd->variables.sql_mode &
- (MODE_STRICT_TRANS_TABLES |
- MODE_STRICT_ALL_TABLES)));
+ thd->abort_on_warning= !ignore && thd->is_strict_mode();
prepare_triggers_for_insert_stmt(table);
@@ -3339,9 +3335,7 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
if (!res && fields->elements)
{
bool saved_abort_on_warning= thd->abort_on_warning;
- thd->abort_on_warning= !info.ignore && (thd->variables.sql_mode &
- (MODE_STRICT_TRANS_TABLES |
- MODE_STRICT_ALL_TABLES));
+ thd->abort_on_warning= !info.ignore && thd->is_strict_mode();
res= check_that_all_fields_are_given_values(thd, table_list->table,
table_list);
thd->abort_on_warning= saved_abort_on_warning;
@@ -3456,10 +3450,7 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
table->file->extra(HA_EXTRA_WRITE_CAN_REPLACE);
if (info.handle_duplicates == DUP_UPDATE)
table->file->extra(HA_EXTRA_INSERT_WITH_UPDATE);
- thd->abort_on_warning= (!info.ignore &&
- (thd->variables.sql_mode &
- (MODE_STRICT_TRANS_TABLES |
- MODE_STRICT_ALL_TABLES)));
+ thd->abort_on_warning= !info.ignore && thd->is_strict_mode();
res= (table_list->prepare_where(thd, 0, TRUE) ||
table_list->prepare_check_option(thd));
@@ -4076,10 +4067,7 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
table->file->extra(HA_EXTRA_INSERT_WITH_UPDATE);
if (thd->locked_tables_mode <= LTM_LOCK_TABLES)
table->file->ha_start_bulk_insert((ha_rows) 0);
- thd->abort_on_warning= (!info.ignore &&
- (thd->variables.sql_mode &
- (MODE_STRICT_TRANS_TABLES |
- MODE_STRICT_ALL_TABLES)));
+ thd->abort_on_warning= !info.ignore && thd->is_strict_mode();
if (check_that_all_fields_are_given_values(thd, table, table_list))
DBUG_RETURN(1);
table->mark_columns_needed_for_insert();