由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Database版 - how to query chinese in mysql?
相关主题
请教怎么来log duration of a MYSQL procedure?SQL question...
parameterized queries with no inputs[转载] 有谁试了MySql 4.11中的中文全文搜索功能
Re: How to display Chinese text (query results) properly on web ??mysql索引/优化的一个问题
How to split a column into several rows?== MySql问题 ==
求教一个mysql的select优化Slow view performance in MySQL
SQL debug step into a store procedure from another one (转载)有比较好的支持中文的 Mysql的GUI么?
问个数据库问题一个关于 通过Matlab databast toolbox 获得MySQL数据的问题,两个机器,谢谢!
mySQL怎么这么慢?请教一个query in mysql
相关话题的讨论汇总
话题: unicode话题: mysql话题: query话题: chinese话题: str
进入Database版参与讨论
1 (共1页)
a*p
发帖数: 62
1
seems that mysql will add unicode support in the near future.
when I query like "%猪%"
it will return lots of unrelated items, which might contain the two bytes
of 猪 but not belonging to the same chinese character.
true?
a*p
发帖数: 62
2
没人回答我,赫赫,我自己想了个笨办法:
因为我用的PHP也不支持unicode,我就:
数据库出来的数据再用unicode_like_compare做过滤,应该可以在很大程度上解决问题。
这个应该还是暂时方案吧,等mysql的unicode support吧。
function to_unicode_like($str) {
$r = "";
for ($i=0;$i $ch = substr($str,$i,1);
if (ord($ch) < 127) $r .= " $ch";
else {
if ($i == strlen($str)-1) $r .= $ch;
else {
$r .= substr($str,$i,2);


【在 a*p 的大作中提到】
: seems that mysql will add unicode support in the near future.
: when I query like "%猪%"
: it will return lots of unrelated items, which might contain the two bytes
: of 猪 but not belonging to the same chinese character.
: true?

b****e
发帖数: 1275
3
oracle supports unicode directly.. for databases
that do not support unicode i would always base64encode
the string before storing it into the db.. to do a compare
base64encode the "pig" first too of course

【在 a*p 的大作中提到】
: 没人回答我,赫赫,我自己想了个笨办法:
: 因为我用的PHP也不支持unicode,我就:
: 数据库出来的数据再用unicode_like_compare做过滤,应该可以在很大程度上解决问题。
: 这个应该还是暂时方案吧,等mysql的unicode support吧。
: function to_unicode_like($str) {
: $r = "";
: for ($i=0;$i: $ch = substr($str,$i,1);
: if (ord($ch) < 127) $r .= " $ch";
: else {

a*p
发帖数: 62
4
I thought this solution before.:-)
but how to deal with where blah like '%pig%'? that's what I need.

【在 b****e 的大作中提到】
: oracle supports unicode directly.. for databases
: that do not support unicode i would always base64encode
: the string before storing it into the db.. to do a compare
: base64encode the "pig" first too of course

1 (共1页)
进入Database版参与讨论
相关主题
请教一个query in mysql求教一个mysql的select优化
mysql query questionSQL debug step into a store procedure from another one (转载)
mysql 在两台电脑中倒数据? (转载)问个数据库问题
有mysql dba么?请进mySQL怎么这么慢?
请教怎么来log duration of a MYSQL procedure?SQL question...
parameterized queries with no inputs[转载] 有谁试了MySql 4.11中的中文全文搜索功能
Re: How to display Chinese text (query results) properly on web ??mysql索引/优化的一个问题
How to split a column into several rows?== MySql问题 ==
相关话题的讨论汇总
话题: unicode话题: mysql话题: query话题: chinese话题: str