diff options
author | Sergei Golubchik <sergii@pisem.net> | 2014-06-06 00:07:27 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2014-06-06 00:07:27 +0200 |
commit | e27c338634739ef56a6888e7948e04c0fa0ba677 (patch) | |
tree | ad63ccae614f3dd77509825d1905fd815ef322cb /sql-common/my_time.c | |
parent | 2a5905141a3c509a7c34c3d370fb146dbc1c965f (diff) | |
parent | 6d75570e99fbf070cdbeefdfbcfc94d1c7b3ad1f (diff) | |
download | mariadb-git-e27c338634739ef56a6888e7948e04c0fa0ba677.tar.gz |
5.5.38 merge
Diffstat (limited to 'sql-common/my_time.c')
-rw-r--r-- | sql-common/my_time.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sql-common/my_time.c b/sql-common/my_time.c index 983bd8a3de4..6a011df795a 100644 --- a/sql-common/my_time.c +++ b/sql-common/my_time.c @@ -1214,7 +1214,7 @@ longlong number_to_datetime(longlong nr, ulong sec_part, MYSQL_TIME *time_res, *was_cut= 0; time_res->time_type=MYSQL_TIMESTAMP_DATE; - if (nr == 0 || nr >= 10000101000000LL || sec_part) + if (nr == 0 || nr >= 10000101000000LL) { time_res->time_type=MYSQL_TIMESTAMP_DATETIME; goto ok; @@ -1272,7 +1272,11 @@ longlong number_to_datetime(longlong nr, ulong sec_part, MYSQL_TIME *time_res, time_res->minute <= 59 && time_res->second <= 59 && sec_part <= TIME_MAX_SECOND_PART && !check_date(time_res, nr || sec_part, flags, was_cut)) + { + if (time_res->time_type == MYSQL_TIMESTAMP_DATE && sec_part != 0) + *was_cut= MYSQL_TIME_NOTE_TRUNCATED; return nr; + } /* Don't want to have was_cut get set if NO_ZERO_DATE was violated. */ if (nr || !(flags & TIME_NO_ZERO_DATE)) @@ -1306,10 +1310,10 @@ longlong number_to_datetime(longlong nr, ulong sec_part, MYSQL_TIME *time_res, 0 time value is valid, but was possibly truncated -1 time value is invalid */ -int number_to_time(my_bool neg, longlong nr, ulong sec_part, +int number_to_time(my_bool neg, ulonglong nr, ulong sec_part, MYSQL_TIME *ltime, int *was_cut) { - if (nr > 9999999 && neg == 0) + if (nr > 9999999 && nr < 99991231235959ULL && neg == 0) { if (number_to_datetime(nr, sec_part, ltime, TIME_INVALID_DATES, was_cut) < 0) |