diff options
author | Alexander Barkov <bar@mariadb.org> | 2014-06-04 21:53:15 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2014-06-04 21:53:15 +0400 |
commit | 284479c085f005a705d31e37e9cd85bb670d615e (patch) | |
tree | 044868e9c5a27a60750f3389ca63763f2bbc1ef0 /sql-common/my_time.c | |
parent | 55bfabf9715c15df16adb4a3e8880deb4943df2b (diff) | |
parent | 661daf16f11ffa879ffb005008b6e73f6744e0ad (diff) | |
download | mariadb-git-284479c085f005a705d31e37e9cd85bb670d615e.tar.gz |
Merge 5.3->5.5
Diffstat (limited to 'sql-common/my_time.c')
-rw-r--r-- | sql-common/my_time.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sql-common/my_time.c b/sql-common/my_time.c index b91028cc1ea..860f69a7f8e 100644 --- a/sql-common/my_time.c +++ b/sql-common/my_time.c @@ -1223,7 +1223,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; @@ -1281,7 +1281,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)) @@ -1315,10 +1319,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) @@ -1326,7 +1330,7 @@ int number_to_time(my_bool neg, longlong nr, ulong sec_part, ltime->year= ltime->month= ltime->day= 0; ltime->time_type= MYSQL_TIMESTAMP_TIME; - *was_cut= MYSQL_TIME_WARN_TRUNCATED; + *was_cut= MYSQL_TIME_NOTE_TRUNCATED; return 0; } |