summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorunknown <kaa@polly.local>2007-05-31 14:58:22 +0400
committerunknown <kaa@polly.local>2007-05-31 14:58:22 +0400
commitd92bc733f8554dfe815cc0ceec5bbe1600453507 (patch)
treecbaa5936229d6f86c780c22524967302461b6162 /strings
parente5353e2f48a75e20df595b7e14e00ee1b74f44c0 (diff)
parentf18a10c6c1ced93a83ead017aa10398fa17c9a63 (diff)
downloadmariadb-git-d92bc733f8554dfe815cc0ceec5bbe1600453507.tar.gz
Merge polly.local:/home/kaa/src/maint/bug27643/my50-bug27643
into polly.local:/home/kaa/src/maint/bug27643/my51-bug27643 mysql-test/r/ctype_ucs2_def.result: Auto merged mysql-test/r/heap_hash.result: Auto merged mysql-test/t/ctype_ucs2_def.test: Auto merged mysql-test/t/heap_hash.test: Auto merged sql/sql_select.cc: Auto merged strings/ctype-bin.c: Auto merged strings/ctype-mb.c: Auto merged strings/ctype-ucs2.c: 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]) *