diff options
author | unknown <jan@hundin.mysql.fi> | 2004-09-03 15:26:29 +0300 |
---|---|---|
committer | unknown <jan@hundin.mysql.fi> | 2004-09-03 15:26:29 +0300 |
commit | bbd402dc4f45947ff282775eea7b921c66667058 (patch) | |
tree | bb1dba9818e4bb46971804c5f7b810602a9a6d25 /innobase/row/row0ins.c | |
parent | 3e3981b558befa08a3278f86e5fd0a12417abba1 (diff) | |
download | mariadb-git-bbd402dc4f45947ff282775eea7b921c66667058.tar.gz |
Fixed unique prefix key bug for multibyte character sets (BUG #4521) for
InnoDB. This fixes also a second part of the same problem with prefix keys
on a multibyte string column for InnoDB.
innobase/btr/btr0btr.c:
Multibyte character set prefix indexes are not any more fixed size. Therefore,
we have to chect that length of the index field in not greater than
prefix length.
innobase/rem/rem0cmp.c:
Remove unnecessary changes.
innobase/row/row0ins.c:
Fixed unique prefix key or prefix key using multibyte character set bugs for
InnoDB (BUG #4521). For prefix keys we have to get the storage length
for the prefix length of characters in the key.
innobase/row/row0row.c:
Fixed unique prefix key or prefix key using multibyte character set bugs for
InnoDB (BUG #4521). For prefix keys we have to get the storage length
for the prefix length of characters in the key.
innobase/row/row0sel.c:
Fixed unique prefix key or prefix key using multibyte character set bugs for
InnoDB (BUG #4521). For prefix keys we have to get the storage length
for the prefix length of characters in the key.
innobase/row/row0upd.c:
Fixed unique prefix key or prefix key using multibyte character set bugs for
InnoDB (BUG #4521). For prefix keys we have to get the storage length
for the prefix length of characters in the key.
mysql-test/r/ctype_utf8.result:
Added utf8 character test cases for InnoDB.
mysql-test/t/ctype_utf8.test:
Added utf8 character expected test results for InnoDB.
sql/ha_innodb.cc:
Added function innobase_get_at_most_n_mbchars to return position of
the nth character in the multibyte character string.
sql/ha_innodb.h:
Remove unnecessary changes.
Diffstat (limited to 'innobase/row/row0ins.c')
-rw-r--r-- | innobase/row/row0ins.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/innobase/row/row0ins.c b/innobase/row/row0ins.c index edd3099b5f3..2429b8f2bf3 100644 --- a/innobase/row/row0ins.c +++ b/innobase/row/row0ins.c @@ -1999,6 +1999,7 @@ row_ins_index_entry_set_vals( dfield_t* row_field; ulint n_fields; ulint i; + dtype_t* cur_type; ut_ad(entry && row); @@ -2012,10 +2013,18 @@ row_ins_index_entry_set_vals( /* Check column prefix indexes */ if (ind_field->prefix_len > 0 - && dfield_get_len(row_field) != UNIV_SQL_NULL - && dfield_get_len(row_field) > ind_field->prefix_len) { - - field->len = ind_field->prefix_len; + && dfield_get_len(row_field) != UNIV_SQL_NULL) { + + /* For prefix keys get the storage length + for the prefix_len characters. */ + + cur_type = dict_col_get_type( + dict_field_get_col(ind_field)); + + field->len = innobase_get_at_most_n_mbchars( + dtype_get_charset_coll(cur_type->prtype), + ind_field->prefix_len, + dfield_get_len(field),row_field->data); } else { field->len = row_field->len; } |