diff options
author | bar@gw.udmsearch.izhnet.ru <> | 2002-06-26 16:00:43 +0500 |
---|---|---|
committer | bar@gw.udmsearch.izhnet.ru <> | 2002-06-26 16:00:43 +0500 |
commit | 337d46966cf9fd37752a4f870b3f5161001be504 (patch) | |
tree | 351864c2a320096c0191ddb08289cc5a4dd7ee4b /myisam/mi_unique.c | |
parent | 97d9936f5dcd985671b393ec84ab6438d929d17e (diff) | |
download | mariadb-git-337d46966cf9fd37752a4f870b3f5161001be504.tar.gz |
Several problems were fixed (mostly BLOB+charset related)
Fixed that MyISAM were not working properly with non-8bit charsets in some cases
CONVERT() function now works properly
Diffstat (limited to 'myisam/mi_unique.c')
-rw-r--r-- | myisam/mi_unique.c | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/myisam/mi_unique.c b/myisam/mi_unique.c index 629523ec69a..7afaabfe75b 100644 --- a/myisam/mi_unique.c +++ b/myisam/mi_unique.c @@ -99,11 +99,20 @@ ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const byte *record) end= pos+length; if (type == HA_KEYTYPE_TEXT || type == HA_KEYTYPE_VARTEXT) { - uchar *sort_order=keyseg->charset->sort_order; - while (pos != end) - crc=((crc << 8) + - (((uchar) sort_order[*(uchar*) pos++]))) + - (crc >> (8*sizeof(ha_checksum)-8)); + if (keyseg->charset->hash_sort) + { + ulong nr=1, nr2=4; + keyseg->charset->hash_sort(keyseg->charset,(const uchar*)pos,length,&nr, &nr2); + crc=nr; + } + else + { + uchar *sort_order=keyseg->charset->sort_order; + while (pos != end) + crc=((crc << 8) + + (((uchar) sort_order[*(uchar*) pos++]))) + + (crc >> (8*sizeof(ha_checksum)-8)); + } } else while (pos != end) @@ -173,11 +182,19 @@ int mi_unique_comp(MI_UNIQUEDEF *def, const byte *a, const byte *b, end= pos_a+length; if (type == HA_KEYTYPE_TEXT || type == HA_KEYTYPE_VARTEXT) { - uchar *sort_order=keyseg->charset->sort_order; - while (pos_a != end) - if (sort_order[*(uchar*) pos_a++] != - sort_order[*(uchar*) pos_b++]) + if (use_strcoll(keyseg->charset)) + { + if (my_strnncoll(keyseg->charset,pos_a,length,pos_b,length)) return 1; + } + else + { + uchar *sort_order=keyseg->charset->sort_order; + while (pos_a != end) + if (sort_order[*(uchar*) pos_a++] != + sort_order[*(uchar*) pos_b++]) + return 1; + } } else while (pos_a != end) |