summaryrefslogtreecommitdiff
path: root/myisam/mi_unique.c
diff options
context:
space:
mode:
authormonty@mysql.com <>2004-06-18 03:02:29 +0300
committermonty@mysql.com <>2004-06-18 03:02:29 +0300
commitfd0153304dc0e2ada1144fc79f117f02bdcd132b (patch)
treebbef0bb6fad673089610709f1981fd9f249b7833 /myisam/mi_unique.c
parent2f76413e5a457741e33ca023a860da8fc1dcf297 (diff)
downloadmariadb-git-fd0153304dc0e2ada1144fc79f117f02bdcd132b.tar.gz
Fixed some byte order bugs with prepared statements on machines with high-byte-first. (Bug #4173)
Fixed problem with NULL and derived tables (Bug #4097) Cleanup of new pushed code
Diffstat (limited to 'myisam/mi_unique.c')
-rw-r--r--myisam/mi_unique.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/myisam/mi_unique.c b/myisam/mi_unique.c
index 06d50e6905b..77e967e52e2 100644
--- a/myisam/mi_unique.c
+++ b/myisam/mi_unique.c
@@ -69,7 +69,7 @@ my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, byte *record,
ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const byte *record)
{
const byte *pos, *end;
- ulong crc= 0;
+ ha_checksum crc= 0;
ulong seed= 4;
HA_KEYSEG *keyseg;
@@ -109,8 +109,11 @@ ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const byte *record)
end= pos+length;
if (type == HA_KEYTYPE_TEXT || type == HA_KEYTYPE_VARTEXT)
{
+ ulong tmp= 0;
keyseg->charset->coll->hash_sort(keyseg->charset,
- (const uchar*) pos, length, &crc, &seed);
+ (const uchar*) pos, length, &tmp,
+ &seed);
+ crc^= tmp;
}
else
while (pos != end)
@@ -118,7 +121,7 @@ ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const byte *record)
(((uchar) *(uchar*) pos++))) +
(crc >> (8*sizeof(ha_checksum)-8));
}
- return (ha_checksum)crc;
+ return crc;
}
/*