summaryrefslogtreecommitdiff
path: root/sql/field.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2011-05-19 19:01:46 +0200
committerSergei Golubchik <sergii@pisem.net>2011-05-19 19:01:46 +0200
commit8ddcd0cda8e6e90a58e9ea64f0f3773ea0037f0b (patch)
tree4765748aeb7aafb09e259e1a355e28c11819e9c0 /sql/field.cc
parent5346cb8d2745acd660b301092458e231c9f53319 (diff)
downloadmariadb-git-8ddcd0cda8e6e90a58e9ea64f0f3773ea0037f0b.tar.gz
post-review changes 1
include/my_time.h: remove duplicate defines. cast to ulonglong to avoid overflow sql/field.cc: perform sign extension when reading packed TIME values sql/item_cmpfunc.cc: when converting a string to a date for the purpose of comparing it with another date, we should ignore strict sql mode. sql/item_timefunc.cc: better error message sql/item_timefunc.h: limit decimals appropriately sql/share/errmsg.txt: don't refer to an object as a "column" in error messages that are used not only for columns.
Diffstat (limited to 'sql/field.cc')
-rw-r--r--sql/field.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/sql/field.cc b/sql/field.cc
index 914376b91e0..731aaea4659 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -5056,7 +5056,7 @@ static uint sec_part_bytes[MAX_DATETIME_PRECISION+1]= { 0, 1, 1, 2, 2, 3, 3 };
static uint datetime_hires_bytes[MAX_DATETIME_PRECISION+1]=
{ 5, 6, 6, 7, 7, 7, 8 };
static uint time_hires_bytes[MAX_DATETIME_PRECISION+1]=
-{ 3, 4, 4, 4, 5, 5, 6 };
+{ 3, 4, 4, 5, 5, 5, 6 };
void Field_timestamp_hires::store_TIME(my_time_t timestamp, ulong sec_part)
{
@@ -5520,7 +5520,14 @@ String *Field_time_hires::val_str(String *str,
bool Field_time_hires::get_date(MYSQL_TIME *ltime, uint fuzzydate)
{
- ulonglong packed= read_bigendian(ptr, Field_time_hires::pack_length());
+ uint32 len= pack_length();
+ longlong packed= read_bigendian(ptr, len);
+
+ /* sign extension */
+ longlong mask= 1LL << (len*8 - 1);
+ if (packed & mask)
+ packed|= ~(mask-1);
+
unpack_time(sec_part_unshift(packed, dec), ltime);
/*
unpack_time() returns MYSQL_TIMESTAMP_DATETIME.