From a7088b3c82e0b8b144c14d438e6da37af4be4587 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 7 Aug 2006 07:35:28 +0200 Subject: 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: 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: 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: 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. --- sql/item_timefunc.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql/item_timefunc.cc') diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 44d9b422263..e3b71851824 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -223,7 +223,7 @@ static bool extract_date_time(DATE_TIME_FORMAT *format, 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 */ -- cgit v1.2.1