diff options
author | unknown <dlenev@mysql.com> | 2004-12-30 21:37:32 +0300 |
---|---|---|
committer | unknown <dlenev@mysql.com> | 2004-12-30 21:37:32 +0300 |
commit | dc09d7f3626241fe34ed0dffa659bb4630ca4bf8 (patch) | |
tree | 8e50594a30d4d0d2a0239ab976ce23fe93ec089c /sql/item_timefunc.cc | |
parent | 328ecfa73128259c53728812955cca92f6030704 (diff) | |
parent | f7863e30a9a78d3684ad728854e27d0ee9334bd7 (diff) | |
download | mariadb-git-dc09d7f3626241fe34ed0dffa659bb4630ca4bf8.tar.gz |
Manual merge of fix for bugs of #7297 and #7515 into 4.1 tree.
mysql-test/r/func_time.result:
Manual merge.
mysql-test/r/type_datetime.result:
Manual merge.
mysql-test/t/func_time.test:
Manual merge.
mysql-test/t/type_datetime.test:
Manual merge.
sql/item_timefunc.cc:
Manual merge.
sql/item_timefunc.h:
Manual merge.
sql/time.cc:
Manual merge.
Diffstat (limited to 'sql/item_timefunc.cc')
-rw-r--r-- | sql/item_timefunc.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 054a9966e73..6198043b576 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -1636,11 +1636,12 @@ longlong Item_func_from_unixtime::val_int() bool Item_func_from_unixtime::get_date(TIME *ltime, uint fuzzy_date __attribute__((unused))) { - longlong tmp= args[0]->val_int(); - - if ((null_value= (args[0]->null_value || - tmp < TIMESTAMP_MIN_VALUE || - tmp > TIMESTAMP_MAX_VALUE))) + ulonglong tmp= (ulonglong)(args[0]->val_int()); + /* + "tmp > TIMESTAMP_MAX_VALUE" check also covers case of negative + from_unixtime() argument since tmp is unsigned. + */ + if ((null_value= (args[0]->null_value || tmp > TIMESTAMP_MAX_VALUE))) return 1; thd->variables.time_zone->gmt_sec_to_TIME(ltime, (my_time_t)tmp); |