1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

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.
This commit is contained in:
Monty
2021-01-30 14:03:23 +02:00
committed by Sergei Golubchik
parent d754d3d951
commit 08bc062e3c
9 changed files with 71 additions and 47 deletions

View File

@ -1930,15 +1930,17 @@ public:
@details this function makes sure truncation warnings when preparing the
key buffers don't end up as errors (because of an enclosing INSERT/UPDATE).
*/
enum store_key_result copy()
enum store_key_result copy(THD *thd)
{
enum store_key_result result;
THD *thd= to_field->table->in_use;
Check_level_instant_set check_level_save(thd, CHECK_FIELD_IGNORE);
Sql_mode_save sql_mode(thd);
enum_check_fields org_count_cuted_fields= thd->count_cuted_fields;
sql_mode_t org_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;
result= copy_inner();
thd->count_cuted_fields= org_count_cuted_fields;
thd->variables.sql_mode= org_sql_mode;
return result;
}