Commit 107ef617 authored by unknown's avatar unknown

Merge baker@bk-internal.mysql.com:/home/bk/mysql-5.0/

into avenger.(none):/export/brian/mysql/acinclude-5.0

parents ae9992ec f09c8b35
...@@ -2515,6 +2515,7 @@ btr_index_rec_validate( ...@@ -2515,6 +2515,7 @@ btr_index_rec_validate(
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
dtype_t* type = dict_index_get_nth_type(index, i); dtype_t* type = dict_index_get_nth_type(index, i);
ulint fixed_size = dtype_get_fixed_size(type);
rec_get_nth_field(rec, offsets, i, &len); rec_get_nth_field(rec, offsets, i, &len);
...@@ -2522,8 +2523,8 @@ btr_index_rec_validate( ...@@ -2522,8 +2523,8 @@ btr_index_rec_validate(
their type is CHAR. */ their type is CHAR. */
if ((dict_index_get_nth_field(index, i)->prefix_len == 0 if ((dict_index_get_nth_field(index, i)->prefix_len == 0
&& len != UNIV_SQL_NULL && dtype_is_fixed_size(type) && len != UNIV_SQL_NULL && fixed_size
&& len != dtype_get_fixed_size(type)) && len != fixed_size)
|| ||
(dict_index_get_nth_field(index, i)->prefix_len > 0 (dict_index_get_nth_field(index, i)->prefix_len > 0
&& len != UNIV_SQL_NULL && len != UNIV_SQL_NULL
......
...@@ -8,6 +8,17 @@ Created 1/16/1996 Heikki Tuuri ...@@ -8,6 +8,17 @@ Created 1/16/1996 Heikki Tuuri
#include "mach0data.h" #include "mach0data.h"
/**********************************************************************
Determines whether the given character set is of variable length.
NOTE: the prototype of this function is copied from ha_innodb.cc! If you change
this function, you MUST change also the prototype here! */
extern
ibool
innobase_is_mb_cset(
/*================*/
ulint cset); /* in: MySQL charset-collation code */
/************************************************************************* /*************************************************************************
Sets a data type structure. */ Sets a data type structure. */
UNIV_INLINE UNIV_INLINE
...@@ -293,7 +304,13 @@ dtype_get_fixed_size( ...@@ -293,7 +304,13 @@ dtype_get_fixed_size(
case DATA_FLOAT: case DATA_FLOAT:
case DATA_DOUBLE: case DATA_DOUBLE:
case DATA_MYSQL: case DATA_MYSQL:
return(dtype_get_len(type)); if ((type->prtype & DATA_BINARY_TYPE)
|| !innobase_is_mb_cset(
dtype_get_charset_coll(
type->prtype))) {
return(dtype_get_len(type));
}
/* fall through for variable-length charsets */
case DATA_VARCHAR: case DATA_VARCHAR:
case DATA_BINARY: case DATA_BINARY:
case DATA_DECIMAL: case DATA_DECIMAL:
......
...@@ -473,6 +473,8 @@ row_ins_cascade_calc_update_vec( ...@@ -473,6 +473,8 @@ row_ins_cascade_calc_update_vec(
if (parent_ufield->field_no == parent_field_no) { if (parent_ufield->field_no == parent_field_no) {
ulint fixed_size;
/* A field in the parent index record is /* A field in the parent index record is
updated. Let us make the update vector updated. Let us make the update vector
field for the child table. */ field for the child table. */
...@@ -512,22 +514,22 @@ row_ins_cascade_calc_update_vec( ...@@ -512,22 +514,22 @@ row_ins_cascade_calc_update_vec(
need to pad with spaces the new value of the need to pad with spaces the new value of the
child column */ child column */
if (dtype_is_fixed_size(type) fixed_size = dtype_get_fixed_size(type);
if (fixed_size
&& ufield->new_val.len != UNIV_SQL_NULL && ufield->new_val.len != UNIV_SQL_NULL
&& ufield->new_val.len && ufield->new_val.len < fixed_size) {
< dtype_get_fixed_size(type)) {
ufield->new_val.data = ufield->new_val.data =
mem_heap_alloc(heap, mem_heap_alloc(heap,
dtype_get_fixed_size(type)); fixed_size);
ufield->new_val.len = ufield->new_val.len = fixed_size;
dtype_get_fixed_size(type);
ut_a(dtype_get_pad_char(type) ut_a(dtype_get_pad_char(type)
!= ULINT_UNDEFINED); != ULINT_UNDEFINED);
memset(ufield->new_val.data, memset(ufield->new_val.data,
(byte)dtype_get_pad_char(type), (byte)dtype_get_pad_char(type),
dtype_get_fixed_size(type)); fixed_size);
ut_memcpy(ufield->new_val.data, ut_memcpy(ufield->new_val.data,
parent_ufield->new_val.data, parent_ufield->new_val.data,
parent_ufield->new_val.len); parent_ufield->new_val.len);
......
...@@ -3694,6 +3694,8 @@ row_search_for_mysql( ...@@ -3694,6 +3694,8 @@ row_search_for_mysql(
} }
if (prebuilt->clust_index_was_generated) { if (prebuilt->clust_index_was_generated) {
offsets = rec_reget_offsets(index_rec, index, offsets,
ULINT_UNDEFINED, heap);
row_sel_store_row_id_to_prebuilt(prebuilt, index_rec, row_sel_store_row_id_to_prebuilt(prebuilt, index_rec,
index, offsets); index, offsets);
} }
......
...@@ -520,6 +520,25 @@ innobase_mysql_print_thd( ...@@ -520,6 +520,25 @@ innobase_mysql_print_thd(
putc('\n', f); putc('\n', f);
} }
/**********************************************************************
Determines whether the given character set is of variable length.
NOTE that the exact prototype of this function has to be in
/innobase/data/data0type.ic! */
extern "C"
ibool
innobase_is_mb_cset(
/*================*/
ulint cset) /* in: MySQL charset-collation code */
{
CHARSET_INFO* cs;
ut_ad(cset < 256);
cs = all_charsets[cset];
return(cs && cs->mbminlen != cs->mbmaxlen);
}
/********************************************************************** /**********************************************************************
Compares NUL-terminated UTF-8 strings case insensitively. Compares NUL-terminated UTF-8 strings case insensitively.
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment