summaryrefslogtreecommitdiff
path: root/sql-common
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2005-08-04 12:49:23 -0700
committerunknown <jimw@mysql.com>2005-08-04 12:49:23 -0700
commit1f0c2ab3fc2431baf2cbbcf2d42a206226a07730 (patch)
treefc0ab4c64f0db1183511695134392ee58765eda9 /sql-common
parent2b41471429d9db41d64bfb214e29ba57cb3db381 (diff)
parent1beb95e3e43c7ae56a75e9206fa2b904480d0604 (diff)
downloadmariadb-git-1f0c2ab3fc2431baf2cbbcf2d42a206226a07730.tar.gz
Merge mysql.com:/home/jimw/my/mysql-4.1-clean
into mysql.com:/home/jimw/my/mysql-5.0-clean BitKeeper/deleted/.del-not_windows.inc: Delete: mysql-test/include/not_windows.inc mysql-test/r/type_datetime.result: Auto merged mysql-test/t/query_cache.test: Auto merged mysql-test/t/rpl_flush_tables.test: Auto merged sql-common/my_time.c: Auto merged mysql-test/r/query_cache.result: Resolve conflict
Diffstat (limited to 'sql-common')
-rw-r--r--sql-common/my_time.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sql-common/my_time.c b/sql-common/my_time.c
index ed02021011b..95ac779e0cd 100644
--- a/sql-common/my_time.c
+++ b/sql-common/my_time.c
@@ -207,7 +207,7 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
{
/* Found date in internal format (only numbers like YYYYMMDD) */
year_length= (digits == 4 || digits == 8 || digits >= 14) ? 4 : 2;
- field_length=year_length-1;
+ field_length= year_length;
is_internal_format= 1;
format_position= internal_format_positions;
}
@@ -237,6 +237,8 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
start_loop= 5; /* Start with first date part */
}
}
+
+ field_length= format_position[0] == 0 ? 4 : 2;
}
/*
@@ -261,7 +263,7 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
const char *start= str;
ulong tmp_value= (uint) (uchar) (*str++ - '0');
while (str != end && my_isdigit(&my_charset_latin1,str[0]) &&
- (!is_internal_format || field_length--))
+ --field_length)
{
tmp_value=tmp_value*10 + (ulong) (uchar) (*str - '0');
str++;
@@ -275,8 +277,8 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
date[i]=tmp_value;
not_zero_date|= tmp_value;
- /* Length-1 of next field */
- field_length= format_position[i+1] == 0 ? 3 : 1;
+ /* Length of next field */
+ field_length= format_position[i+1] == 0 ? 4 : 2;
if ((last_field_pos= str) == end)
{
@@ -294,7 +296,7 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
if (*str == '.') /* Followed by part seconds */
{
str++;
- field_length= 5; /* 5 digits after first (=6) */
+ field_length= 6; /* 6 digits */
}
continue;