diff options
author | unknown <konstantin@mysql.com> | 2006-01-19 14:01:20 +0300 |
---|---|---|
committer | unknown <konstantin@mysql.com> | 2006-01-19 14:01:20 +0300 |
commit | c87bfd13ac7fbf4f3312e0e51a520f71b52d74b2 (patch) | |
tree | 68f47a7192f53a37a9423a494265c71ad23807e4 /sql/protocol.cc | |
parent | 48ac5c4a2b241d8fcc8f7266b4192664855e0ee6 (diff) | |
parent | 1e8e302effdb998223c65ebfe8dbea2d01a8385c (diff) | |
download | mariadb-git-c87bfd13ac7fbf4f3312e0e51a520f71b52d74b2.tar.gz |
Merge mysql.com:/opt/local/work/mysql-4.1-15613
into mysql.com:/opt/local/work/mysql-5.0-root
sql/protocol.cc:
Auto merged
tests/mysql_client_test.c:
Manual merge.
Diffstat (limited to 'sql/protocol.cc')
-rw-r--r-- | sql/protocol.cc | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/sql/protocol.cc b/sql/protocol.cc index 0a1b42f5236..15f7049ec2f 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -597,9 +597,23 @@ bool Protocol::send_fields(List<Item> *list, uint flags) else { /* With conversion */ + uint max_char_len; int2store(pos, thd_charset->number); - uint char_len= field.length / item->collation.collation->mbmaxlen; - int4store(pos+2, char_len * thd_charset->mbmaxlen); + /* + For TEXT/BLOB columns, field_length describes the maximum data + length in bytes. There is no limit to the number of characters + that a TEXT column can store, as long as the data fits into + the designated space. + For the rest of textual columns, field_length is evaluated as + char_count * mbmaxlen, where character count is taken from the + definition of the column. In other words, the maximum number + of characters here is limited by the column definition. + */ + max_char_len= (field.type >= (int) MYSQL_TYPE_TINY_BLOB && + field.type <= (int) MYSQL_TYPE_BLOB) ? + field.length / item->collation.collation->mbminlen : + field.length / item->collation.collation->mbmaxlen; + int4store(pos+2, max_char_len * thd_charset->mbmaxlen); } pos[6]= field.type; int2store(pos+7,field.flags); |