List:Commits« Previous MessageNext Message »
From:Tatiana A. Nurnberg Date:February 9 2009 5:26pm
Subject:bzr commit into mysql-5.0-bugteam branch (azundris:2739)
View as plain text  
#At file:///misc/mysql/forest/42664/50-42664/ based on revid:timothy.smith@stripped

 2739 Tatiana A. Nurnberg	2009-02-09 [merge]
      auto-merge
modified:
  mysql-test/r/func_sapdb.result
  mysql-test/t/func_sapdb.test
  sql/item_timefunc.cc

=== modified file 'mysql-test/r/func_sapdb.result'
--- a/mysql-test/r/func_sapdb.result	2009-02-06 17:25:08 +0000
+++ b/mysql-test/r/func_sapdb.result	2009-02-09 05:21:48 +0000
@@ -282,3 +282,33 @@ TIMEDIFF(TIME('17:59:00'),TIME('17:00:00
 TIMEDIFF(TIME('17:00:00'),TIME('17:59:00'));
 1Eq	1NEq1	1NEq2	2Eq	2NEq1	2NEq2	3Eq	3NEq1	3NEq2	Time0	Time00	Literal0000	TIMEDIFF(TIME('17:59:00'),TIME('17:00:00'))	TIMEDIFF(TIME('17:00:00'),TIME('17:59:00'))
 1	0	0	1	0	0	1	0	0	00:00:00	00:00:00	00:00:00	00:59:00	-00:59:00
+SELECT sec_to_time(3020399)=time('838:59:59');
+sec_to_time(3020399)=time('838:59:59')
+1
+SELECT sec_to_time(-3020399)=time('-838:59:59');
+sec_to_time(-3020399)=time('-838:59:59')
+1
+SELECT sec_to_time(-3020399)='-838:59:59';
+sec_to_time(-3020399)='-838:59:59'
+1
+SELECT time(sec_to_time(-3020399))=time('-838:59:59');
+time(sec_to_time(-3020399))=time('-838:59:59')
+1
+SELECT time(sec_to_time(-3020399))=time('-838:59:58');
+time(sec_to_time(-3020399))=time('-838:59:58')
+0
+SELECT maketime(-1,0,1)='-01:00:01';
+maketime(-1,0,1)='-01:00:01'
+1
+SELECT TIME(maketime(-1,0,1))=TIME('-01:00:01');
+TIME(maketime(-1,0,1))=TIME('-01:00:01')
+1
+SELECT maketime(-1,0,1)=TIME('-01:00:01');
+maketime(-1,0,1)=TIME('-01:00:01')
+1
+SELECT maketime(1,0,1)=TIME('01:00:01');
+maketime(1,0,1)=TIME('01:00:01')
+1
+SELECT maketime(1,0,1)=TIME('01:00:02');
+maketime(1,0,1)=TIME('01:00:02')
+0

=== modified file 'mysql-test/t/func_sapdb.test'
--- a/mysql-test/t/func_sapdb.test	2009-02-06 17:25:08 +0000
+++ b/mysql-test/t/func_sapdb.test	2009-02-09 05:21:48 +0000
@@ -169,4 +169,24 @@ SELECT TIMEDIFF(TIME('17:00:00'),TIME('1
        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
+#
+
+SELECT maketime(-1,0,1)='-01:00:01';
+SELECT TIME(maketime(-1,0,1))=TIME('-01:00:01');
+SELECT maketime(-1,0,1)=TIME('-01:00:01');
+SELECT maketime(1,0,1)=TIME('01:00:01');
+SELECT maketime(1,0,1)=TIME('01:00:02');
+
 # End of 5.0 tests

=== modified file 'sql/item_timefunc.cc'
--- a/sql/item_timefunc.cc	2008-12-23 14:08:04 +0000
+++ b/sql/item_timefunc.cc	2009-02-09 05:21:48 +0000
@@ -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)

Thread
bzr commit into mysql-5.0-bugteam branch (azundris:2739) Tatiana A. Nurnberg9 Feb