[MDEV-17288] Replace Item_func::get_arg0_date() to Date/Datetime methods Created: 2018-09-25  Updated: 2018-09-25  Resolved: 2018-09-25

Status: Closed
Project: MariaDB Server
Component/s: Data types, Temporal Types
Fix Version/s: 10.4.0

Type: Task Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Blocks
blocks MDEV-16991 Rounding vs truncation for TIME, DATE... Closed

 Description   

Item_func has this method:

inline bool get_arg0_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
{
  DBUG_ASSERT(!(fuzzy_date & TIME_TIME_ONLY));
  Datetime dt(current_thd, args[0], fuzzy_date);
  return (null_value= dt.copy_to_mysql_time(ltime));
}

which now handles DATE and DATETIME data types.

After MDEV-16991, it won't be possible to have this method, because DATE and DATETIME will have different rounding behavior.

Under terms of this fact, the following changes will be done:

1. get_arg0_date() will be removed
2. All get_arg0_date() calls will be replaced to instantiation of Date or Datetime (depending on the data type needed) and accessing their members through various methods.
3. To simplify the code in item_timefunc.cc and to reuse some duplicate code, the following methods will be added into Date and/or Datetime:

  • daynr()
  • to_seconds()
  • check_date()
  • dayofyear()
  • quarter()
  • week()
  • yearweek()

Generated at Thu Feb 08 08:35:20 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.