1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

small code cleanup taken from MySQL 5.6

This commit is contained in:
Sergei Golubchik
2012-12-16 21:45:45 +01:00
parent fe7c2aaeea
commit 4923d19b7c
12 changed files with 29 additions and 60 deletions

View File

@@ -2552,8 +2552,7 @@ bool check_duplicates_in_interval(const char *set_or_name,
{
THD *thd= current_thd;
ErrConvString err(*cur_value, *cur_length, cs);
if ((current_thd->variables.sql_mode &
(MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES)))
if (current_thd->is_strict_mode())
{
my_error(ER_DUPLICATED_VALUE_IN_TYPE, MYF(0),
name, err.ptr(), set_or_name);
@@ -3734,8 +3733,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
if (tmp_len < key->key_create_info.comment.length)
{
if ((thd->variables.sql_mode &
(MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES)))
if (thd->is_strict_mode())
{
my_error(ER_TOO_LONG_INDEX_COMMENT, MYF(0),
key_info->name, static_cast<ulong>(INDEX_COMMENT_MAXLEN));
@@ -3873,8 +3871,7 @@ static bool prepare_blob_field(THD *thd, Create_field *sql_field)
/* Convert long VARCHAR columns to TEXT or BLOB */
char warn_buff[MYSQL_ERRMSG_SIZE];
if (sql_field->def || (thd->variables.sql_mode & (MODE_STRICT_TRANS_TABLES |
MODE_STRICT_ALL_TABLES)))
if (sql_field->def || thd->is_strict_mode())
{
my_error(ER_TOO_BIG_FIELDLENGTH, MYF(0), sql_field->field_name,
static_cast<ulong>(MAX_FIELD_VARCHARLENGTH /
@@ -7354,9 +7351,7 @@ copy_data_between_tables(THD *thd, TABLE *from,TABLE *to,
alter_table_manage_keys(to, from->file->indexes_are_disabled(), keys_onoff);
/* We can abort alter table for any table type */
thd->abort_on_warning= !ignore && test(thd->variables.sql_mode &
(MODE_STRICT_TRANS_TABLES |
MODE_STRICT_ALL_TABLES));
thd->abort_on_warning= !ignore && thd->is_strict_mode();
from->file->info(HA_STATUS_VARIABLE);
to->file->ha_start_bulk_insert(from->file->stats.records);