1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-16938 Move Item::get_time_with_conversion() to Time

The affected code is well covered by tests for MDEV-8766.
Adding only the missing part: the old mode OLD_MODE_ZERO_DATE_TIME_CAST
in combination with 0000-MM-00 and YYYY-00-00.

The old mode in combination with 0000-00-DD was already covered,
so was the new mode with all types of DATETIME values.
This commit is contained in:
Alexander Barkov
2018-08-11 06:47:48 +04:00
parent 2966c1e422
commit 2085f14a8d
8 changed files with 77 additions and 157 deletions

View File

@ -1365,26 +1365,6 @@ time_to_datetime_with_warn(THD *thd,
}
bool datetime_to_time_with_warn(THD *thd, const MYSQL_TIME *dt,
MYSQL_TIME *tm, uint dec)
{
if (thd->variables.old_behavior & OLD_MODE_ZERO_DATE_TIME_CAST)
{
*tm= *dt;
datetime_to_time(tm);
return false;
}
else /* new mode */
{
MYSQL_TIME current_date;
set_current_date(thd, &current_date);
calc_time_diff(dt, &current_date, 1, tm, 0);
}
int warnings= 0;
return check_time_range(tm, dec, &warnings);
}
longlong pack_time(const MYSQL_TIME *my_time)
{
return ((((((my_time->year * 13ULL +