Commit 610cea3d authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup

Helper class to swicth to relaxed checks during field copy.
Temporarily.
parent ad27e95d
drop table if exists t1,t2;
set @sav_dpi= @@div_precision_increment;
set div_precision_increment= 5;
show variables like 'div_precision_increment';
......
--disable_warnings
drop table if exists t1,t2;
--enable_warnings
set @sav_dpi= @@div_precision_increment;
set div_precision_increment= 5;
show variables like 'div_precision_increment';
......
drop table if exists t1,t2;
create table t1 (a char(16), b date, c datetime);
insert into t1 SET a='test 2000-01-01', b='2000-01-01', c='2000-01-01';
select * from t1 where c = '2000-01-01';
......
#
# test of problem with date fields
#
--disable_warnings
drop table if exists t1,t2;
--enable_warnings
create table t1 (a char(16), b date, c datetime);
insert into t1 SET a='test 2000-01-01', b='2000-01-01', c='2000-01-01';
select * from t1 where c = '2000-01-01';
......
......@@ -1472,12 +1472,8 @@ int Item::save_in_field_no_warnings(Field *field, bool no_conversions)
{
int res;
TABLE *table= field->table;
THD *thd= table->in_use;
Check_level_instant_set check_level_save(thd, CHECK_FIELD_IGNORE);
Sql_mode_save sql_mode(thd);
thd->variables.sql_mode&= ~(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE);
thd->variables.sql_mode|= MODE_INVALID_DATES;
MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, &table->write_set);
Use_relaxed_field_copy urfc(table->in_use);
res= save_in_field(field, no_conversions);
dbug_tmp_restore_column_map(&table->write_set, old_map);
return res;
......
......@@ -6881,6 +6881,19 @@ class Check_level_instant_set
};
class Use_relaxed_field_copy: public Sql_mode_save,
public Check_level_instant_set
{
public:
Use_relaxed_field_copy(THD *thd) :
Sql_mode_save(thd), Check_level_instant_set(thd, CHECK_FIELD_IGNORE)
{
thd->variables.sql_mode&= ~(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE);
thd->variables.sql_mode|= MODE_INVALID_DATES;
}
};
/**
This class resembles the SQL Standard schema qualified object name:
<schema qualified name> ::= [ <schema name> <period> ] <qualified identifier>
......
......@@ -1914,11 +1914,7 @@ class store_key :public Sql_alloc
enum store_key_result copy()
{
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);
thd->variables.sql_mode&= ~(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE);
thd->variables.sql_mode|= MODE_INVALID_DATES;
Use_relaxed_field_copy urfc(to_field->table->in_use);
result= copy_inner();
return result;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment