diff options
author | Alexander Barkov <bar@mysql.com> | 2010-06-02 16:23:50 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mysql.com> | 2010-06-02 16:23:50 +0400 |
commit | 56c3b98065b78b08b525e97c32589dfd5020165d (patch) | |
tree | f491a7947edaa201f68c7b3d9485a598a4b66c4e /sql/protocol.cc | |
parent | 2400a20c9b6efb909180e8386368da7acc128f84 (diff) | |
download | mariadb-git-56c3b98065b78b08b525e97c32589dfd5020165d.tar.gz |
Bug#52520 Difference in tinytext utf column metadata
Problems:
- regression (compating to version 5.1) in metadata for BLOB types
- inconsistency between length metadata in server and embedded for BLOB types
- wrong max_length calculation in items derived from BLOB columns
@ libmysqld/lib_sql.cc
Calculating length metadata in embedded similary to server version,
using new function char_to_byte_length_safe().
@ mysql-test/r/ctype_utf16.result
Adding tests
@ mysql-test/r/ctype_utf32.result
Adding tests
@ mysql-test/r/ctype_utf8.result
Adding tests
@ mysql-test/r/ctype_utf8mb4.result
Adding tests
@ mysql-test/t/ctype_utf16.test
Adding tests
@ mysql-test/t/ctype_utf32.test
Adding tests
@ mysql-test/t/ctype_utf8.test
Adding tests
@ mysql-test/t/ctype_utf8mb4.test
Adding tests
@ sql/field.cc
Overriding char_length() for Field_blob:
unlike in generic Item::char_length() we don't
divide to mbmaxlen for BLOBs.
@ sql/field.h
- Making Field::char_length() virtual
- Adding prototype for Field_blob::char_length()
@ sql/item.h
- Adding new helper function char_to_byte_length_safe()
- Using new function
@ sql/protocol.cc
Using new function char_to_byte_length_safe().
modified:
libmysqld/lib_sql.cc
mysql-test/r/ctype_utf16.result
mysql-test/r/ctype_utf32.result
mysql-test/r/ctype_utf8.result
mysql-test/r/ctype_utf8mb4.result
mysql-test/t/ctype_utf16.test
mysql-test/t/ctype_utf32.test
mysql-test/t/ctype_utf8.test
mysql-test/t/ctype_utf8mb4.test
sql/field.cc
sql/field.h
sql/item.h
sql/protocol.cc
Diffstat (limited to 'sql/protocol.cc')
-rw-r--r-- | sql/protocol.cc | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/sql/protocol.cc b/sql/protocol.cc index eeb248012ab..ac78ac88ec6 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -747,8 +747,7 @@ bool Protocol::send_result_set_metadata(List<Item> *list, uint flags) else { /* With conversion */ - ulonglong max_length; - uint32 field_length; + uint32 field_length, max_length; int2store(pos, thd_charset->number); /* For TEXT/BLOB columns, field_length describes the maximum data @@ -771,9 +770,8 @@ bool Protocol::send_result_set_metadata(List<Item> *list, uint flags) field.type <= MYSQL_TYPE_BLOB) ? field.length / item->collation.collation->mbminlen : field.length / item->collation.collation->mbmaxlen; - max_length*= thd_charset->mbmaxlen; - field_length= (max_length > UINT_MAX32) ? - UINT_MAX32 : (uint32) max_length; + field_length= char_to_byte_length_safe(max_length, + thd_charset->mbmaxlen); int4store(pos + 2, field_length); } pos[6]= field.type; |