diff options
author | Monty <monty@mariadb.org> | 2020-09-02 03:13:32 +0300 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2021-05-19 22:27:28 +0200 |
commit | 6079b46d8d371262882d1bbe7ebeec23b2f83075 (patch) | |
tree | ad649946b27e58e5b451b6bbd470d14d1c161189 /sql/item_timefunc.cc | |
parent | 7ca4e381f7af59dad07aebc5dc4f467b235ab962 (diff) | |
download | mariadb-git-6079b46d8d371262882d1bbe7ebeec23b2f83075.tar.gz |
Split item->flags into base_flags and with_flags
This was done to simplify copying of with_* flags
Other things:
- Changed Flags to C++ enums, which enables gdb to print
out bit values for the flags. This also enables compiler
errors if one tries to manipulate a non existing bit in
a variable.
- Added set_maybe_null() as a shortcut as setting the
MAYBE_NULL flags was used in a LOT of places.
- Renamed PARAM flag to SP_VAR to ensure it's not confused with persistent
statement parameters.
Diffstat (limited to 'sql/item_timefunc.cc')
-rw-r--r-- | sql/item_timefunc.cc | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 031866798ef..96d7daf9c63 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -980,7 +980,7 @@ bool Item_func_monthname::fix_length_and_dec() collation.set(cs, DERIVATION_COERCIBLE, locale->repertoire()); decimals=0; max_length= locale->max_month_name_length * collation.collation->mbmaxlen; - flags|= ITEM_FLAG_MAYBE_NULL; + set_maybe_null(); return FALSE; } @@ -1125,7 +1125,7 @@ bool Item_func_dayname::fix_length_and_dec() collation.set(cs, DERIVATION_COERCIBLE, locale->repertoire()); decimals=0; max_length= locale->max_day_name_length * collation.collation->mbmaxlen; - flags|= ITEM_FLAG_MAYBE_NULL; + set_maybe_null(); return FALSE; } @@ -1774,7 +1774,7 @@ bool Item_func_date_format::fix_length_and_dec() collation.collation->mbmaxlen; set_if_smaller(max_length,MAX_BLOB_WIDTH); } - flags|= ITEM_FLAG_MAYBE_NULL; // If wrong date + set_maybe_null(); // If wrong date return FALSE; } @@ -1937,7 +1937,7 @@ bool Item_func_from_unixtime::fix_length_and_dec() Type_temporal_attributes_not_fixed_dec(MAX_DATETIME_WIDTH, args[0]->decimals, false), DTCollation_numeric()); - flags|= ITEM_FLAG_MAYBE_NULL; + set_maybe_null(); return FALSE; } @@ -2064,7 +2064,7 @@ bool Item_date_add_interval::fix_length_and_dec() { set_func_handler(&func_handler_date_add_interval_string); } - flags|= ITEM_FLAG_MAYBE_NULL; + set_maybe_null(); return m_func_handler->fix_length_and_dec(this); } @@ -2141,7 +2141,7 @@ bool Item_extract::check_arguments() const bool Item_extract::fix_length_and_dec() { - flags|= ITEM_FLAG_MAYBE_NULL; // If wrong date + set_maybe_null(); // If wrong date uint32 daylen= args[0]->cmp_type() == TIME_RESULT ? 2 : TIME_MAX_INTERVAL_DAY_CHAR_LENGTH; switch (int_type) { @@ -2504,7 +2504,8 @@ Item_char_typecast::fix_length_and_dec_native_to_binary(uint32 octet_length) { collation.set(&my_charset_bin, DERIVATION_IMPLICIT); max_length= has_explicit_length() ? (uint32) cast_length : octet_length; - flags|= (current_thd->is_strict_mode() ? ITEM_FLAG_MAYBE_NULL : 0); + if (current_thd->is_strict_mode()) + set_maybe_null(); } @@ -2549,7 +2550,8 @@ void Item_char_typecast::fix_length_and_dec_internal(CHARSET_INFO *from_cs) args[0]->collation.collation->mbmaxlen)); max_length= char_length * cast_cs->mbmaxlen; // Add NULL-ability in strict mode. See Item_str_func::fix_fields() - flags|= (current_thd->is_strict_mode() ? ITEM_FLAG_MAYBE_NULL : 0); + if (current_thd->is_strict_mode()) + set_maybe_null(); } @@ -2673,7 +2675,7 @@ bool Item_func_add_time::fix_length_and_dec() &func_handler_add_time_string_sub); } - flags|= ITEM_FLAG_MAYBE_NULL; + set_maybe_null(); return m_func_handler->fix_length_and_dec(this); } @@ -3059,7 +3061,7 @@ bool Item_func_str_to_date::fix_length_and_dec() if (collation.collation->mbminlen > 1) internal_charset= &my_charset_utf8mb4_general_ci; - flags|= ITEM_FLAG_MAYBE_NULL; + set_maybe_null(); set_func_handler(&func_handler_str_to_date_datetime_usec); if ((const_item= args[1]->const_item())) |