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

MDEV-17740 Extend EXTRACT(x AS DAY*) to understand long time intervals

This commit is contained in:
Alexander Barkov
2018-11-16 19:18:17 +04:00
parent f92d223fe2
commit d2ba9edd66
13 changed files with 1234 additions and 140 deletions

View File

@ -371,18 +371,14 @@ public:
};
/* Character set-aware version of str_to_datetime_or_date_or_time() */
bool Temporal::str_to_datetime_or_date_or_time(MYSQL_TIME_STATUS *status,
/* Character set-aware version of ascii_to_datetime_or_date_or_time() */
bool Temporal::str_to_datetime_or_date_or_time(MYSQL_TIME_STATUS *st,
const char *str, size_t length,
CHARSET_INFO *cs,
date_mode_t fuzzydate)
{
TemporalAsciiBuffer tmp(str, length, cs);
bool rc= ::str_to_datetime_or_date_or_time(tmp.str, tmp.length, this,
ulonglong(fuzzydate & TIME_MODE_FOR_XXX_TO_DATE),
status);
DBUG_ASSERT(status->warnings || !rc);
return rc;
return ascii_to_datetime_or_date_or_time(st, tmp.str, tmp.length, fuzzydate);
}
@ -393,11 +389,17 @@ bool Temporal::str_to_datetime_or_date(MYSQL_TIME_STATUS *status,
date_mode_t flags)
{
TemporalAsciiBuffer tmp(str, length, cs);
bool rc= ::str_to_datetime_or_date(tmp.str, tmp.length, this,
ulonglong(flags & TIME_MODE_FOR_XXX_TO_DATE),
status);
DBUG_ASSERT(status->warnings || !rc);
return rc;
return ascii_to_datetime_or_date(status, tmp.str, tmp.length, flags);
}
/* Character set-aware version of ascii_to_temporal() */
bool Temporal::str_to_temporal(MYSQL_TIME_STATUS *status,
const char *str, size_t length, CHARSET_INFO *cs,
date_mode_t flags)
{
TemporalAsciiBuffer tmp(str, length, cs);
return ascii_to_temporal(status, tmp.str, tmp.length, flags);
}