summaryrefslogtreecommitdiff
path: root/sql-common/my_time.c
diff options
context:
space:
mode:
authorunknown <aivanov@mysql.com>2005-12-15 18:59:40 +0300
committerunknown <aivanov@mysql.com>2005-12-15 18:59:40 +0300
commit4db14a57e758bbc8662cddd5a85edbf30f16d634 (patch)
tree76aaa9b0c93271d0dad0165fa08b22b0f1720249 /sql-common/my_time.c
parent4e971ef7a6ee5de5a2a709a5eb316717e8473219 (diff)
parent52c044008508b1b445b21d780a238c9cb0b8c891 (diff)
downloadmariadb-git-4db14a57e758bbc8662cddd5a85edbf30f16d634.tar.gz
Merge mysql.com:/home/alexi/dev/mysql-4.1-12440
into mysql.com:/home/alexi/dev/mysql-5.0-12440 mysql-test/r/type_time.result: Auto merged ndb/src/ndbapi/NdbImpl.hpp: Auto merged ndb/src/ndbapi/NdbRecAttr.cpp: Auto merged ndb/src/ndbapi/ndb_cluster_connection.cpp: Auto merged sql-common/my_time.c: Auto merged zlib/Makefile.am: Auto merged
Diffstat (limited to 'sql-common/my_time.c')
-rw-r--r--sql-common/my_time.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/sql-common/my_time.c b/sql-common/my_time.c
index 72809ee9b4b..c9d39260761 100644
--- a/sql-common/my_time.c
+++ b/sql-common/my_time.c
@@ -575,18 +575,34 @@ fractional:
/* Get fractional second part */
if ((end-str) >= 2 && *str == '.' && my_isdigit(&my_charset_latin1,str[1]))
{
- uint field_length=5;
+ int field_length= 5;
str++; value=(uint) (uchar) (*str - '0');
- while (++str != end &&
- my_isdigit(&my_charset_latin1,str[0]) &&
- field_length--)
- value=value*10 + (uint) (uchar) (*str - '0');
- if (field_length)
+ while (++str != end && my_isdigit(&my_charset_latin1, *str))
+ {
+ if (field_length-- > 0)
+ value= value*10 + (uint) (uchar) (*str - '0');
+ }
+ if (field_length > 0)
value*= (long) log_10_int[field_length];
+ else if (field_length < 0)
+ *was_cut= 1;
date[4]=value;
}
else
date[4]=0;
+
+ /* Check for exponent part: E<gigit> | E<sign><digit> */
+ /* (may occur as result of %g formatting of time value) */
+ if ((end - str) > 1 &&
+ (*str == 'e' || *str == 'E') &&
+ (my_isdigit(&my_charset_latin1, str[1]) ||
+ ((str[1] == '-' || str[1] == '+') &&
+ (end - str) > 2 &&
+ my_isdigit(&my_charset_latin1, str[2]))))
+ {
+ *was_cut= 1;
+ return 1;
+ }
if (internal_format_positions[7] != 255)
{