From 89a4a3e92c91a403740f1f2cdd057ab63afeef46 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 5 Oct 2006 15:29:00 +0500 Subject: Fix for bug #22029: str_to_date returning NULL, while date_format works using identical format. The problem appears when we have a space followed by a non-format symbol. Fix: properly skip spaces. mysql-test/r/date_formats.result: Fix for bug #22029: str_to_date returning NULL, while date_format works using identical format. - test result. mysql-test/t/date_formats.test: Fix for bug #22029: str_to_date returning NULL, while date_format works using identical format. - test case. sql/item_timefunc.cc: Fix for bug #22029: str_to_date returning NULL, while date_format works using identical format. - skipping pre-spaces between each argument moved. --- sql/item_timefunc.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sql/item_timefunc.cc') diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 2da0e8956c2..b2036999d88 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -171,15 +171,15 @@ 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; - /* Skip pre-space between each argument */ - while (val != val_end && my_isspace(cs, *val)) - val++; - val_len= (uint) (val_end - val); switch (*++ptr) { /* Year */ -- cgit v1.2.1