diff options
author | Guilhem Bichot <guilhem@mysql.com> | 2009-04-01 11:34:52 +0200 |
---|---|---|
committer | Guilhem Bichot <guilhem@mysql.com> | 2009-04-01 11:34:52 +0200 |
commit | c71aae73f6f864c97cf17b3e872346666b871c3f (patch) | |
tree | 4895816aee1a0fcef08daa0f68bf1b1fe9aa2b5a /sql-common | |
parent | 3c59ba32ab9cca29e01bd8dd2130af83ead8bde0 (diff) | |
parent | 7ca1ebd83a1a7d291593be7a94f5a37298dfc863 (diff) | |
download | mariadb-git-c71aae73f6f864c97cf17b3e872346666b871c3f.tar.gz |
merge of 5.1-main into 5.1-maria. MyISAM changes are propagated to Maria except
those of davi.arnaut@sun.com-20090219210935-9vilvcisyyieffxl (TODO).
Diffstat (limited to 'sql-common')
-rw-r--r-- | sql-common/my_time.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sql-common/my_time.c b/sql-common/my_time.c index 155e0237e3c..747c5797ed4 100644 --- a/sql-common/my_time.c +++ b/sql-common/my_time.c @@ -264,8 +264,19 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time, { const char *start= str; ulong tmp_value= (uint) (uchar) (*str++ - '0'); + + /* + Internal format means no delimiters; every field has a fixed + width. Otherwise, we scan until we find a delimiter and discard + leading zeroes -- except for the microsecond part, where leading + zeroes are significant, and where we never process more than six + digits. + */ + my_bool scan_until_delim= !is_internal_format && + ((i != format_position[6])); + while (str != end && my_isdigit(&my_charset_latin1,str[0]) && - (!is_internal_format || --field_length)) + (scan_until_delim || --field_length)) { tmp_value=tmp_value*10 + (ulong) (uchar) (*str - '0'); str++; |