summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.cc
diff options
context:
space:
mode:
authorTatiana A. Nurnberg <azundris@mysql.com>2009-02-09 06:21:48 +0100
committerTatiana A. Nurnberg <azundris@mysql.com>2009-02-09 06:21:48 +0100
commita91607769ab8d54cbc7bc99d3b0e8d56ed85ed80 (patch)
tree0022093157a305315103f79427db0df199ff166b /sql/item_timefunc.cc
parent6c6fc0978e0123d515bf95059028ebdb9afd75f8 (diff)
downloadmariadb-git-a91607769ab8d54cbc7bc99d3b0e8d56ed85ed80.tar.gz
Bug#42661: sec_to_time() and signedness
Bug#42662: maketime() and signedness Item_time_typecast::val_int() dropped sign from MYSQL_TIME gotten using from get_time(). Propagates sign now. mysql-test/r/func_sapdb.result: Show that comparisons with TIME(-...) work now. mysql-test/t/func_sapdb.test: Show that comparisons with TIME(-...) work now. sql/item_timefunc.cc: don't drop sign when converting from MYSQL_TIME
Diffstat (limited to 'sql/item_timefunc.cc')
-rw-r--r--sql/item_timefunc.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 38d9d62bd99..6a48c13f2e1 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -1730,7 +1730,7 @@ longlong Item_func_sec_to_time::val_int()
sec_to_time(arg_val, args[0]->unsigned_flag, &ltime);
return (ltime.neg ? -1 : 1) *
- ((ltime.hour)*10000 + ltime.minute*100 + ltime.second);
+ (longlong) ((ltime.hour)*10000 + ltime.minute*100 + ltime.second);
}
@@ -2648,7 +2648,8 @@ longlong Item_time_typecast::val_int()
null_value= 1;
return 0;
}
- return ltime.hour * 10000L + ltime.minute * 100 + ltime.second;
+ return (ltime.neg ? -1 : 1) *
+ (longlong) ((ltime.hour)*10000 + ltime.minute*100 + ltime.second);
}
String *Item_time_typecast::val_str(String *str)