MySQL,抛光字符和重复的insert语句 [英] MySQL, polish characters and duplicate insert statement

查看:163
本文介绍了MySQL,抛光字符和重复的insert语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,插入两行到表。数据库采用UTF8格式。问题似乎被连接到排序规则。此语句的工作原理:

I've got a problem with inserting two rows to table. The database is in UTF8. The problem seems to be connected to the collation. This statement works:

insert into test(code,text) values('xx','aaa');

但是当我尝试向表中添加其他行时:

However when i try to add other row to the table:

insert into test(code,text) values('xx','aąą');

它会失败,重复输入错误。它看起来像a和ą(特殊的波兰字符)是相同的。奇怪的是,当我将所有的排序规则设置为utf8_unicode_ci它仍然不工作:/
任何帮助将赞赏:)

it fails with duplicate entry error. It looks like a and ą (special polish character) are threated the same. The weird thing is that when i set all collations to utf8_unicode_ci it still does not work :/ Any help will be appreciated :)

推荐答案

这应该做的诀窍:

This should do the trick:

插入测试(代码,文本)值('xx',N'aąą' );

字母N用于Unicode插入。

The letter N is for Unicode insert.

这篇关于MySQL,抛光字符和重复的insert语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆