summaryrefslogtreecommitdiff
path: root/innobase/row
diff options
context:
space:
mode:
authorunknown <marko@hundin.mysql.fi>2005-02-08 16:41:34 +0200
committerunknown <marko@hundin.mysql.fi>2005-02-08 16:41:34 +0200
commitf9a394dbddb83d899dd661542490d1965400bdbe (patch)
tree1d41c43c651ff0ac97e4022bf7e9181709da34e2 /innobase/row
parent63bcbfc4339ae843dc367d08fff0760da4d484c3 (diff)
downloadmariadb-git-f9a394dbddb83d899dd661542490d1965400bdbe.tar.gz
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
Diffstat (limited to 'innobase/row')
-rw-r--r--innobase/row/row0sel.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/innobase/row/row0sel.c b/innobase/row/row0sel.c
index 8512e796a72..c0141f896ce 100644
--- a/innobase/row/row0sel.c
+++ b/innobase/row/row0sel.c
@@ -2410,14 +2410,9 @@ row_sel_store_mysql_rec(
/* Pad with trailing spaces */
data = mysql_rec + templ->mysql_col_offset;
- /* Handle UCS2 strings differently. As no new
- collations will be introduced in 4.1, we
- hardcode the charset-collation codes here.
- 5.0 will use a different approach. */
- if (templ->charset == 35
- || templ->charset == 90
- || (templ->charset >= 128
- && templ->charset <= 144)) {
+ ut_ad(templ->mbminlen <= templ->mbmaxlen);
+ /* Handle UCS2 strings differently. */
+ if (templ->mbminlen == 2) {
/* space=0x0020 */
ulint col_len = templ->mysql_col_len;
@@ -2436,6 +2431,7 @@ row_sel_store_mysql_rec(
data[len++] = 0x20;
}
} else {
+ ut_ad(templ->mbminlen == 1);
/* space=0x20 */
memset(data + len, 0x20,
templ->mysql_col_len - len);
@@ -2477,14 +2473,8 @@ row_sel_store_mysql_rec(
pad_char = '\0';
}
- /* Handle UCS2 strings differently. As no new
- collations will be introduced in 4.1,
- we hardcode the charset-collation codes here.
- 5.0 will use a different approach. */
- if (templ->charset == 35
- || templ->charset == 90
- || (templ->charset >= 128
- && templ->charset <= 144)) {
+ /* Handle UCS2 strings differently. */
+ if (templ->mbminlen == 2) {
/* There are two bytes per char, so the length
has to be an even number. */
ut_a(!(templ->mysql_col_len & 1));
@@ -2497,6 +2487,7 @@ row_sel_store_mysql_rec(
len -= 2;
}
} else {
+ ut_ad(templ->mbminlen == 1);
memset(mysql_rec + templ->mysql_col_offset,
pad_char, templ->mysql_col_len);
}