Commit 14a6cace authored by msvensson@neptunus.(none)'s avatar msvensson@neptunus.(none)

Merge neptunus.(none):/home/msvensson/mysql/tmp/tmp_merge

into  neptunus.(none):/home/msvensson/mysql/mysql-5.1
parents 41f1206b 96d4b9eb
...@@ -515,3 +515,39 @@ NULL ...@@ -515,3 +515,39 @@ NULL
select str_to_date( 1, IF(1=1,NULL,NULL) ); select str_to_date( 1, IF(1=1,NULL,NULL) );
str_to_date( 1, IF(1=1,NULL,NULL) ) str_to_date( 1, IF(1=1,NULL,NULL) )
NULL NULL
SELECT TIME_FORMAT("24:00:00", '%r');
TIME_FORMAT("24:00:00", '%r')
12:00:00 AM
SELECT TIME_FORMAT("00:00:00", '%r');
TIME_FORMAT("00:00:00", '%r')
12:00:00 AM
SELECT TIME_FORMAT("12:00:00", '%r');
TIME_FORMAT("12:00:00", '%r')
12:00:00 PM
SELECT TIME_FORMAT("15:00:00", '%r');
TIME_FORMAT("15:00:00", '%r')
03:00:00 PM
SELECT TIME_FORMAT("01:00:00", '%r');
TIME_FORMAT("01:00:00", '%r')
01:00:00 AM
SELECT TIME_FORMAT("25:00:00", '%r');
TIME_FORMAT("25:00:00", '%r')
01:00:00 AM
SELECT TIME_FORMAT("00:00:00", '%l %p');
TIME_FORMAT("00:00:00", '%l %p')
12 AM
SELECT TIME_FORMAT("01:00:00", '%l %p');
TIME_FORMAT("01:00:00", '%l %p')
1 AM
SELECT TIME_FORMAT("12:00:00", '%l %p');
TIME_FORMAT("12:00:00", '%l %p')
12 PM
SELECT TIME_FORMAT("23:00:00", '%l %p');
TIME_FORMAT("23:00:00", '%l %p')
11 PM
SELECT TIME_FORMAT("24:00:00", '%l %p');
TIME_FORMAT("24:00:00", '%l %p')
12 AM
SELECT TIME_FORMAT("25:00:00", '%l %p');
TIME_FORMAT("25:00:00", '%l %p')
1 AM
...@@ -280,3 +280,33 @@ select str_to_date( 1, NULL ); ...@@ -280,3 +280,33 @@ select str_to_date( 1, NULL );
select str_to_date( NULL, 1 ); select str_to_date( NULL, 1 );
select str_to_date( 1, IF(1=1,NULL,NULL) ); select str_to_date( 1, IF(1=1,NULL,NULL) );
# End of 4.1 tests # End of 4.1 tests
#
# Bug#11326
# TIME_FORMAT using "%r" returns wrong hour using 24:00:00 in TIME column
#
# This tests that 24:00:00 does not return PM, when it should be AM.
# Some other values are being tested same time.
#
SELECT TIME_FORMAT("24:00:00", '%r');
SELECT TIME_FORMAT("00:00:00", '%r');
SELECT TIME_FORMAT("12:00:00", '%r');
SELECT TIME_FORMAT("15:00:00", '%r');
SELECT TIME_FORMAT("01:00:00", '%r');
SELECT TIME_FORMAT("25:00:00", '%r');
#
# Bug#11324
# TIME_FORMAT using "%l:%i" returns 36:00 with 24:00:00 in TIME column
#
# This tests that 24:00:00 does not change to "36:00 AM". Testing
# some other values same time.
#
SELECT TIME_FORMAT("00:00:00", '%l %p');
SELECT TIME_FORMAT("01:00:00", '%l %p');
SELECT TIME_FORMAT("12:00:00", '%l %p');
SELECT TIME_FORMAT("23:00:00", '%l %p');
SELECT TIME_FORMAT("24:00:00", '%l %p');
SELECT TIME_FORMAT("25:00:00", '%l %p');
...@@ -631,7 +631,8 @@ bool make_date_time(DATE_TIME_FORMAT *format, TIME *l_time, ...@@ -631,7 +631,8 @@ bool make_date_time(DATE_TIME_FORMAT *format, TIME *l_time,
case 'r': case 'r':
length= my_sprintf(intbuff, length= my_sprintf(intbuff,
(intbuff, (intbuff,
(l_time->hour < 12) ? "%02d:%02d:%02d AM" : "%02d:%02d:%02d PM", ((l_time->hour % 24) < 12) ?
"%02d:%02d:%02d AM" : "%02d:%02d:%02d PM",
(l_time->hour+11)%12+1, (l_time->hour+11)%12+1,
l_time->minute, l_time->minute,
l_time->second)); l_time->second));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment