diff options
author | Alexander Barkov <bar@mariadb.org> | 2015-07-08 19:20:07 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2015-07-08 19:20:07 +0400 |
commit | 77803703431d79f5dcc2b23b3f878dfdbaf01c2b (patch) | |
tree | f372def78612580f0089ff4ce976fd8911b57198 /sql/sql_time.h | |
parent | 8154ef4b16fe140a42f3e90903192bb3b0fec041 (diff) | |
download | mariadb-git-77803703431d79f5dcc2b23b3f878dfdbaf01c2b.tar.gz |
MDEV-8336 The meaning of NO_ZERO_DATE is not clear for DATETIME.
In some cases NO_ZERO_DATE did not allow datetime values with zero date part
and non-zero time part (e.g. '0000-00-00 10:20:30.123456').
Allowing values of this kind in all known pieces of the code.
Diffstat (limited to 'sql/sql_time.h')
-rw-r--r-- | sql/sql_time.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/sql/sql_time.h b/sql/sql_time.h index dc8e4668e1e..8e13ee1870a 100644 --- a/sql/sql_time.h +++ b/sql/sql_time.h @@ -143,13 +143,24 @@ extern DATE_TIME_FORMAT global_time_format; extern KNOWN_DATE_TIME_FORMAT known_date_time_formats[]; extern LEX_STRING interval_type_to_name[]; - static inline bool -non_zero_date(const MYSQL_TIME *ltime) +non_zero_hhmmssuu(const MYSQL_TIME *ltime) +{ + return ltime->hour || ltime->minute || ltime->second || ltime->second_part; +} +static inline bool +non_zero_YYMMDD(const MYSQL_TIME *ltime) { return ltime->year || ltime->month || ltime->day; } static inline bool +non_zero_date(const MYSQL_TIME *ltime) +{ + return non_zero_YYMMDD(ltime) || + (ltime->time_type == MYSQL_TIMESTAMP_DATETIME && + non_zero_hhmmssuu(ltime)); +} +static inline bool check_date(const MYSQL_TIME *ltime, ulonglong flags, int *was_cut) { return check_date(ltime, non_zero_date(ltime), flags, was_cut); |