diff options
Diffstat (limited to 'myisam/mi_unique.c')
-rw-r--r-- | myisam/mi_unique.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/myisam/mi_unique.c b/myisam/mi_unique.c index b373693e6e0..2101c656324 100644 --- a/myisam/mi_unique.c +++ b/myisam/mi_unique.c @@ -70,7 +70,7 @@ ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const byte *record) { const byte *pos, *end; ha_checksum crc=0; - MI_KEYSEG *keyseg; + HA_KEYSEG *keyseg; for (keyseg=def->seg ; keyseg < def->end ; keyseg++) { @@ -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) @@ -122,7 +131,7 @@ int mi_unique_comp(MI_UNIQUEDEF *def, const byte *a, const byte *b, my_bool null_are_equal) { const byte *pos_a, *pos_b, *end; - MI_KEYSEG *keyseg; + HA_KEYSEG *keyseg; for (keyseg=def->seg ; keyseg < def->end ; keyseg++) { @@ -172,8 +181,8 @@ int mi_unique_comp(MI_UNIQUEDEF *def, const byte *a, const byte *b, } if (type == HA_KEYTYPE_TEXT || type == HA_KEYTYPE_VARTEXT) { - if (_mi_compare_text(keyseg->charset, (uchar *)pos_a, length, - (uchar *)pos_b, length, 0)) + if (mi_compare_text(keyseg->charset, (uchar *) pos_a, length, + (uchar *) pos_b, length, 0)) return 1; } else |