|
|||||||||||
|
bk commit into 4.1 tree (svoj:1.2686) BUG#31159
From: Sergey Vojtovich <svoj(at)mysql.com>
Date: Thu Oct 18 2007 - 08:20:43 EDT
ChangeSet@1.2686, 2007-10-18 17:09:55+05:00, svoj@mysql.com +5 -0 BUG#31159 - fulltext search on ucs2 column crashes server ucs2 doesn't provide required by fulltext ctype array. Crash happens because fulltext attempts to use unitialized ctype array. Fixed by converting ucs2 fields to compatible utf8 analogue. include/my_sys.h@1.148, 2007-10-18 17:09:53+05:00, svoj@mysql.com +2 -0 Added a function to find compatible character set with ctype array available. Currently used by fulltext search to find compatible substitute for ucs2 collations. mysql-test/r/ctype_ucs.result@1.36, 2007-10-18 17:09:53+05:00, svoj@mysql.com +6 -0 A test case for BUG#31159. mysql-test/t/ctype_ucs.test@1.36, 2007-10-18 17:09:53+05:00, svoj@mysql.com +8 -0 A test case for BUG#31159. mysys/charset.c@1.145, 2007-10-18 17:09:53+05:00, svoj@mysql.com +39 -0 Added a function to find compatible character set with ctype array available. Currently used by fulltext search to find compatible substitute for ucs2 collations. sql/item_func.cc@1.278, 2007-10-18 17:09:53+05:00, svoj@mysql.com +22 -0 Convert ucs2 fields to utf8. Fulltext requires ctype array, but ucs2 doesn't provide it. diff -Nrup a/include/my_sys.h b/include/my_sys.h --- a/include/my_sys.h 2007-05-17 12:43:51 +05:00@@ -784,6 +784,8 @@ extern CHARSET_INFO *get_charset(uint cs extern CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags); extern CHARSET_INFO *get_charset_by_csname(const char *cs_name,
uint cs_flags, myf my_flags);
--- a/mysql-test/r/ctype_ucs.result 2006-10-03 14:11:54 +05:00@@ -803,4 +803,10 @@ quote(name) ???????? ???????????????? drop table bug20536; +CREATE TABLE t1(a TEXT CHARSET ucs2 COLLATE ucs2_unicode_ci); +INSERT INTO t1 VALUES('abcd'); +SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abcd' IN BOOLEAN MODE); +a +abcd +DROP TABLE t1; End of 4.1 tests diff -Nrup a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test --- a/mysql-test/t/ctype_ucs.test 2006-10-03 14:11:54 +05:00@@ -535,4 +535,12 @@ select quote(name) from bug20536; drop table bug20536; +# --- a/mysys/charset.c 2006-09-15 08:05:03 +05:00@@ -673,3 +673,42 @@ CHARSET_INFO *fs_character_set()
return fs_cset_cache;
--- a/sql/item_func.cc 2007-06-13 16:32:58 +05:00 } table->fulltext_searched=1; + /* A workaround for ucs2 character set */ + if (!args[1]->collation.collation->ctype) + { + CHARSET_INFO *compatible_cs= + get_compatible_charset_with_ctype(args[1]->collation.collation); + bool rc= 1; + if (compatible_cs) + { + Item_string *conv_item= new Item_string("", 0, compatible_cs, + DERIVATION_EXPLICIT); + item= args[0]; + args[0]= conv_item; + rc= agg_item_charsets(cmp_collation, func_name(), args, arg_count, + MY_COLL_ALLOW_SUPERSET_CONV | + MY_COLL_ALLOW_COERCIBLE_CONV | + MY_COLL_DISALLOW_NONE); + args[0]= item; + } + else + my_error(ER_WRONG_ARGUMENTS, MYF(0), "MATCH"); + return rc; + } return agg_arg_collations_for_comparison(cmp_collation, args+1, arg_count-1); } -- MySQL Code Commits Mailing List For list archives: http://lists.mysql.com/commits To unsubscribe: http://lists.mysql.com/commits?unsub=lists@pantek.comReceived on Thu Oct 18 08:20:52 2007 This archive was generated by hypermail 2.1.8 : Thu Jul 03 2008 - 10:09:41 EDT |
||||||||||
|
|||||||||||