summaryrefslogtreecommitdiff
path: root/myisam/mi_unique.c
diff options
context:
space:
mode:
authorunknown <bar@gw.udmsearch.izhnet.ru>2002-06-26 16:00:43 +0500
committerunknown <bar@gw.udmsearch.izhnet.ru>2002-06-26 16:00:43 +0500
commit1ff701ee0ccc7410a9dc42ce5ee11e4004002d3a (patch)
tree351864c2a320096c0191ddb08289cc5a4dd7ee4b /myisam/mi_unique.c
parent969919146e96f7709f32ac882359372a45da7944 (diff)
downloadmariadb-git-1ff701ee0ccc7410a9dc42ce5ee11e4004002d3a.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 myisam/mi_unique.c: Fix for non-8bit charsets sql/field.cc: Initialize blobs with charset sql/field.h: Initialize blobs with charset sql/field_conv.cc: Initialize blobs with charset sql/item_strfunc.cc: CONVERT() function now has working fix_lenght_and_dec(), and it's own fix_fields() sql/item_strfunc.h: CONVERT() function now has working fix_lenght_and_dec(), and it's own fix_fields() sql/sql_select.cc: Fixes for BLOBs Fixed that wrong charset was used in some cases
Diffstat (limited to 'myisam/mi_unique.c')
-rw-r--r--myisam/mi_unique.c35
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)