mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
A cleanup for MDEV-17317 Add THD* parameter into Item::get_date() and stricter data type control to "fuzzydate"
Fixing C++ function check_date() to get the "fuzzydate" as date_mode_t rather than ulonglong, so conversion from date_time_t to ulonglong is now done inside C++ check_date(), and no conversion is needed in the callers' code. As an additional safety, modified the code not to pass TIME_FUZZY_DATE to the low level C functions: - check_date() - str_to_datetime() - str_to_time() - number_to_datetime() because TIME_FUZZY_DATE is known only on the C++ level, C functions do not know it. Soon we'll be adding more flags into the C++ level (i.e. to date_time_t), e.g. for rounding. It's a good idea to prevent passing C++ specific flags into pure C routines before this change. Asserts were added into the affected C functions to verify that the caller passed only known C level flags.
This commit is contained in:
@ -480,7 +480,8 @@ void Temporal_with_date::make_from_item(THD *thd, Item *item)
|
||||
|
||||
void Temporal_with_date::check_date_or_invalidate(int *warn, date_mode_t flags)
|
||||
{
|
||||
if (check_date(this, pack_time(this) != 0, ulonglong(flags), warn))
|
||||
if (check_date(this, pack_time(this) != 0,
|
||||
ulonglong(flags & TIME_MODE_FOR_XXX_TO_DATE), warn))
|
||||
time_type= MYSQL_TIMESTAMP_NONE;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user