summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.cc
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2021-01-30 14:03:23 +0200
committerSergei Golubchik <serg@mariadb.org>2021-05-19 22:54:12 +0200
commit08bc062e3c0acde385c08a0872548c40f2c12521 (patch)
tree099f17bd99477da9b00ebb081bf93ebc8f2f54ae /sql/item_cmpfunc.cc
parentd754d3d95188856f5fd1e910a1185d08de1b3783 (diff)
downloadmariadb-git-08bc062e3c0acde385c08a0872548c40f2c12521.tar.gz
Remove some usage of Check_level_instant_set and Sql_mode_save
The reason for the removal are: - Generates more code - Storing and retreving THD - Causes extra code and daata to be generated to handle possible throw exceptions (which never happens in MariaDB code) - Uses more stack space Other things: - Changed convert_const_to_int() to use item->save_in_field_no_warnings(), which made the code shorter and simpler. - Removed not needed code in Sp_handler::sp_create_routine() - Added thd as argument to store_key.copy() to make function simpler - Added thd as argument to some subselect* constructor that inherites from Item_subselect.
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r--sql/item_cmpfunc.cc12
1 files changed, 4 insertions, 8 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index d0038c54124..2a6f8ae57db 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -321,29 +321,25 @@ static bool convert_const_to_int(THD *thd, Item_field *field_item,
if ((*item)->can_eval_in_optimize())
{
TABLE *table= field->table;
- Sql_mode_save sql_mode(thd);
- Check_level_instant_set check_level_save(thd, CHECK_FIELD_IGNORE);
MY_BITMAP *old_maps[2] = { NULL, NULL };
ulonglong UNINIT_VAR(orig_field_val); /* original field value if valid */
+ bool save_field_value;
/* table->read_set may not be set if we come here from a CREATE TABLE */
if (table && table->read_set)
dbug_tmp_use_all_columns(table, old_maps,
&table->read_set, &table->write_set);
- /* For comparison purposes allow invalid dates like 2000-01-32 */
- thd->variables.sql_mode= (thd->variables.sql_mode & ~MODE_NO_ZERO_DATE) |
- MODE_INVALID_DATES;
/*
Store the value of the field/constant because the call to save_in_field
below overrides that value. Don't save field value if no data has been
read yet.
*/
- bool save_field_value= (field_item->const_item() ||
- !(field->table->status & STATUS_NO_RECORD));
+ save_field_value= (field_item->const_item() ||
+ !(field->table->status & STATUS_NO_RECORD));
if (save_field_value)
orig_field_val= field->val_int();
- if (!(*item)->save_in_field(field, 1) && !field->is_null())
+ if (!(*item)->save_in_field_no_warnings(field, 1) && !field->is_null())
{
int field_cmp= 0;
// If item is a decimal value, we must reject it if it was truncated.