summaryrefslogtreecommitdiff
path: root/mysql-test/r/func_time.result
diff options
context:
space:
mode:
authorunknown <gkodinov/kgeorge@macbook.gmz>2007-01-30 17:43:34 +0200
committerunknown <gkodinov/kgeorge@macbook.gmz>2007-01-30 17:43:34 +0200
commit59bdd12fb68a23f4f69348298eb9a1c9f6d65418 (patch)
tree5c7cb0cb4906ff6bc2e08245db1b6d5f5d6c589c /mysql-test/r/func_time.result
parent0406df7c47448ccf04e31577b1f5922e66fee733 (diff)
downloadmariadb-git-59bdd12fb68a23f4f69348298eb9a1c9f6d65418.tar.gz
Bug #25643: SEC_TO_TIME function problem
Checking for NULL before calling the val_xxx() methods only checks for such arguments that are known to be NULLs at compile time. The arguments that may or may not contain NULLs (e.g. function calls and possibly others) are not checked at all. Fixed by first calling the val_xxx() method and then checking for null in SEC_TO_TIME(). In addition QUARTER() was not returning 0 (as all the val_int() functions do when processing a NULL value). mysql-test/r/func_time.result: Bug #25643: SEC_TO_TIME function problem - test case mysql-test/t/func_time.test: Bug #25643: SEC_TO_TIME function problem - test case sql/item_timefunc.cc: Bug #25643: SEC_TO_TIME function problem - null handling fixed for QUARTER() and SEC_TO_TIME()
Diffstat (limited to 'mysql-test/r/func_time.result')
-rw-r--r--mysql-test/r/func_time.result14
1 files changed, 14 insertions, 0 deletions
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index 45c05f0b5b5..32f930ca6ba 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -1207,3 +1207,17 @@ SET NAMES DEFAULT;
select str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE;
str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE
NULL
+CREATE TABLE t1 (a int, t1 time, t2 time, d date, PRIMARY KEY (a));
+INSERT INTO t1 VALUES (1, '10:00:00', NULL, NULL),
+(2, '11:00:00', '11:15:00', '1972-02-06');
+SELECT t1, t2, SEC_TO_TIME( TIME_TO_SEC( t2 ) - TIME_TO_SEC( t1 ) ), QUARTER(d)
+FROM t1;
+t1 t2 SEC_TO_TIME( TIME_TO_SEC( t2 ) - TIME_TO_SEC( t1 ) ) QUARTER(d)
+10:00:00 NULL NULL NULL
+11:00:00 11:15:00 00:15:00 1
+SELECT t1, t2, SEC_TO_TIME( TIME_TO_SEC( t2 ) - TIME_TO_SEC( t1 ) ), QUARTER(d)
+FROM t1 ORDER BY a DESC;
+t1 t2 SEC_TO_TIME( TIME_TO_SEC( t2 ) - TIME_TO_SEC( t1 ) ) QUARTER(d)
+11:00:00 11:15:00 00:15:00 1
+10:00:00 NULL NULL NULL
+DROP TABLE t1;