summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.cc
diff options
context:
space:
mode:
authorunknown <ramil/ram@mysql.com/myoffice.izhnet.ru>2006-10-05 15:29:00 +0500
committerunknown <ramil/ram@mysql.com/myoffice.izhnet.ru>2006-10-05 15:29:00 +0500
commit89a4a3e92c91a403740f1f2cdd057ab63afeef46 (patch)
tree01e23ee67e9e0f6fe3075028754bdbbcdda3aebe /sql/item_timefunc.cc
parent78f47b1b1080833241860c6213854fe04487ff12 (diff)
downloadmariadb-git-89a4a3e92c91a403740f1f2cdd057ab63afeef46.tar.gz
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.
Diffstat (limited to 'sql/item_timefunc.cc')
-rw-r--r--sql/item_timefunc.cc8
1 files changed, 4 insertions, 4 deletions
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 */