summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_time.h15
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);