summaryrefslogtreecommitdiff
path: root/sql/key.cc
diff options
context:
space:
mode:
authorunknown <bar@mysql.com>2004-08-23 20:12:39 +0500
committerunknown <bar@mysql.com>2004-08-23 20:12:39 +0500
commit01b9de60ef4ee39bcdfb04b8780dee61f155b6b2 (patch)
tree7a5daa21610a08943d99adb65a5c5211552ddde7 /sql/key.cc
parent7075a4d9d2a21edc3e4b282d7ac2ab5dff3af8de (diff)
downloadmariadb-git-01b9de60ef4ee39bcdfb04b8780dee61f155b6b2.tar.gz
Bug#4594: column index make = failed for gbk, but like works
Fix for HEAP+HASH prefix keys.
Diffstat (limited to 'sql/key.cc')
-rw-r--r--sql/key.cc15
1 files changed, 11 insertions, 4 deletions
diff --git a/sql/key.cc b/sql/key.cc
index 9425a368669..b1f4c9533a9 100644
--- a/sql/key.cc
+++ b/sql/key.cc
@@ -211,10 +211,17 @@ bool key_cmp_if_same(TABLE *table,const byte *key,uint idx,uint key_length)
if (!(key_part->key_type & (FIELDFLAG_NUMBER+FIELDFLAG_BINARY+
FIELDFLAG_PACK)))
{
- if (my_strnncoll(key_part->field->charset(),
- (const uchar*) key, length,
- (const uchar*) table->record[0]+key_part->offset,
- length))
+ CHARSET_INFO *cs= key_part->field->charset();
+ uint char_length= key_part->length / cs->mbmaxlen;
+ const byte *pos= table->record[0] + key_part->offset;
+ if (length > char_length)
+ {
+ char_length= my_charpos(cs, pos, pos + length, char_length);
+ set_if_smaller(char_length, length);
+ }
+ if (cs->coll->strnncollsp(cs,
+ (const uchar*) key, length,
+ (const uchar*) pos, char_length))
return 1;
}
else if (memcmp(key,table->record[0]+key_part->offset,length))