diff options
author | Ignacio Galarza <iggy@mysql.com> | 2009-03-17 16:29:24 -0400 |
---|---|---|
committer | Ignacio Galarza <iggy@mysql.com> | 2009-03-17 16:29:24 -0400 |
commit | 428e28e00c679ca6f3a997e0303604d881e361c3 (patch) | |
tree | 3c313f70fd16653491985d8e8108fb5b99f0d5d0 /sql-common | |
parent | 2d9421c3bb7376bcfa5484d94b45df65d67e4468 (diff) | |
parent | ec39e58d13f95e455a6553bca3e618e7065707d0 (diff) | |
download | mariadb-git-428e28e00c679ca6f3a997e0303604d881e361c3.tar.gz |
auto-merge
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++; |