From f9a394dbddb83d899dd661542490d1965400bdbe Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 8 Feb 2005 16:41:34 +0200 Subject: InnoDB: Fix Bug #7350 without hard-coding charset-collation numbers. innobase/data/data0type.c: Add mbminlen and mbmaxlen to dtype_t innobase/include/data0type.h: Add mbminlen and mbmaxlen to dtype_t Add dtype_get_mbminlen() and dtype_get_mbmaxlen() innobase/include/data0type.ic: Add dtype_set_mblen() Add dtype_get_mbminlen() and dtype_get_mbmaxlen() Replace innobase_is_mb_cset() with innobase_get_mb_cset() innobase/include/row0mysql.h: Add mbminlen and mbmaxlen innobase/include/row0mysql.ic: Detect UCS2 collations based on mbminlen innobase/row/row0sel.c: Detect UCS2 collations based on mbminlen sql/ha_innodb.cc: Replace innobase_is_mb_cset() with innobase_get_mb_cset() build_template(): Initialize templ->mbminlen and templ->mbmaxlen --- innobase/include/row0mysql.ic | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'innobase/include/row0mysql.ic') diff --git a/innobase/include/row0mysql.ic b/innobase/include/row0mysql.ic index fc922b52d0a..1f5d0b0c990 100644 --- a/innobase/include/row0mysql.ic +++ b/innobase/include/row0mysql.ic @@ -93,17 +93,11 @@ row_mysql_store_col_in_innobase_format( || type == DATA_BINARY) { /* Remove trailing spaces. */ - /* Handle UCS2 strings differently. As no new - collations will be introduced in 4.1, we hardcode the - charset-collation codes here. In 5.0, the logic will - be based on mbminlen. */ - ulint cset = dtype_get_charset_coll( - dtype_get_prtype(dfield_get_type(dfield))); + /* Handle UCS2 strings differently. */ + ulint mbminlen = dtype_get_mbminlen( + dfield_get_type(dfield)); ptr = row_mysql_read_var_ref(&col_len, mysql_data); - if (cset == 35/*ucs2_general_ci*/ - || cset == 90/*ucs2_bin*/ - || (cset >= 128/*ucs2_unicode_ci*/ - && cset <= 144/*ucs2_persian_ci*/)) { + if (mbminlen == 2) { /* space=0x0020 */ /* Trim "half-chars", just in case. */ col_len &= ~1; @@ -113,6 +107,7 @@ row_mysql_store_col_in_innobase_format( col_len -= 2; } } else { + ut_a(mbminlen == 1); /* space=0x20 */ while (col_len > 0 && ptr[col_len - 1] == 0x20) { col_len--; -- cgit v1.2.1