This task is self-sufficient change
To make the main
MDEV-16991 patch simpler, we'll move fractional second truncation from these methods:
inside new truncating Time and Datetime constructors.
Later, in the main patch for
MDEV-16991, all truncating Time and Datetime constructors will be fixed to choose between truncation and rounding, according to the current session options. So CAST will automatically start using proper truncation mode.
Additionally, we'll do the following changes:
- in Item_date_typecast::get_date(), replace the call for make_date_with_warn() to a constructor call Date().
- Remove the function make_date_with_warn()
- Remove the check_date_with_warn() call in Item_time_typecast::get_date() that was added in
MDEV-4653in 5.3.13. It is not needed any more. After recent changes, in the scenario described by MDEV-4653(with old_mode=ZERO_DATE_TIME_CAST), dates are checked inside the constructor of Temporal_with_date() on the caller level.
- Add a placement "new" operator the for class Temporal:
to be able to put values of Time, Date and Datetime directly into an existing MYSQL_TIME structure.
As a result the get_date() implementations for the affected classes will look as simple as: