summaryrefslogtreecommitdiff
path: root/sql/field.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-02-15 10:22:03 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2018-02-15 10:22:03 +0200
commitb006d2ead4640f0ab4e29687fd7d24988b1c98f1 (patch)
treea478984bcd7f4bb2e0fd0496eae77b871077a380 /sql/field.cc
parentb782971c58b5656820429b8ef3fae5fd82f5a0f7 (diff)
parentdc09f8f29cb2b9fdce7d5d5a623fdc8dcf1814f9 (diff)
downloadmariadb-git-b006d2ead4640f0ab4e29687fd7d24988b1c98f1.tar.gz
Merge bb-10.2-ext into 10.3
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 19bca942082..7c88f230734 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -2190,7 +2190,7 @@ uint Field::fill_cache_field(CACHE_FIELD *copy)
{
uint store_length;
copy->str= ptr;
- copy->length= pack_length();
+ copy->length= pack_length_in_rec();
copy->field= this;
if (flags & BLOB_FLAG)
{
@@ -5828,6 +5828,13 @@ static void calc_datetime_days_diff(MYSQL_TIME *ltime, long days)
ltime->second) * 1000000LL +
ltime->second_part);
unpack_time(timediff, ltime);
+ /*
+ unpack_time() broke down hours into ltime members hour,day,month.
+ Mix them back to ltime->hour using the same factors
+ that pack_time()/unpack_time() use (i.e. 32 for month).
+ */
+ ltime->hour+= (ltime->month * 32 + ltime->day) * 24;
+ ltime->month= ltime->day= 0;
}
ltime->time_type= MYSQL_TIMESTAMP_TIME;
}
@@ -9759,7 +9766,7 @@ int Field_bit::key_cmp(const uchar *str, uint length)
str++;
length--;
}
- return memcmp(ptr, str, length);
+ return memcmp(ptr, str, bytes_in_rec);
}