Commit 84738447 authored by unknown's avatar unknown
Browse files

Merge mysql.com:/usr/home/ram/work/bug22029/my41-bug22029

into  mysql.com:/usr/home/ram/work/bug22029/my50-bug22029


mysql-test/r/date_formats.result:
  Auto merged
mysql-test/t/date_formats.test:
  Auto merged
sql/item_timefunc.cc:
  merging
parents d3144a9d 89a4a3e9
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -569,4 +569,13 @@ DATE_FORMAT('%Y-%m-%d %H:%i:%s', 1151414896)
NULL
Warnings:
Warning	1292	Truncated incorrect datetime value: '%Y-%m-%d %H:%i:%s'
select str_to_date('04 /30/2004', '%m /%d/%Y');
str_to_date('04 /30/2004', '%m /%d/%Y')
2004-04-30
select str_to_date('04/30 /2004', '%m /%d /%Y');
str_to_date('04/30 /2004', '%m /%d /%Y')
2004-04-30
select str_to_date('04/30/2004 ', '%m/%d/%Y ');
str_to_date('04/30/2004 ', '%m/%d/%Y ')
2004-04-30
"End of 4.1 tests"
+8 −0
Original line number Diff line number Diff line
@@ -326,4 +326,12 @@ SELECT TIME_FORMAT("25:00:00", '%l %p');
#
SELECT DATE_FORMAT('%Y-%m-%d %H:%i:%s', 1151414896);

#
# Bug #22029: str_to_date returning NULL
#

select str_to_date('04 /30/2004', '%m /%d/%Y');
select str_to_date('04/30 /2004', '%m /%d /%Y');
select str_to_date('04/30/2004 ', '%m/%d/%Y ');

--echo "End of 4.1 tests"
+4 −3
Original line number Diff line number Diff line
@@ -171,15 +171,16 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,

  for (; ptr != end && val != val_end; ptr++)
  {
    /* Skip pre-space between each argument */
    while (val != val_end && my_isspace(cs, *val))
      val++;

    if (*ptr == '%' && ptr+1 != end)
    {
      int val_len;
      char *tmp;

      error= 0;
      /* Skip pre-space between each argument */
      while (val != val_end && my_isspace(cs, *val))
	val++;

      val_len= (uint) (val_end - val);
      switch (*++ptr) {