summaryrefslogtreecommitdiff
path: root/sql-common/my_time.c
diff options
context:
space:
mode:
authorunknown <dlenev@mysql.com>2004-11-19 18:35:36 +0300
committerunknown <dlenev@mysql.com>2004-11-19 18:35:36 +0300
commit7368b14719b22e4bdb439a1fcda88b3ac0ccc673 (patch)
treea195ead1015ae682d794d4a7c6022a10d363c17a /sql-common/my_time.c
parent77c163c3e3bdfb884e96f89bfb90e277ecfc816e (diff)
parent5d9f7edd6dfb0d6759a5374ac61c0153db48b1f7 (diff)
downloadmariadb-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 'sql-common/my_time.c')
-rw-r--r--sql-common/my_time.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sql-common/my_time.c b/sql-common/my_time.c
index d1a36a75a5a..29935696b7d 100644
--- a/sql-common/my_time.c
+++ b/sql-common/my_time.c
@@ -343,7 +343,8 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
(l_time->month || l_time->day))
l_time->year+= (l_time->year < YY_PART_YEAR ? 2000 : 1900);
- if (number_of_fields < 3 || l_time->month > 12 ||
+ if (number_of_fields < 3 ||
+ l_time->year > 9999 || l_time->month > 12 ||
l_time->day > 31 || l_time->hour > 23 ||
l_time->minute > 59 || l_time->second > 59 ||
(!(flags & TIME_FUZZY_DATE) && (l_time->month == 0 || l_time->day == 0)))
@@ -733,10 +734,10 @@ my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone, bool *in_dst_time_gap)
/* Set MYSQL_TIME structure to 0000-00-00 00:00:00.000000 */
-void set_zero_time(MYSQL_TIME *tm)
+void set_zero_time(MYSQL_TIME *tm, enum enum_mysql_timestamp_type time_type)
{
bzero((void*) tm, sizeof(*tm));
- tm->time_type= MYSQL_TIMESTAMP_NONE;
+ tm->time_type= time_type;
}