summaryrefslogtreecommitdiff
path: root/sql/field.h
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mnogosearch.org>2013-09-09 15:32:25 +0400
committerAlexander Barkov <bar@mnogosearch.org>2013-09-09 15:32:25 +0400
commitc2b38529a9ca2ea09dfa73186d9350a0d6dcd6ac (patch)
treec4aac68dfd58c8f87a6c1cc8d4c456a8fa02e83b /sql/field.h
parent02338228dd48752a48d611b03ce35efd35d143d7 (diff)
downloadmariadb-git-c2b38529a9ca2ea09dfa73186d9350a0d6dcd6ac.tar.gz
MDEV-4863 COALESCE(time_or_datetime) returns wrong results in numeric context
Diffstat (limited to 'sql/field.h')
-rw-r--r--sql/field.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/sql/field.h b/sql/field.h
index 665b784d820..c1ae476fede 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -52,6 +52,19 @@ inline uint get_set_pack_length(int elements)
return len > 4 ? 8 : len;
}
+/**
+ Tests if field type is temporal, i.e. represents
+ DATE, TIME, DATETIME or TIMESTAMP types in SQL.
+
+ @param type Field type, as returned by field->type().
+ @retval true If field type is temporal
+ @retval false If field type is not temporal
+*/
+inline bool is_temporal_type(enum_field_types type)
+{
+ return mysql_type_to_time_type(type) != MYSQL_TIMESTAMP_ERROR;
+}
+
/*
Virtual_column_info is the class to contain additional
characteristics that is specific for a virtual/computed