diff options
author | Tatiana A. Nurnberg <azundris@mysql.com> | 2009-04-14 21:06:26 +0200 |
---|---|---|
committer | Tatiana A. Nurnberg <azundris@mysql.com> | 2009-04-14 21:06:26 +0200 |
commit | 2e17ce5db3f974a8bc20f6880cba85ce0f0354f8 (patch) | |
tree | 284fc72af6c764e70a212cf37767b0c1b1e04689 /mysql-test/t/func_sapdb.test | |
parent | 84ae9ecab0f3761d8086bce4c2f8dfbcfd43f31e (diff) | |
parent | a91607769ab8d54cbc7bc99d3b0e8d56ed85ed80 (diff) | |
download | mariadb-git-2e17ce5db3f974a8bc20f6880cba85ce0f0354f8.tar.gz |
Bug#42662: maketime() and signedness
merge and additional clarifications
mysql-test/r/func_sapdb.result:
Update test for 42661/42662 to use both TIME(...) and CAST(... AS TIME).
They go through the same code-path here, but may not in the future, and
besides, it's clearer this way.
mysql-test/t/func_sapdb.test:
Update test for 42661/42662 to use both TIME(...) and CAST(... AS TIME).
They go through the same code-path here, but may not in the future, and
besides, it's clearer this way.
sql/item_timefunc.cc:
- fix SEC_TO_TIME(...) for signed values
- fix TIME(...) and CAST(... AS TIME) for signed values
Diffstat (limited to 'mysql-test/t/func_sapdb.test')
-rw-r--r-- | mysql-test/t/func_sapdb.test | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/mysql-test/t/func_sapdb.test b/mysql-test/t/func_sapdb.test index 1292c475732..89eae5955aa 100644 --- a/mysql-test/t/func_sapdb.test +++ b/mysql-test/t/func_sapdb.test @@ -169,4 +169,26 @@ SELECT TIMEDIFF(TIME('17:00:00'),TIME('17:00:00'))=TIME('00:00:00') AS 1Eq, TIMEDIFF(TIME('17:59:00'),TIME('17:00:00')), TIMEDIFF(TIME('17:00:00'),TIME('17:59:00')); +# +# Bug#42661 - sec_to_time() and signedness +# + +SELECT sec_to_time(3020399)=TIME('838:59:59'); +SELECT sec_to_time(-3020399)=TIME('-838:59:59'); +SELECT sec_to_time(-3020399)='-838:59:59'; +SELECT time(sec_to_time(-3020399))=TIME('-838:59:59'); +SELECT time(sec_to_time(-3020399))=TIME('-838:59:58'); + +# +# Bug#42662 - maketime() and signedness +# + +# TIME(...) and CAST(... AS TIME) go through the same code-path here, +# but we'll explicitly show show that both work in case the ever changes. +SELECT maketime(-1,0,1)='-01:00:01'; +SELECT TIME(maketime(-1,0,1))=CAST('-01:00:01' AS TIME); +SELECT maketime(-1,0,1)=CAST('-01:00:01' AS TIME); +SELECT maketime(1,0,1)=CAST('01:00:01' AS TIME); +SELECT maketime(1,0,1)=CAST('01:00:02' AS TIME); + # End of 5.0 tests |