Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
Description
In many places in Item::get_date() we use current_thd. After adding of MDEV-16991, access to THD will be needed at every call of get_date(), to check rounding mode from thd->variables.
To avoid heavy use of current_thd, we'll add a THD* parameter to Item::get_date().
Also, at the same time, we'll change "ulonglong fuzzydate" to "date_mode_t fuzzydate".
After this change, the definition of Item::get_date() will look like this:
virtual bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)= 0; |
Where date_mode_t:
- will have stricter data type control, so an attempt to pass to Item::get_date() an arbitrary integer value (instead of date_mode_t) won't compile
- will have a enum-based storage, so in gdb we can see easy readable values instead of integers:
Breakpoint 1, Item_date_typecast::get_date (this=0x7ffe6c016158, thd=
0x7ffe6c000b00, ltime=0x7ffff0c1d8f8, fuzzydate=...)
at /home/bar/maria-git/server.10.4.get_date/sql/item_timefunc.cc:2452
2452 date_mode_t tmp= (fuzzydate | sql_mode_for_dates(thd)) & ~TIME_TIME_ONLY;
(gdb) p fuzzydate
$1 = {
m_mode = (date_mode_t::NO_ZERO_IN_DATE | date_mode_t::NO_ZERO_DATE | date_mode_t::INVALID_DATES)}
We'll also change a number of other dependency functions and methods to get "date_mode_t fuzzydate" instead of "ulonglong fuzzydate".
Attachments
Issue Links
- blocks
-
MDEV-16991 Rounding vs truncation for TIME, DATETIME, TIMESTAMP
- Closed
- is blocked by
-
MDEV-17318 CAST(LEAST(zero_date,non_zero_date) AS numeric_data_type) returns a wrong result
- Closed