diff options
author | Davi Arnaut <Davi.Arnaut@Sun.COM> | 2009-11-19 21:48:08 -0200 |
---|---|---|
committer | Davi Arnaut <Davi.Arnaut@Sun.COM> | 2009-11-19 21:48:08 -0200 |
commit | 5aeeaaf507ac87f6ff56806fe8a356cea7d4a48f (patch) | |
tree | d21225ac09b301f317ca89093128769a5ede9fbb /sql/item_timefunc.cc | |
parent | 780871d8b90fe3146db39b4be65ebedb309b9f9b (diff) | |
parent | 5128b54c38ae183d18a29e00b318c22046445715 (diff) | |
download | mariadb-git-5aeeaaf507ac87f6ff56806fe8a356cea7d4a48f.tar.gz |
Manual merge of mysql-next-mr-runtime upstream.
Diffstat (limited to 'sql/item_timefunc.cc')
-rw-r--r-- | sql/item_timefunc.cc | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 84ddc88487d..3009c48cac7 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -865,6 +865,8 @@ static bool get_interval_info(const char *str,uint length,CHARSET_INFO *cs, { const char *end=str+length; uint i; + long msec_length= 0; + while (str != end && !my_isdigit(cs,*str)) str++; @@ -874,12 +876,7 @@ static bool get_interval_info(const char *str,uint length,CHARSET_INFO *cs, const char *start= str; for (value=0; str != end && my_isdigit(cs,*str) ; str++) value= value*LL(10) + (longlong) (*str - '0'); - if (transform_msec && i == count - 1) // microseconds always last - { - long msec_length= 6 - (uint) (str - start); - if (msec_length > 0) - value*= (long) log_10_int[msec_length]; - } + msec_length= 6 - (str - start); values[i]= value; while (str != end && !my_isdigit(cs,*str)) str++; @@ -893,6 +890,10 @@ static bool get_interval_info(const char *str,uint length,CHARSET_INFO *cs, break; } } + + if (transform_msec && msec_length > 0) + values[count - 1] *= (long) log_10_int[msec_length]; + return (str != end); } @@ -1854,7 +1855,7 @@ longlong Item_func_sec_to_time::val_int() sec_to_time(arg_val, args[0]->unsigned_flag, <ime); return (ltime.neg ? -1 : 1) * - ((ltime.hour)*10000 + ltime.minute*100 + ltime.second); + (longlong) ((ltime.hour)*10000 + ltime.minute*100 + ltime.second); } @@ -2666,7 +2667,8 @@ longlong Item_time_typecast::val_int() null_value= 1; return 0; } - return ltime.hour * 10000L + ltime.minute * 100 + ltime.second; + return (ltime.neg ? -1 : 1) * + (longlong) ((ltime.hour)*10000 + ltime.minute*100 + ltime.second); } String *Item_time_typecast::val_str(String *str) |