summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/opt_sum.cc2
-rw-r--r--sql/sql_select.cc33
-rw-r--r--sql/sql_select.h2
3 files changed, 3 insertions, 34 deletions
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index cbec039b3e4..fa3a07b72c5 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -791,7 +791,7 @@ static bool matching_cond(bool max_fl, TABLE_REF *ref, KEY *keyinfo,
{
/* Update endpoints for MAX/MIN, see function comment. */
Item *value= args[between && max_fl ? 2 : 1];
- store_val_in_field(part->field, value, CHECK_FIELD_IGNORE);
+ value->save_in_field_no_warnings(part->field, 1);
if (part->null_bit)
*key_ptr++= (uchar) test(part->field->is_null());
part->field->get_key_image(key_ptr, part->length, Field::itRAW);
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index b1d1a84f5b2..0e5aa0e0aaa 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -8028,37 +8028,6 @@ get_store_key(THD *thd, KEYUSE *keyuse, table_map used_tables,
}
/**
- This function is only called for const items on fields which are keys.
-
- @return
- returns 1 if there was some conversion made when the field was stored.
-*/
-
-bool
-store_val_in_field(Field *field, Item *item, enum_check_fields check_flag)
-{
- bool error;
- TABLE *table= field->table;
- THD *thd= table->in_use;
- ha_rows cuted_fields=thd->cuted_fields;
- my_bitmap_map *old_map= dbug_tmp_use_all_columns(table,
- table->write_set);
-
- /*
- we should restore old value of count_cuted_fields because
- store_val_in_field can be called from mysql_insert
- with select_insert, which make count_cuted_fields= 1
- */
- enum_check_fields old_count_cuted_fields= thd->count_cuted_fields;
- thd->count_cuted_fields= check_flag;
- error= item->save_in_field(field, 1);
- thd->count_cuted_fields= old_count_cuted_fields;
- dbug_tmp_restore_column_map(table->write_set, old_map);
- return error || cuted_fields != thd->cuted_fields;
-}
-
-
-/**
@details Initialize a JOIN as a query execution plan
that accesses a single table via a table scan.
@@ -17698,7 +17667,7 @@ bool test_if_ref(Item *root_cond, Item_field *left_item,Item *right_item)
field->real_type() != MYSQL_TYPE_VARCHAR &&
(field->type() != MYSQL_TYPE_FLOAT || field->decimals() == 0))
{
- return !store_val_in_field(field, right_item, CHECK_FIELD_WARN);
+ return !right_item->save_in_field_no_warnings(field, 1);
}
}
}
diff --git a/sql/sql_select.h b/sql/sql_select.h
index be5f523a7e2..118a684ab62 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -1430,7 +1430,6 @@ typedef struct st_select_check {
extern const char *join_type_str[];
/* Extern functions in sql_select.cc */
-bool store_val_in_field(Field *field, Item *val, enum_check_fields check_flag);
void count_field_types(SELECT_LEX *select_lex, TMP_TABLE_PARAM *param,
List<Item> &fields, bool reset_with_sum_func);
bool setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
@@ -1504,6 +1503,7 @@ public:
enum_check_fields saved_count_cuted_fields= thd->count_cuted_fields;
ulonglong sql_mode= thd->variables.sql_mode;
thd->variables.sql_mode&= ~(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE);
+ thd->variables.sql_mode|= MODE_INVALID_DATES;
thd->count_cuted_fields= CHECK_FIELD_IGNORE;