List:Commits« Previous MessageNext Message »
From:Tatjana A Nuernberg Date:August 7 2006 5:35am
Subject:bk commit into 4.1 tree (tnurnberg:1.2537) BUG#20987
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 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, 2006-08-07 07:35:28+02:00, tnurnberg@stripped +3 -0
  Bug #20987: str_to_date doesn't accept user variable for specification
  
  str_to_date() would sometimes render NULL if %D was used as rule other than last.
  since this was due to two pointers getting mixed up in the server, this behaviour
  seemed somewhat non-deterministic at SQL level.

  mysql-test/r/func_time.result@stripped, 2006-08-07 07:35:19+02:00, tnurnberg@stripped +34 -0
    Bug #20987: str_to_date doesn't accept user variable for specification
    
    show we can do the usual str_to_date() conversions without triggering the bug.

  mysql-test/t/func_time.test@stripped, 2006-08-07 07:35:19+02:00, tnurnberg@stripped +31 -1
    Bug #20987: str_to_date doesn't accept user variable for specification
    
    show we can do the usual str_to_date() conversions without triggering the bug.

  sql/item_timefunc.cc@stripped, 2006-08-07 07:35:19+02:00, tnurnberg@stripped +1 -1
    Bug #20987: str_to_date doesn't accept user variable for specification
    
    str_to_date() used a wrong pointer in %D conversions which could lead to the
    input being cut off after the token matching %D; if the rule required further
    tokens, the conversion would fail and render NULL.

# 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:	tnurnberg
# Host:	salvation.intern.azundris.com
# Root:	/home/tnurnberg/work/mysql-4.1-maint-20987

--- 1.105/sql/item_timefunc.cc	2006-08-07 07:35:39 +02:00
+++ 1.106/sql/item_timefunc.cc	2006-08-07 07:35:39 +02:00
@@ -223,7 +223,7 @@ static bool extract_date_time(DATE_TIME_
 	tmp= (char*) val + min(2, val_len);
 	l_time->day= (int) my_strtoll10(val, &tmp, &error);
 	/* Skip 'st, 'nd, 'th .. */
-	val= tmp + min((int) (end-tmp), 2);
+	val= tmp + min((int) (val_end-tmp), 2);
 	break;
 
 	/* Hour */

--- 1.40/mysql-test/r/func_time.result	2006-08-07 07:35:39 +02:00
+++ 1.41/mysql-test/r/func_time.result	2006-08-07 07:35:39 +02:00
@@ -695,3 +695,37 @@ t1	CREATE TABLE `t1` (
   `from_unixtime(1) + 0` double(23,6) default NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1;
+SET @df:="%M %D, %Y";
+SELECT DATE_FORMAT('2005-10-31', "%M %D, %Y");
+DATE_FORMAT('2005-10-31', "%M %D, %Y")
+October 31st, 2005
+SELECT DATE_FORMAT('2005-10-31', @df);
+DATE_FORMAT('2005-10-31', @df)
+October 31st, 2005
+SELECT STR_TO_DATE('October 31st, 2005', "%M %D, %Y");
+STR_TO_DATE('October 31st, 2005', "%M %D, %Y")
+2005-10-31
+SELECT STR_TO_DATE('October 31st, 2005', @df);
+STR_TO_DATE('October 31st, 2005', @df)
+2005-10-31
+CREATE TABLE `dt` (
+d datetime,
+ds char(30)
+);
+INSERT INTO `dt` (d) VALUES ('2005-10-31'), ('2005-11-30');
+SET @df:="%M %D, %Y";
+UPDATE dt SET ds = DATE_FORMAT(d, @df);
+SELECT * FROM dt;
+d	ds
+2005-10-31 00:00:00	October 31st, 2005
+2005-11-30 00:00:00	November 30th, 2005
+SELECT d, ds, STR_TO_DATE(ds, @df) FROM dt;
+d	ds	STR_TO_DATE(ds, @df)
+2005-10-31 00:00:00	October 31st, 2005	2005-10-31
+2005-11-30 00:00:00	November 30th, 2005	2005-11-30
+SELECT d, ds, STR_TO_DATE(ds, "%M %D, %Y") FROM dt;
+d	ds	STR_TO_DATE(ds, "%M %D, %Y")
+2005-10-31 00:00:00	October 31st, 2005	2005-10-31
+2005-11-30 00:00:00	November 30th, 2005	2005-11-30
+DROP TABLE `dt`;
+End of 4.1 tests

--- 1.35/mysql-test/t/func_time.test	2006-08-07 07:35:39 +02:00
+++ 1.36/mysql-test/t/func_time.test	2006-08-07 07:35:39 +02:00
@@ -368,4 +368,34 @@ create table t1 select now() - now(), cu
 show create table t1;
 drop table t1;
 
-# End of 4.1 tests
+
+
+#
+# Bug #20987: str_to_date doesn't accept user variable for specification
+#
+
+SET @df:="%M %D, %Y";
+SELECT DATE_FORMAT('2005-10-31', "%M %D, %Y"); 
+SELECT DATE_FORMAT('2005-10-31', @df); 
+SELECT STR_TO_DATE('October 31st, 2005', "%M %D, %Y");
+SELECT STR_TO_DATE('October 31st, 2005', @df);
+
+CREATE TABLE `dt` (
+  d datetime,
+  ds char(30)
+);
+
+INSERT INTO `dt` (d) VALUES ('2005-10-31'), ('2005-11-30');
+SET @df:="%M %D, %Y";
+
+UPDATE dt SET ds = DATE_FORMAT(d, @df);
+
+SELECT * FROM dt;
+SELECT d, ds, STR_TO_DATE(ds, @df) FROM dt;
+SELECT d, ds, STR_TO_DATE(ds, "%M %D, %Y") FROM dt;
+
+DROP TABLE `dt`;
+
+
+
+--echo End of 4.1 tests
Thread
bk commit into 4.1 tree (tnurnberg:1.2537) BUG#20987Tatjana A Nuernberg7 Aug