我正在对请求生成器进行单元测试,但遇到了LENGTH
功能问题。
我有 2 个相互跟随的请求:
SHOW VARIABLES LIKE '%character%'
返回以下结果:
array(8) {
[0] =>
array(2) {
'Variable_name' =>
string(20) "character_set_client"
'Value' =>
string(4) "utf8"
}
[1] =>
array(2) {
'Variable_name' =>
string(24) "character_set_connection"
'Value' =>
string(4) "utf8"
}
[2] =>
array(2) {
'Variable_name' =>
string(22) "character_set_database"
'Value' =>
string(6) "latin1"
}
[3] =>
array(2) {
'Variable_name' =>
string(24) "character_set_filesystem"
'Value' =>
string(6) "binary"
}
[4] =>
array(2) {
'Variable_name' =>
string(21) "character_set_results"
'Value' =>
string(4) "utf8"
}
[5] =>
array(2) {
'Variable_name' =>
string(20) "character_set_server"
'Value' =>
string(4) "utf8"
}
[6] =>
array(2) {
'Variable_name' =>
string(20) "character_set_system"
'Value' =>
string(4) "utf8"
}
[7] =>
array(2) {
'Variable_name' =>
string(18) "character_sets_dir"
'Value' =>
string(26) "/usr/share/mysql/charsets/"
}
}
我的第二个要求是:
SELECT LENGTH('重庆') as len
它返回 6 而不是 2。
这里有什么问题?我的字符集参数看起来不错。