summaryrefslogtreecommitdiff
path: root/include/my_time.h
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2013-07-10 12:12:27 +0400
committerAlexander Barkov <bar@mariadb.org>2013-07-10 12:12:27 +0400
commitd98584f56a5ec46d6258bba6250c6c797a678afd (patch)
tree7608b63b2a1e8bf9b6f9e74f9a0dd6a5848fbdbb /include/my_time.h
parent17f3ae267f3b8c189be1671f86902f24ae79cdeb (diff)
downloadmariadb-git-d98584f56a5ec46d6258bba6250c6c797a678afd.tar.gz
Adding support for the SQL-standard temporal literals.
added: mysql-test/r/temporal_literal.result mysql-test/t/temporal_literal.test modified: client/mysqlbinlog.cc include/my_time.h mysql-test/r/cast.result mysql-test/r/partition_innodb.result mysql-test/t/cast.test mysql-test/t/partition_innodb.test sql-common/my_time.c sql/field.cc sql/item.cc sql/item.h sql/item_cmpfunc.cc sql/item_create.cc sql/item_create.h sql/item_strfunc.cc sql/item_timefunc.cc sql/item_timefunc.h sql/sql_select.cc sql/sql_time.cc sql/sql_time.h sql/sql_yacc.yy storage/spider/spd_db_mysql.cc
Diffstat (limited to 'include/my_time.h')
-rw-r--r--include/my_time.h27
1 files changed, 20 insertions, 7 deletions
diff --git a/include/my_time.h b/include/my_time.h
index 046b5c94923..f7227b168be 100644
--- a/include/my_time.h
+++ b/include/my_time.h
@@ -78,14 +78,27 @@ extern uchar days_in_month[];
#define TIME_MAX_VALUE_SECONDS (TIME_MAX_HOUR * 3600L + \
TIME_MAX_MINUTE * 60L + TIME_MAX_SECOND)
+/*
+ Structure to return status from
+ str_to_datetime(), str_to_time().
+*/
+typedef struct st_mysql_time_status
+{
+ int warnings;
+ uint precision;
+} MYSQL_TIME_STATUS;
+
+static inline void my_time_status_init(MYSQL_TIME_STATUS *status)
+{
+ status->warnings= status->precision= 0;
+}
+
my_bool check_date(const MYSQL_TIME *ltime, my_bool not_zero_date,
ulonglong flags, int *was_cut);
-enum enum_mysql_timestamp_type
-str_to_time(const char *str, uint length, MYSQL_TIME *l_time,
- ulonglong flag, int *warning);
-enum enum_mysql_timestamp_type
-str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
- ulonglong flags, int *was_cut);
+my_bool str_to_time(const char *str, uint length, MYSQL_TIME *l_time,
+ ulonglong flag, MYSQL_TIME_STATUS *status);
+my_bool str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
+ ulonglong flags, MYSQL_TIME_STATUS *status);
longlong number_to_datetime(longlong nr, ulong sec_part, MYSQL_TIME *time_res,
ulonglong flags, int *was_cut);
@@ -107,7 +120,7 @@ ulonglong TIME_to_ulonglong_time(const MYSQL_TIME *);
ulonglong TIME_to_ulonglong(const MYSQL_TIME *);
double TIME_to_double(const MYSQL_TIME *my_time);
-longlong pack_time(MYSQL_TIME *my_time);
+longlong pack_time(const MYSQL_TIME *my_time);
MYSQL_TIME *unpack_time(longlong packed, MYSQL_TIME *my_time);
int check_time_range(struct st_mysql_time *my_time, uint dec, int *warning);