summaryrefslogtreecommitdiff
path: root/include/my_time.h
diff options
context:
space:
mode:
authorkaa@polly.local <>2006-10-04 17:13:32 +0400
committerkaa@polly.local <>2006-10-04 17:13:32 +0400
commit609a3cd2953458626065e1f0b288c1dc5bd3e877 (patch)
tree8b8e52453890c27a4b5e0e288b80cc0ccc883b0a /include/my_time.h
parent66fa757e1f6a3d9373119ac5437e490ead191411 (diff)
downloadmariadb-git-609a3cd2953458626065e1f0b288c1dc5bd3e877.tar.gz
Fixes a number of problems with time/datetime <-> string conversion functions:
- bug #11655 "Wrong time is returning from nested selects - maximum time exists - input and output TIME values were not validated properly in several conversion functions - bug #20927 "sec_to_time treats big unsigned as signed" - integer overflows were not checked in several functions. As a result, input values like 2^32 or 3600*2^32 were treated as 0 - BIGINT UNSIGNED values were treated as SIGNED in several functions - in cases where both input string truncation and out-of-range TIME value occur, only 'truncated incorrect time value' warning was produced
Diffstat (limited to 'include/my_time.h')
-rw-r--r--include/my_time.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/include/my_time.h b/include/my_time.h
index 94701e159c4..11c653f70d0 100644
--- a/include/my_time.h
+++ b/include/my_time.h
@@ -44,12 +44,24 @@ typedef long my_time_t;
#define TIME_FUZZY_DATE 1
#define TIME_DATETIME_ONLY 2
+#define MYSQL_TIME_WARN_TRUNCATED 1
+#define MYSQL_TIME_WARN_OUT_OF_RANGE 2
+
+/* Limits for the TIME data type */
+#define TIME_MAX_HOUR 838
+#define TIME_MAX_MINUTE 59
+#define TIME_MAX_SECOND 59
+#define TIME_MAX_VALUE (TIME_MAX_HOUR*10000 + TIME_MAX_MINUTE*100 + \
+ TIME_MAX_SECOND)
+
enum enum_mysql_timestamp_type
str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
uint flags, int *was_cut);
bool str_to_time(const char *str,uint length, MYSQL_TIME *l_time,
- int *was_cut);
+ int *warning);
+
+int check_time_range(struct st_mysql_time *time, int *warning);
long calc_daynr(uint year,uint month,uint day);