summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorunknown <kaa@polly.local>2007-05-31 15:05:11 +0400
committerunknown <kaa@polly.local>2007-05-31 15:05:11 +0400
commit052d1bea030fc521eede06c9aad15693e9bae241 (patch)
treedd84600153e265a9e0c336297b2b11722688bbf2 /strings
parentf0375fd5fa3662dc61d696cc4f3d0462d388e422 (diff)
parentd92bc733f8554dfe815cc0ceec5bbe1600453507 (diff)
downloadmariadb-git-052d1bea030fc521eede06c9aad15693e9bae241.tar.gz
Merge polly.local:/home/kaa/src/maint/bug27643/my51-bug27643
into polly.local:/home/kaa/src/maint/mysql-5.1-maint sql/sql_select.cc: Auto merged
Diffstat (limited to 'strings')
-rw-r--r--strings/ctype-bin.c25
-rw-r--r--strings/ctype-mb.c7
-rw-r--r--strings/ctype-ucs2.c5
3 files changed, 35 insertions, 2 deletions
diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c
index 69f712c5c44..681f0352b8c 100644
--- a/strings/ctype-bin.c
+++ b/strings/ctype-bin.c
@@ -271,6 +271,29 @@ static int my_wc_mb_bin(CHARSET_INFO *cs __attribute__((unused)),
}
+void my_hash_sort_8bit_bin(CHARSET_INFO *cs __attribute__((unused)),
+ const uchar *key, uint len,ulong *nr1, ulong *nr2)
+{
+ const uchar *pos = key;
+
+ key+= len;
+
+ /*
+ Remove trailing spaces. We have to do this to be able to compare
+ 'A ' and 'A' as identical
+ */
+ while (key > pos && key[-1] == ' ')
+ key--;
+
+ for (; pos < (uchar*) key ; pos++)
+ {
+ nr1[0]^=(ulong) ((((uint) nr1[0] & 63)+nr2[0]) *
+ ((uint)*pos)) + (nr1[0] << 8);
+ nr2[0]+=3;
+ }
+}
+
+
void my_hash_sort_bin(CHARSET_INFO *cs __attribute__((unused)),
const uchar *key, uint len,ulong *nr1, ulong *nr2)
{
@@ -471,7 +494,7 @@ MY_COLLATION_HANDLER my_collation_8bit_bin_handler =
my_wildcmp_bin,
my_strcasecmp_bin,
my_instr_bin,
- my_hash_sort_bin,
+ my_hash_sort_8bit_bin,
my_propagate_simple
};
diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c
index 4234ac091cd..ce2bb4922ea 100644
--- a/strings/ctype-mb.c
+++ b/strings/ctype-mb.c
@@ -467,6 +467,13 @@ static void my_hash_sort_mb_bin(CHARSET_INFO *cs __attribute__((unused)),
key+= len;
+ /*
+ Remove trailing spaces. We have to do this to be able to compare
+ 'A ' and 'A' as identical
+ */
+ while (key > pos && key[-1] == ' ')
+ key--;
+
for (; pos < (uchar*) key ; pos++)
{
nr1[0]^=(ulong) ((((uint) nr1[0] & 63)+nr2[0]) *
diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c
index d3b65aa1643..d337c519f84 100644
--- a/strings/ctype-ucs2.c
+++ b/strings/ctype-ucs2.c
@@ -1486,7 +1486,10 @@ void my_hash_sort_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)),
const uchar *pos = key;
key+= len;
-
+
+ while (key > pos+1 && key[-1] == ' ' && key[-2] == '\0')
+ key-= 2;
+
for (; pos < (uchar*) key ; pos++)
{
nr1[0]^=(ulong) ((((uint) nr1[0] & 63)+nr2[0]) *