diff options
author | unknown <dlenev@mysql.com> | 2004-11-19 18:35:36 +0300 |
---|---|---|
committer | unknown <dlenev@mysql.com> | 2004-11-19 18:35:36 +0300 |
commit | 7368b14719b22e4bdb439a1fcda88b3ac0ccc673 (patch) | |
tree | a195ead1015ae682d794d4a7c6022a10d363c17a /include | |
parent | 77c163c3e3bdfb884e96f89bfb90e277ecfc816e (diff) | |
parent | 5d9f7edd6dfb0d6759a5374ac61c0153db48b1f7 (diff) | |
download | mariadb-git-7368b14719b22e4bdb439a1fcda88b3ac0ccc673.tar.gz |
Manual merge of fix for bug #6266 "Invalid DATETIME value is not handled
properly" with main tree.
libmysql/libmysql.c:
Auto merged
sql-common/my_time.c:
Auto merged
sql/field.cc:
Auto merged
sql/item.cc:
Auto merged
sql/sql_prepare.cc:
Auto merged
tests/client_test.c:
Manual merge.
Diffstat (limited to 'include')
-rw-r--r-- | include/my_time.h | 5 | ||||
-rw-r--r-- | include/mysql_time.h | 12 |
2 files changed, 15 insertions, 2 deletions
diff --git a/include/my_time.h b/include/my_time.h index dab17904b2d..94701e159c4 100644 --- a/include/my_time.h +++ b/include/my_time.h @@ -58,14 +58,15 @@ void init_time(void); my_time_t my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone, bool *in_dst_time_gap); -void set_zero_time(MYSQL_TIME *tm); +void set_zero_time(MYSQL_TIME *tm, enum enum_mysql_timestamp_type time_type); /* Required buffer length for my_time_to_str, my_date_to_str, my_datetime_to_str and TIME_to_string functions. Note, that the caller is still responsible to check that given TIME structure has values in valid ranges, otherwise size of the buffer could - be not enough. + be not enough. We also rely on the fact that even wrong values + sent using binary protocol fit in this buffer. */ #define MAX_DATE_STRING_REP_LENGTH 30 diff --git a/include/mysql_time.h b/include/mysql_time.h index ec67d60dea5..5f4fc12c005 100644 --- a/include/mysql_time.h +++ b/include/mysql_time.h @@ -33,6 +33,18 @@ enum enum_mysql_timestamp_type }; +/* + Structure which is used to represent datetime values inside MySQL. + + We assume that values in this structure are normalized, i.e. year <= 9999, + month <= 12, day <= 31, hour <= 23, hour <= 59, hour <= 59. Many functions + in server such as my_system_gmt_sec() or make_time() family of functions + rely on this (actually now usage of make_*() family relies on a bit weaker + restriction). Also functions that produce MYSQL_TIME as result ensure this. + There is one exception to this rule though if this structure holds time + value (time_type == MYSQL_TIMESTAMP_TIME) days and hour member can hold + bigger values. +*/ typedef struct st_mysql_time { unsigned int year, month, day, hour, minute, second; |