Below is the list of changes that have just been committed into a local
5.0 repository of tnurnberg. When tnurnberg 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@stripped, 2007-11-16 11:38:11+01:00, tnurnberg@stripped +3 -0
Bug #32180: DATE_ADD treats datetime numeric argument as DATE instead of DATETIME
This is a regression from 2007-05-18 when code to zero out the returned struct was
added to number_to_datetime(); zero for time_type corresponds to MYSQL_TIMESTAMP_DATE.
We now explicitly set the type we return (MYSQL_TIMESTAMP_DATETIME).
mysql-test/r/func_time.result@stripped, 2007-11-16 11:38:10+01:00, tnurnberg@stripped +6 -0
show that DATE_ADD() behaves the same for YYYYMMDDhhmmss given
as string and as integer.
mysql-test/t/func_time.test@stripped, 2007-11-16 11:38:10+01:00, tnurnberg@stripped +8 -0
show that DATE_ADD() behaves the same for YYYYMMDDhhmmss given
as string and as integer.
sql-common/my_time.c@stripped, 2007-11-16 11:38:10+01:00, tnurnberg@stripped +7 -6
explictly set return type in number_to_datetime()
diff -Nrup a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
--- a/mysql-test/r/func_time.result 2007-10-09 14:58:07 +02:00
+++ b/mysql-test/r/func_time.result 2007-11-16 11:38:10 +01:00
@@ -1270,4 +1270,10 @@ select concat(a,ifnull(min(date_format(n
ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and
(latin1_swedish_ci,COERCIBLE) for operation 'concat'
set lc_time_names=en_US;
drop table t1;
+select DATE_ADD('20071108181000', INTERVAL 1 DAY);
+DATE_ADD('20071108181000', INTERVAL 1 DAY)
+2007-11-09 18:10:00
+select DATE_ADD(20071108181000, INTERVAL 1 DAY);
+DATE_ADD(20071108181000, INTERVAL 1 DAY)
+2007-11-09 18:10:00
End of 5.0 tests
diff -Nrup a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
--- a/mysql-test/t/func_time.test 2007-10-09 14:58:07 +02:00
+++ b/mysql-test/t/func_time.test 2007-11-16 11:38:10 +01:00
@@ -787,4 +787,12 @@ select concat(a,ifnull(min(date_format(n
set lc_time_names=en_US;
drop table t1;
+#
+# Bug#32180: DATE_ADD treats datetime numeric argument as DATE
+# instead of DATETIME
+#
+
+select DATE_ADD('20071108181000', INTERVAL 1 DAY);
+select DATE_ADD(20071108181000, INTERVAL 1 DAY);
+
--echo End of 5.0 tests
diff -Nrup a/sql-common/my_time.c b/sql-common/my_time.c
--- a/sql-common/my_time.c 2007-05-18 06:13:24 +02:00
+++ b/sql-common/my_time.c 2007-11-16 11:38:10 +01:00
@@ -1153,12 +1153,13 @@ longlong number_to_datetime(longlong nr,
part1=(long) (nr/LL(1000000));
part2=(long) (nr - (longlong) part1*LL(1000000));
bzero((char*) time_res, sizeof(*time_res));
- time_res->year= (int) (part1/10000L); part1%=10000L;
- time_res->month= (int) part1 / 100;
- time_res->day= (int) part1 % 100;
- time_res->hour= (int) (part2/10000L); part2%=10000L;
- time_res->minute=(int) part2 / 100;
- time_res->second=(int) part2 % 100;
+ time_res->year= (int) (part1/10000L); part1%=10000L;
+ time_res->month= (int) part1 / 100;
+ time_res->day= (int) part1 % 100;
+ time_res->hour= (int) (part2/10000L); part2%=10000L;
+ time_res->minute= (int) part2 / 100;
+ time_res->second= (int) part2 % 100;
+ time_res->time_type=MYSQL_TIMESTAMP_DATETIME;
if (time_res->year <= 9999 && time_res->month <= 12 &&
time_res->day <= 31 && time_res->hour <= 23 &&
| Thread |
|---|
| • bk commit into 5.0 tree (tnurnberg:1.2549) BUG#32180 | Tatjana A Nuernberg | 16 Nov |