summaryrefslogtreecommitdiff
path: root/storage/innobase/handler/ha_innodb.cc
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/handler/ha_innodb.cc')
-rw-r--r--storage/innobase/handler/ha_innodb.cc30
1 files changed, 15 insertions, 15 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index f3d9bcd8d59..7cead57be62 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -1036,6 +1036,8 @@ innobase_get_cset_width(
if (cs) {
*mbminlen = cs->mbminlen;
*mbmaxlen = cs->mbmaxlen;
+ ut_ad(*mbminlen < DATA_MBMAX);
+ ut_ad(*mbmaxlen < DATA_MBMAX);
} else {
THD* thd = current_thd;
@@ -4433,15 +4435,14 @@ ha_innobase::store_key_val_for_row(
memcpy(buff, src_start, true_len);
buff += true_len;
- /* Pad the unused space with spaces. Note that no
- padding is ever needed for UCS-2 because in MySQL,
- all UCS2 characters are 2 bytes, as MySQL does not
- support surrogate pairs, which are needed to represent
- characters in the range U+10000 to U+10FFFF. */
+ /* Pad the unused space with spaces. */
if (true_len < key_len) {
- ulint pad_len = key_len - true_len;
- memset(buff, ' ', pad_len);
+ ulint pad_len = key_len - true_len;
+ ut_a(!(pad_len % cs->mbminlen));
+
+ cs->cset->fill(cs, buff, pad_len,
+ 0x20 /* space */);
buff += pad_len;
}
}
@@ -4550,6 +4551,7 @@ build_template(
/* Note that in InnoDB, i is the column number. MySQL calls columns
'fields'. */
for (i = 0; i < n_fields; i++) {
+ const dict_col_t* col = &index->table->cols[i];
templ = prebuilt->mysql_template + n_requested_fields;
field = table->field[i];
@@ -4598,7 +4600,7 @@ include_field:
if (index == clust_index) {
templ->rec_field_no = dict_col_get_clust_pos(
- &index->table->cols[i], index);
+ col, index);
} else {
templ->rec_field_no = dict_index_get_nth_col_pos(
index, i);
@@ -4627,7 +4629,7 @@ include_field:
mysql_prefix_len = templ->mysql_col_offset
+ templ->mysql_col_len;
}
- templ->type = index->table->cols[i].mtype;
+ templ->type = col->mtype;
templ->mysql_type = (ulint)field->type();
if (templ->mysql_type == DATA_MYSQL_TRUE_VARCHAR) {
@@ -4635,12 +4637,10 @@ include_field:
(((Field_varstring*)field)->length_bytes);
}
- templ->charset = dtype_get_charset_coll(
- index->table->cols[i].prtype);
- templ->mbminlen = index->table->cols[i].mbminlen;
- templ->mbmaxlen = index->table->cols[i].mbmaxlen;
- templ->is_unsigned = index->table->cols[i].prtype
- & DATA_UNSIGNED;
+ templ->charset = dtype_get_charset_coll(col->prtype);
+ templ->mbminlen = dict_col_get_mbminlen(col);
+ templ->mbmaxlen = dict_col_get_mbmaxlen(col);
+ templ->is_unsigned = col->prtype & DATA_UNSIGNED;
if (templ->type == DATA_BLOB) {
prebuilt->templ_contains_blob = TRUE;
}