summaryrefslogtreecommitdiff
path: root/sql/sql_time.h
diff options
context:
space:
mode:
authorSreeharsha Ramanavarapu <sreeharsha.ramanavarapu@oracle.com>2015-12-31 07:31:12 +0530
committerSreeharsha Ramanavarapu <sreeharsha.ramanavarapu@oracle.com>2015-12-31 07:31:12 +0530
commitcb15cce746db6c32cb62c70bd356b2db61267fd9 (patch)
treea2d122afa60bd1c2c7923edf7a540439e3cdb4a2 /sql/sql_time.h
parent1ec594dd60aa3b58e7d1c686016695b5b0bc1aa1 (diff)
downloadmariadb-git-cb15cce746db6c32cb62c70bd356b2db61267fd9.tar.gz
Bug #21564557: INCONSISTENT OUTPUT FROM 5.5 AND 5.6
UNIX_TIMESTAMP(STR_TO_DATE('201506', "%Y%M" Issue: ----- When an invalid date is supplied to the UNIX_TIMESTAMP function from STR_TO_DATE, no check is performed before converting it to a timestamp value. SOLUTION: --------- Add the check_date function and only if it succeeds, proceed to the timestamp conversion. No warning will be returned for dates having zero in month/date, since partial dates are allowed. UNIX_TIMESTAMP will return only a zero for such values. The problem has been handled in 5.6+ with WL#946.
Diffstat (limited to 'sql/sql_time.h')
-rw-r--r--sql/sql_time.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/sql/sql_time.h b/sql/sql_time.h
index 0418a0e9621..3e3cd693613 100644
--- a/sql/sql_time.h
+++ b/sql/sql_time.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -91,6 +91,11 @@ inline bool parse_date_time_format(timestamp_type format_type,
date_time_format);
}
+static inline bool
+non_zero_date(const MYSQL_TIME *ltime)
+{
+ return ltime->year || ltime->month || ltime->day;
+}
extern DATE_TIME_FORMAT global_date_format;
extern DATE_TIME_FORMAT global_datetime_format;