您的位置:首页 > 数据库 > MySQL

mysql字符串查询大小写问题

2015-11-01 10:52 603 查看
1、引入问题

在进行研究innodb隐式锁转换显示锁时,看到代码有这么一段:

else if (0 == cmp_dtuple_rec(entry, rec, offsets)) {
/* The delete marks of rec and prev_version should be
equal for rec to be in the state required by
prev_version */

if (rec_del != vers_del) {

break;
}

/* It is possible that the row was updated so that the
secondary index record remained the same in
alphabetical ordering, but the field values changed
still. For example, 'abc' -> 'ABC'. Check also that. */

dtuple_set_types_binary(
entry, dtuple_get_n_fields(entry));

if (0 != cmp_dtuple_rec(entry, rec, offsets)) {

break;
}

不明白为什么要判断2次?

2、为了解决字符串大小写的问题

     mysql默认下字符串校验是不区分大小写的:

所以这里需要设置binary后再次进行比对判断
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: