List:Internals« Previous MessageNext Message »
From:Jim Winstead Date:May 27 2005 11:41pm
Subject:bk commit into 5.0 tree (jimw:1.1839) BUG#10590
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of jimw. When jimw does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1839 05/05/27 16:41:53 jimw@stripped +3 -0
  Fix '%h', '%I', and '%k' format specifiers in TIME_FORMAT()
  to handle large time values as documented. (Bug #10590)

  sql/item_timefunc.cc
    1.82 05/05/16 18:32:18 jimw@stripped +2 -5
    Fix handling of '%h', '%I', and '%k' format specifiers
    for TIME_FORMAT() to handle large time values correctly.

  mysql-test/t/func_time.test
    1.32 05/05/16 18:32:18 jimw@stripped +6 -0
    Add new regression test

  mysql-test/r/func_time.result
    1.39 05/05/16 18:32:18 jimw@stripped +3 -0
    Add new results

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	jimw
# Host:	rama.(none)
# Root:	/home/jimw/my/mysql-5.0-10590

--- 1.81/sql/item_timefunc.cc	2005-04-25 00:35:20 -07:00
+++ 1.82/sql/item_timefunc.cc	2005-05-16 18:32:18 -07:00
@@ -497,7 +497,6 @@
 		    timestamp_type type, String *str)
 {
   char intbuff[15];
-  uint days_i;
   uint hours_i;
   uint weekday;
   ulong length;
@@ -600,8 +599,7 @@
 	break;
       case 'h':
       case 'I':
-	days_i= l_time->hour/24;
-	hours_i= (l_time->hour%24 + 11)%12+1 + 24*days_i;
+	hours_i= (l_time->hour%24 + 11)%12+1;
 	length= int10_to_str(hours_i, intbuff, 10) - intbuff;
 	str->append_with_prefill(intbuff, length, 2, '0');
 	break;
@@ -622,8 +620,7 @@
 	str->append_with_prefill(intbuff, length, 1, '0');
 	break;
       case 'l':
-	days_i= l_time->hour/24;
-	hours_i= (l_time->hour%24 + 11)%12+1 + 24*days_i;
+	hours_i= (l_time->hour%24 + 11)%12+1;
 	length= int10_to_str(hours_i, intbuff, 10) - intbuff;
 	str->append_with_prefill(intbuff, length, 1, '0');
 	break;

--- 1.38/mysql-test/r/func_time.result	2005-04-04 06:43:19 -07:00
+++ 1.39/mysql-test/r/func_time.result	2005-05-16 18:32:18 -07:00
@@ -688,3 +688,6 @@
 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
 Warnings:
 Note	1003	select timestamp_diff(WEEK,_latin1'2001-02-01',_latin1'2001-05-01') AS `a1`,timestamp_diff(SECOND_FRAC,_latin1'2001-02-01 12:59:59.120000',_latin1'2001-05-01 12:58:58.119999') AS `a2`
+select time_format('100:00:00', '%H %k %h %I %l');
+time_format('100:00:00', '%H %k %h %I %l')
+100 100 04 04 4

--- 1.31/mysql-test/t/func_time.test	2005-01-04 03:46:42 -08:00
+++ 1.32/mysql-test/t/func_time.test	2005-05-16 18:32:18 -07:00
@@ -336,3 +336,9 @@
 
 explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1,
 			timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a2;
+
+#
+# Bug #10590: %h, %I, and %l format specifies should all return results in
+# the 0-11 range
+#
+select time_format('100:00:00', '%H %k %h %I %l');
Thread
bk commit into 5.0 tree (jimw:1.1839) BUG#10590Jim Winstead28 May