summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.cc
diff options
context:
space:
mode:
authorMagne Mahre <magne.mahre@sun.com>2009-11-04 11:28:50 +0100
committerMagne Mahre <magne.mahre@sun.com>2009-11-04 11:28:50 +0100
commita5d74eb1b406e20658a1ef9ff5ac8add7b0b1c96 (patch)
tree89f1a72c5bd26b657a9b24896dea90ca82b014cc /sql/item_cmpfunc.cc
parent6f5418515fb479ea2a2537d454f8938052a947ed (diff)
downloadmariadb-git-a5d74eb1b406e20658a1ef9ff5ac8add7b0b1c96.tar.gz
Bug#42664: Sign ignored for TIME types when not comparing as longlong
Another code-path dropped sign of TIME, presuming all time is positive. Minds sign now. Patch depends on ChangeSet for 42661. mysql-test/r/type_time.result: Show we now no longer ignore sign of TIME-type in this code-path. mysql-test/t/type_time.test: Show we now no longer ignore sign of TIME-type in this code-path. sql/item_cmpfunc.cc: TIME_to_ulonglong() (somewhat obviously) loses sign of its argument, so we put it back in where needed.
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r--sql/item_cmpfunc.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index c29031d25b5..07160b8307a 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -829,7 +829,8 @@ get_time_value(THD *thd, Item ***item_arg, Item **cache_arg,
else
{
*is_null= item->get_time(&ltime);
- value= !*is_null ? (longlong) TIME_to_ulonglong_datetime(&ltime) : 0;
+ value= !*is_null ? (longlong) TIME_to_ulonglong_datetime(&ltime) *
+ (ltime.neg ? -1 : 1) : 0;
}
/*
Do not cache GET_USER_VAR() function as its const_item() may return TRUE