diff options
Diffstat (limited to 'sql/item_timefunc.h')
-rw-r--r-- | sql/item_timefunc.h | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index 318bef22ad1..3824f87d12b 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -993,12 +993,12 @@ class Item_extract :public Item_int_func, EXTRACT(DAY FROM '-24:00:00') -> -1 */ set_handler(handler_by_length(max_length= length + 1/*sign*/, 11)); - m_date_mode= TIME_INTERVAL_DAY; + m_date_mode= Temporal::Options(TIME_INTERVAL_DAY, current_thd); } void set_time_length(uint32 length) { set_handler(handler_by_length(max_length= length + 1/*sign*/, 11)); - m_date_mode= TIME_INTERVAL_hhmmssff; + m_date_mode= Temporal::Options(TIME_INTERVAL_hhmmssff, current_thd); } public: const interval_type int_type; // keep it public @@ -1117,7 +1117,7 @@ public: { } String *val_str(String *to) { - Interval_DDhhmmssff it(current_thd, args[0]); + Interval_DDhhmmssff it(current_thd, args[0], m_fsp); null_value= !it.is_valid_interval_DDhhmmssff(); return it.to_string(to, m_fsp); } @@ -1222,7 +1222,7 @@ public: } bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) { - Datetime dt(thd, args[0], date_mode_t(0)); + Datetime dt(thd, args[0], Datetime::Options(TIME_CONV_NONE, thd)); if (!dt.is_valid_datetime()) return null_value= true; Interval_DDhhmmssff it(thd, args[1]); @@ -1461,7 +1461,8 @@ public: bool get_date(THD *thd, Item_handled_func *item, MYSQL_TIME *to, date_mode_t fuzzy) const { - Datetime dt(thd, item->arguments()[0], date_mode_t(0)); + Datetime::Options opt(TIME_CONV_NONE, thd); + Datetime dt(thd, item->arguments()[0], opt); if (!dt.is_valid_datetime() || dt.check_date_with_warn(thd, TIME_NO_ZERO_DATE | TIME_NO_ZERO_IN_DATE)) return (item->null_value= true); @@ -1489,7 +1490,11 @@ public: bool get_date(THD *thd, Item_handled_func *item, MYSQL_TIME *to, date_mode_t fuzzy) const { - Date d(thd, item->arguments()[0], date_mode_t(0)); + /* + The first argument is known to be of the DATE data type (not DATETIME). + We don't need rounding here. + */ + Date d(thd, item->arguments()[0], TIME_CONV_NONE); if (!d.is_valid_date() || d.check_date_with_warn(thd, TIME_NO_ZERO_DATE | TIME_NO_ZERO_IN_DATE)) return (item->null_value= true); @@ -1542,10 +1547,10 @@ public: bool get_date(THD *thd, Item_handled_func *item, MYSQL_TIME *to, date_mode_t fuzzy) const { - if (item->arguments()[0]->get_date(thd, to, date_mode_t(0)) || + if (item->arguments()[0]-> + get_date(thd, to, Datetime::Options(TIME_CONV_NONE, thd)) || (to->time_type != MYSQL_TIMESTAMP_TIME && - check_date_with_warn(thd, to, TIME_NO_ZERO_DATE | TIME_NO_ZERO_IN_DATE, - MYSQL_TIMESTAMP_ERROR))) + check_date_with_warn(thd, to, TIME_NO_ZEROS, MYSQL_TIMESTAMP_ERROR))) return (item->null_value= true); return (item->null_value= add(thd, item->arguments()[1], int_type(item), sub(item), to)); @@ -1581,7 +1586,8 @@ public: MYSQL_TIME *to, date_mode_t fuzzy) const { DBUG_ASSERT(item->is_fixed()); - Datetime dt(thd, item->arguments()[0], date_mode_t(0)); + Datetime::Options opt(TIME_CONV_NONE, thd); + Datetime dt(thd, item->arguments()[0], opt); if (!dt.is_valid_datetime()) return item->null_value= true; Interval_DDhhmmssff it(thd, item->arguments()[1]); @@ -1650,7 +1656,8 @@ public: { DBUG_ASSERT(item->is_fixed()); // Detect a proper timestamp type based on the argument values - Temporal_hybrid l_time1(thd, item->arguments()[0], TIME_TIME_ONLY); + Temporal_hybrid l_time1(thd, item->arguments()[0], + Temporal::Options(TIME_TIME_ONLY, thd)); if (!l_time1.is_valid_temporal()) return (item->null_value= true); Interval_DDhhmmssff l_time2(thd, item->arguments()[1]); |