summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_ctype.h17
-rw-r--r--include/my_base.h6
-rw-r--r--include/my_compare.h2
-rw-r--r--mysql-test/include/ctype_pad_space.inc10
-rw-r--r--mysql-test/r/ctype_big5.result30
-rw-r--r--mysql-test/r/ctype_cp1250_ch.result30
-rw-r--r--mysql-test/r/ctype_cp1251.result15
-rw-r--r--mysql-test/r/ctype_latin1.result30
-rw-r--r--mysql-test/r/ctype_latin2_ch.result60
-rw-r--r--mysql-test/r/ctype_tis620.result30
-rw-r--r--mysql-test/t/ctype_big5.test2
-rw-r--r--mysql-test/t/ctype_cp1251.test1
-rw-r--r--mysql-test/t/ctype_latin1.test2
-rw-r--r--mysql-test/t/ctype_tis620.test2
-rw-r--r--mysys/my_compare.c18
-rw-r--r--sql/events.cc2
-rw-r--r--sql/field.cc13
-rw-r--r--sql/item.h2
-rw-r--r--sql/item_cmpfunc.cc2
-rw-r--r--sql/key.cc5
-rw-r--r--sql/opt_subselect.cc1
-rw-r--r--sql/sql_select.cc2
-rw-r--r--sql/sql_show.cc8
-rw-r--r--sql/sql_string.cc2
-rw-r--r--sql/strfunc.cc2
-rw-r--r--storage/heap/heapdef.h3
-rw-r--r--storage/heap/hp_delete.c2
-rw-r--r--storage/heap/hp_hash.c15
-rw-r--r--storage/heap/hp_update.c4
-rw-r--r--storage/heap/hp_write.c2
-rw-r--r--storage/innobase/handler/ha_innodb.cc10
-rw-r--r--storage/maria/ma_check.c2
-rw-r--r--storage/maria/ma_ft_boolean_search.c8
-rw-r--r--storage/maria/ma_ft_nlq_search.c2
-rw-r--r--storage/maria/ma_ft_parser.c2
-rw-r--r--storage/maria/ma_ft_update.c4
-rw-r--r--storage/maria/ma_unique.c2
-rw-r--r--storage/maria/ma_write.c2
-rw-r--r--storage/myisam/ft_boolean_search.c8
-rw-r--r--storage/myisam/ft_nlq_search.c2
-rw-r--r--storage/myisam/ft_parser.c2
-rw-r--r--storage/myisam/ft_stopwords.c2
-rw-r--r--storage/myisam/ft_update.c4
-rw-r--r--storage/myisam/mi_check.c2
-rw-r--r--storage/myisam/mi_unique.c2
-rw-r--r--storage/myisam/mi_write.c2
-rw-r--r--storage/tokudb/hatoku_cmp.cc3
-rw-r--r--storage/xtradb/handler/ha_innodb.cc10
-rw-r--r--strings/ctype-bin.c65
-rw-r--r--strings/ctype-czech.c4
-rw-r--r--strings/ctype-latin1.c38
-rw-r--r--strings/ctype-simple.c12
-rw-r--r--strings/ctype-tis620.c40
-rw-r--r--strings/ctype-uca.c28
-rw-r--r--strings/ctype-utf8.c54
-rw-r--r--strings/ctype-win1250ch.c4
-rw-r--r--strings/strcoll.ic6
-rw-r--r--unittest/strings/strings-t.c4
58 files changed, 312 insertions, 332 deletions
diff --git a/include/m_ctype.h b/include/m_ctype.h
index 615ee6ac1c6..d22a0b1f987 100644
--- a/include/m_ctype.h
+++ b/include/m_ctype.h
@@ -325,8 +325,7 @@ struct my_collation_handler_st
int (*strnncoll)(CHARSET_INFO *,
const uchar *, size_t, const uchar *, size_t, my_bool);
int (*strnncollsp)(CHARSET_INFO *,
- const uchar *, size_t, const uchar *, size_t,
- my_bool diff_if_only_endspace_difference);
+ const uchar *, size_t, const uchar *, size_t);
size_t (*strnxfrm)(CHARSET_INFO *,
uchar *dst, size_t dstlen, uint nweights,
const uchar *src, size_t srclen, uint flags);
@@ -644,8 +643,7 @@ extern int my_strnncoll_simple(CHARSET_INFO *, const uchar *, size_t,
const uchar *, size_t, my_bool);
extern int my_strnncollsp_simple(CHARSET_INFO *, const uchar *, size_t,
- const uchar *, size_t,
- my_bool diff_if_only_endspace_difference);
+ const uchar *, size_t);
extern void my_hash_sort_simple(CHARSET_INFO *cs,
const uchar *key, size_t len,
@@ -654,6 +652,17 @@ extern void my_hash_sort_bin(CHARSET_INFO *cs,
const uchar *key, size_t len, ulong *nr1,
ulong *nr2);
+/**
+ Compare a string to an array of spaces, for PAD SPACE comparison.
+ The function iterates through the string and compares every byte to 0x20.
+ @param - the string
+ @param - its length
+ @return <0 - if a byte less than 0x20 was found in the string.
+ @return 0 - if all bytes in the string were 0x20, or if length was 0.
+ @return >0 - if a byte greater than 0x20 was found in the string.
+*/
+extern int my_strnncollsp_padspace_bin(const uchar *str, size_t length);
+
extern size_t my_lengthsp_8bit(CHARSET_INFO *cs, const char *ptr, size_t length);
extern uint my_instr_simple(CHARSET_INFO *,
diff --git a/include/my_base.h b/include/my_base.h
index 8b546edac43..1317639c528 100644
--- a/include/my_base.h
+++ b/include/my_base.h
@@ -298,11 +298,7 @@ enum ha_base_keytype {
#define HA_SWAP_KEY 64
#define HA_REVERSE_SORT 128 /* Sort key in reverse order */
#define HA_NO_SORT 256 /* do not bother sorting on this keyseg */
-/*
- End space in unique/varchar are considered equal. (Like 'a' and 'a ')
- Only needed for internal temporary tables.
-*/
-#define HA_END_SPACE_ARE_EQUAL 512
+
#define HA_BIT_PART 1024
#define HA_CAN_MEMCMP 2048 /* internal, never stored in frm */
diff --git a/include/my_compare.h b/include/my_compare.h
index 0db22b593f4..6b76483074b 100644
--- a/include/my_compare.h
+++ b/include/my_compare.h
@@ -108,7 +108,7 @@ typedef struct st_HA_KEYSEG /* Key-portion */
set_rec_bits(0, bit_ptr, bit_ofs, bit_len)
extern int ha_compare_text(CHARSET_INFO *, const uchar *, uint,
- const uchar *, uint , my_bool, my_bool);
+ const uchar *, uint , my_bool);
extern int ha_key_cmp(HA_KEYSEG *keyseg, const uchar *a,
const uchar *b, uint key_length, uint nextflag,
uint *diff_pos);
diff --git a/mysql-test/include/ctype_pad_space.inc b/mysql-test/include/ctype_pad_space.inc
index 667f97de710..491225bd55a 100644
--- a/mysql-test/include/ctype_pad_space.inc
+++ b/mysql-test/include/ctype_pad_space.inc
@@ -1,5 +1,5 @@
-SELECT strcmp('a','a ');
-SELECT strcmp('a\0','a' );
-SELECT strcmp('a\0','a ');
-SELECT strcmp('a\t','a' );
-SELECT strcmp('a\t','a ');
+SELECT strcmp('a','a '), strcmp('a ','a');
+SELECT strcmp('a\0','a' ), strcmp('a','a\0');
+SELECT strcmp('a\0','a '), strcmp('a ','a\0');
+SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
+SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
diff --git a/mysql-test/r/ctype_big5.result b/mysql-test/r/ctype_big5.result
index f97d060d26a..ff6b17f5b4d 100644
--- a/mysql-test/r/ctype_big5.result
+++ b/mysql-test/r/ctype_big5.result
@@ -329,6 +329,21 @@ _ 5F
} 7D
 7F
drop table t1;
+SELECT strcmp('a','a '), strcmp('a ','a');
+strcmp('a','a ') strcmp('a ','a')
+0 0
+SELECT strcmp('a\0','a' ), strcmp('a','a\0');
+strcmp('a\0','a' ) strcmp('a','a\0')
+-1 1
+SELECT strcmp('a\0','a '), strcmp('a ','a\0');
+strcmp('a\0','a ') strcmp('a ','a\0')
+-1 1
+SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
+strcmp('a\t','a' ) strcmp('a', 'a\t')
+-1 1
+SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
+strcmp('a\t','a ') strcmp('a ', 'a\t')
+-1 1
SET collation_connection='big5_bin';
create table t1 select repeat('a',4000) a;
delete from t1;
@@ -476,6 +491,21 @@ a hex(b) c
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
DROP TABLE t1;
+SELECT strcmp('a','a '), strcmp('a ','a');
+strcmp('a','a ') strcmp('a ','a')
+0 0
+SELECT strcmp('a\0','a' ), strcmp('a','a\0');
+strcmp('a\0','a' ) strcmp('a','a\0')
+-1 1
+SELECT strcmp('a\0','a '), strcmp('a ','a\0');
+strcmp('a\0','a ') strcmp('a ','a\0')
+-1 1
+SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
+strcmp('a\t','a' ) strcmp('a', 'a\t')
+-1 1
+SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
+strcmp('a\t','a ') strcmp('a ', 'a\t')
+-1 1
SET NAMES big5;
CREATE TABLE t1 (a text) character set big5;
INSERT INTO t1 VALUES ('ùØ');
diff --git a/mysql-test/r/ctype_cp1250_ch.result b/mysql-test/r/ctype_cp1250_ch.result
index f2eeb4dda79..69253250a53 100644
--- a/mysql-test/r/ctype_cp1250_ch.result
+++ b/mysql-test/r/ctype_cp1250_ch.result
@@ -377,21 +377,21 @@ a
abcdefghá
drop table t1;
set names cp1250 collate cp1250_czech_cs;
-SELECT strcmp('a','a ');
-strcmp('a','a ')
-0
-SELECT strcmp('a\0','a' );
-strcmp('a\0','a' )
-1
-SELECT strcmp('a\0','a ');
-strcmp('a\0','a ')
-1
-SELECT strcmp('a\t','a' );
-strcmp('a\t','a' )
-1
-SELECT strcmp('a\t','a ');
-strcmp('a\t','a ')
-1
+SELECT strcmp('a','a '), strcmp('a ','a');
+strcmp('a','a ') strcmp('a ','a')
+0 0
+SELECT strcmp('a\0','a' ), strcmp('a','a\0');
+strcmp('a\0','a' ) strcmp('a','a\0')
+1 -1
+SELECT strcmp('a\0','a '), strcmp('a ','a\0');
+strcmp('a\0','a ') strcmp('a ','a\0')
+1 -1
+SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
+strcmp('a\t','a' ) strcmp('a', 'a\t')
+1 -1
+SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
+strcmp('a\t','a ') strcmp('a ', 'a\t')
+1 -1
create table t1 select repeat('a',4000) a;
delete from t1;
insert into t1 values ('a'), ('a '), ('a\t');
diff --git a/mysql-test/r/ctype_cp1251.result b/mysql-test/r/ctype_cp1251.result
index 08a840f7749..dc6d4750590 100644
--- a/mysql-test/r/ctype_cp1251.result
+++ b/mysql-test/r/ctype_cp1251.result
@@ -388,6 +388,21 @@ FF FF FF D18F FF
Warnings:
Warning 1977 Cannot convert 'cp1251' character 0x98 to 'utf8'
DROP TABLE t1;
+SELECT strcmp('a','a '), strcmp('a ','a');
+strcmp('a','a ') strcmp('a ','a')
+0 0
+SELECT strcmp('a\0','a' ), strcmp('a','a\0');
+strcmp('a\0','a' ) strcmp('a','a\0')
+-1 1
+SELECT strcmp('a\0','a '), strcmp('a ','a\0');
+strcmp('a\0','a ') strcmp('a ','a\0')
+-1 1
+SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
+strcmp('a\t','a' ) strcmp('a', 'a\t')
+-1 1
+SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
+strcmp('a\t','a ') strcmp('a ', 'a\t')
+-1 1
set global LC_TIME_NAMES=convert((-8388608) using cp1251);
ERROR HY000: Unknown locale: '-8388608'
#
diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result
index 48475923138..f2e519e4aef 100644
--- a/mysql-test/r/ctype_latin1.result
+++ b/mysql-test/r/ctype_latin1.result
@@ -525,6 +525,21 @@ SELECT HEX(subject),HEX(pattern),STR_TO_DATE(subject, pattern) FROM t1;
HEX(subject) HEX(pattern) STR_TO_DATE(subject, pattern)
32303031F73031F73031 2559F7256DF72564 2001-01-01 00:00:00.000000
DROP TABLE t1;
+SELECT strcmp('a','a '), strcmp('a ','a');
+strcmp('a','a ') strcmp('a ','a')
+0 0
+SELECT strcmp('a\0','a' ), strcmp('a','a\0');
+strcmp('a\0','a' ) strcmp('a','a\0')
+-1 1
+SELECT strcmp('a\0','a '), strcmp('a ','a\0');
+strcmp('a\0','a ') strcmp('a ','a\0')
+-1 1
+SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
+strcmp('a\t','a' ) strcmp('a', 'a\t')
+-1 1
+SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
+strcmp('a\t','a ') strcmp('a ', 'a\t')
+-1 1
SET collation_connection='latin1_bin';
create table t1 select repeat('a',4000) a;
delete from t1;
@@ -621,6 +636,21 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT strcmp('a','a '), strcmp('a ','a');
+strcmp('a','a ') strcmp('a ','a')
+0 0
+SELECT strcmp('a\0','a' ), strcmp('a','a\0');
+strcmp('a\0','a' ) strcmp('a','a\0')
+-1 1
+SELECT strcmp('a\0','a '), strcmp('a ','a\0');
+strcmp('a\0','a ') strcmp('a ','a\0')
+-1 1
+SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
+strcmp('a\t','a' ) strcmp('a', 'a\t')
+-1 1
+SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
+strcmp('a\t','a ') strcmp('a ', 'a\t')
+-1 1
CREATE TABLE „a (a int);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '„a (a int)' at line 1
SELECT '„a' as str;
diff --git a/mysql-test/r/ctype_latin2_ch.result b/mysql-test/r/ctype_latin2_ch.result
index da5c8076fca..2ec8351cd69 100644
--- a/mysql-test/r/ctype_latin2_ch.result
+++ b/mysql-test/r/ctype_latin2_ch.result
@@ -30,21 +30,21 @@ select * from t1 where tt like '%AA%';
id tt
drop table t1;
set names latin2 collate latin2_czech_cs;
-SELECT strcmp('a','a ');
-strcmp('a','a ')
-0
-SELECT strcmp('a\0','a' );
-strcmp('a\0','a' )
-1
-SELECT strcmp('a\0','a ');
-strcmp('a\0','a ')
-1
-SELECT strcmp('a\t','a' );
-strcmp('a\t','a' )
-0
-SELECT strcmp('a\t','a ');
-strcmp('a\t','a ')
-0
+SELECT strcmp('a','a '), strcmp('a ','a');
+strcmp('a','a ') strcmp('a ','a')
+0 0
+SELECT strcmp('a\0','a' ), strcmp('a','a\0');
+strcmp('a\0','a' ) strcmp('a','a\0')
+1 -1
+SELECT strcmp('a\0','a '), strcmp('a ','a\0');
+strcmp('a\0','a ') strcmp('a ','a\0')
+1 -1
+SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
+strcmp('a\t','a' ) strcmp('a', 'a\t')
+0 0
+SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
+strcmp('a\t','a ') strcmp('a ', 'a\t')
+0 0
#
# MDEV-7149 Constant condition propagation erroneously applied for LIKE
#
@@ -484,21 +484,21 @@ DROP TABLE t1;
# WL#3664 WEIGHT_STRING
#
set names latin2 collate latin2_czech_cs;
-SELECT strcmp('a','a ');
-strcmp('a','a ')
-0
-SELECT strcmp('a\0','a' );
-strcmp('a\0','a' )
-1
-SELECT strcmp('a\0','a ');
-strcmp('a\0','a ')
-1
-SELECT strcmp('a\t','a' );
-strcmp('a\t','a' )
-0
-SELECT strcmp('a\t','a ');
-strcmp('a\t','a ')
-0
+SELECT strcmp('a','a '), strcmp('a ','a');
+strcmp('a','a ') strcmp('a ','a')
+0 0
+SELECT strcmp('a\0','a' ), strcmp('a','a\0');
+strcmp('a\0','a' ) strcmp('a','a\0')
+1 -1
+SELECT strcmp('a\0','a '), strcmp('a ','a\0');
+strcmp('a\0','a ') strcmp('a ','a\0')
+1 -1
+SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
+strcmp('a\t','a' ) strcmp('a', 'a\t')
+0 0
+SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
+strcmp('a\t','a ') strcmp('a ', 'a\t')
+0 0
#
# Note:
# latin2_czech_cs does not support WEIGHT_STRING in full extent
diff --git a/mysql-test/r/ctype_tis620.result b/mysql-test/r/ctype_tis620.result
index 947aeb5ff5b..7c13aad40a0 100644
--- a/mysql-test/r/ctype_tis620.result
+++ b/mysql-test/r/ctype_tis620.result
@@ -3630,6 +3630,21 @@ hex(weight_string('abc' as char(5) LEVEL 1 DESC))
select hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE));
hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE))
DFDF9C9D9E
+SELECT strcmp('a','a '), strcmp('a ','a');
+strcmp('a','a ') strcmp('a ','a')
+0 0
+SELECT strcmp('a\0','a' ), strcmp('a','a\0');
+strcmp('a\0','a' ) strcmp('a','a\0')
+-1 1
+SELECT strcmp('a\0','a '), strcmp('a ','a\0');
+strcmp('a\0','a ') strcmp('a ','a\0')
+-1 1
+SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
+strcmp('a\t','a' ) strcmp('a', 'a\t')
+-1 1
+SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
+strcmp('a\t','a ') strcmp('a ', 'a\t')
+-1 1
select hex(weight_string(cast(0xE0A1 as char)));
hex(weight_string(cast(0xE0A1 as char)))
A1E0
@@ -3808,6 +3823,21 @@ hex(weight_string('abc' as char(5) LEVEL 1 DESC))
select hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE));
hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE))
DFDF9C9D9E
+SELECT strcmp('a','a '), strcmp('a ','a');
+strcmp('a','a ') strcmp('a ','a')
+0 0
+SELECT strcmp('a\0','a' ), strcmp('a','a\0');
+strcmp('a\0','a' ) strcmp('a','a\0')
+-1 1
+SELECT strcmp('a\0','a '), strcmp('a ','a\0');
+strcmp('a\0','a ') strcmp('a ','a\0')
+-1 1
+SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
+strcmp('a\t','a' ) strcmp('a', 'a\t')
+-1 1
+SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
+strcmp('a\t','a ') strcmp('a ', 'a\t')
+-1 1
select hex(weight_string(cast(0xE0A1 as char)));
hex(weight_string(cast(0xE0A1 as char)))
E0A1
diff --git a/mysql-test/t/ctype_big5.test b/mysql-test/t/ctype_big5.test
index 46bb29514ff..629db68f62f 100644
--- a/mysql-test/t/ctype_big5.test
+++ b/mysql-test/t/ctype_big5.test
@@ -18,11 +18,13 @@ SET collation_connection='big5_chinese_ci';
-- source include/ctype_like_escape.inc
-- source include/ctype_like_range_f1f2.inc
-- source include/ctype_ascii_order.inc
+-- source include/ctype_pad_space.inc
SET collation_connection='big5_bin';
-- source include/ctype_filesort.inc
-- source include/ctype_innodb_like.inc
-- source include/ctype_like_escape.inc
-- source include/ctype_like_range_f1f2.inc
+-- source include/ctype_pad_space.inc
#
# Bugs#9357: TEXT columns break string with special word in BIG5 charset.
diff --git a/mysql-test/t/ctype_cp1251.test b/mysql-test/t/ctype_cp1251.test
index 93fd5cc9a1a..97978463407 100644
--- a/mysql-test/t/ctype_cp1251.test
+++ b/mysql-test/t/ctype_cp1251.test
@@ -65,6 +65,7 @@ DROP TABLE t1;
--echo #
--source include/ctype_8bit.inc
+--source include/ctype_pad_space.inc
#
# Bug #48053 String::c_ptr has a race and/or does an invalid
diff --git a/mysql-test/t/ctype_latin1.test b/mysql-test/t/ctype_latin1.test
index a30c7ae9a5d..d82a5b88418 100644
--- a/mysql-test/t/ctype_latin1.test
+++ b/mysql-test/t/ctype_latin1.test
@@ -87,9 +87,11 @@ SET collation_connection='latin1_swedish_ci';
-- source include/ctype_filesort.inc
-- source include/ctype_like_escape.inc
-- source include/ctype_str_to_date.inc
+-- source include/ctype_pad_space.inc
SET collation_connection='latin1_bin';
-- source include/ctype_filesort.inc
-- source include/ctype_like_escape.inc
+-- source include/ctype_pad_space.inc
#
# Bug#8041
diff --git a/mysql-test/t/ctype_tis620.test b/mysql-test/t/ctype_tis620.test
index ba5db9df54f..4909acee31d 100644
--- a/mysql-test/t/ctype_tis620.test
+++ b/mysql-test/t/ctype_tis620.test
@@ -178,12 +178,14 @@ set names tis620;
set collation_connection=tis620_thai_ci;
--source include/weight_string.inc
--source include/weight_string_l1.inc
+--source include/ctype_pad_space.inc
select hex(weight_string(cast(0xE0A1 as char)));
select hex(weight_string(cast(0xE0A1 as char) as char(1)));
set collation_connection=tis620_bin;
--source include/weight_string.inc
--source include/weight_string_l1.inc
+--source include/ctype_pad_space.inc
select hex(weight_string(cast(0xE0A1 as char)));
select hex(weight_string(cast(0xE0A1 as char) as char(1)));
diff --git a/mysys/my_compare.c b/mysys/my_compare.c
index 6de7ff774c0..3c21d74a8a4 100644
--- a/mysys/my_compare.c
+++ b/mysys/my_compare.c
@@ -21,12 +21,11 @@
#include <my_sys.h>
int ha_compare_text(CHARSET_INFO *charset_info, const uchar *a, uint a_length,
- const uchar *b, uint b_length, my_bool part_key,
- my_bool skip_end_space)
+ const uchar *b, uint b_length, my_bool part_key)
{
if (!part_key)
return charset_info->coll->strnncollsp(charset_info, a, a_length,
- b, b_length, (my_bool)!skip_end_space);
+ b, b_length);
return charset_info->coll->strnncoll(charset_info, a, a_length,
b, b_length, part_key);
}
@@ -186,8 +185,7 @@ int ha_key_cmp(HA_KEYSEG *keyseg, const uchar *a,
if (piks &&
(flag=ha_compare_text(keyseg->charset,a,a_length,b,b_length,
(my_bool) ((nextflag & SEARCH_PREFIX) &&
- next_key_length <= 0),
- (my_bool)!(nextflag & SEARCH_PREFIX))))
+ next_key_length <= 0))))
return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag);
a+=a_length;
b+=b_length;
@@ -199,8 +197,7 @@ int ha_key_cmp(HA_KEYSEG *keyseg, const uchar *a,
if (piks &&
(flag= ha_compare_text(keyseg->charset, a, a_length, b, b_length,
(my_bool) ((nextflag & SEARCH_PREFIX) &&
- next_key_length <= 0),
- (my_bool)!(nextflag & SEARCH_PREFIX))))
+ next_key_length <= 0))))
return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag);
a=end;
b+=length;
@@ -247,12 +244,7 @@ int ha_key_cmp(HA_KEYSEG *keyseg, const uchar *a,
if (piks &&
(flag= ha_compare_text(keyseg->charset,a,a_length,b,b_length,
(my_bool) ((nextflag & SEARCH_PREFIX) &&
- next_key_length <= 0),
- (my_bool) ((nextflag & (SEARCH_FIND |
- SEARCH_UPDATE)) ==
- SEARCH_FIND &&
- ! (keyseg->flag &
- HA_END_SPACE_ARE_EQUAL)))))
+ next_key_length <= 0))))
return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag);
a+= a_length;
b+= b_length;
diff --git a/sql/events.cc b/sql/events.cc
index f428bc17927..5ef4d6f55a5 100644
--- a/sql/events.cc
+++ b/sql/events.cc
@@ -102,7 +102,7 @@ ulong Events::inited;
int sortcmp_lex_string(LEX_STRING s, LEX_STRING t, CHARSET_INFO *cs)
{
return cs->coll->strnncollsp(cs, (uchar *) s.str,s.length,
- (uchar *) t.str,t.length, 0);
+ (uchar *) t.str,t.length);
}
diff --git a/sql/field.cc b/sql/field.cc
index 6be45005d48..cf5be38398f 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -7136,8 +7136,7 @@ int Field_string::cmp(const uchar *a_ptr, const uchar *b_ptr)
*/
return field_charset->coll->strnncollsp(field_charset,
a_ptr, a_len,
- b_ptr, b_len,
- 0);
+ b_ptr, b_len);
}
@@ -7511,7 +7510,7 @@ int Field_varstring::cmp_max(const uchar *a_ptr, const uchar *b_ptr,
a_length,
b_ptr+
length_bytes,
- b_length,0);
+ b_length);
return diff;
}
@@ -7534,7 +7533,7 @@ int Field_varstring::key_cmp(const uchar *key_ptr, uint max_key_length)
length,
key_ptr+
HA_KEY_BLOB_LENGTH,
- uint2korr(key_ptr), 0);
+ uint2korr(key_ptr));
}
@@ -7552,8 +7551,7 @@ int Field_varstring::key_cmp(const uchar *a,const uchar *b)
a + HA_KEY_BLOB_LENGTH,
uint2korr(a),
b + HA_KEY_BLOB_LENGTH,
- uint2korr(b),
- 0);
+ uint2korr(b));
}
@@ -8053,8 +8051,7 @@ int Field_blob::cmp(const uchar *a,uint32 a_length, const uchar *b,
uint32 b_length)
{
return field_charset->coll->strnncollsp(field_charset,
- a, a_length, b, b_length,
- 0);
+ a, a_length, b, b_length);
}
diff --git a/sql/item.h b/sql/item.h
index d67a29dee5a..e42442aa301 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -187,7 +187,7 @@ public:
{
return collation->coll->strnncollsp(collation,
(uchar *) s->ptr(), s->length(),
- (uchar *) t->ptr(), t->length(), 0);
+ (uchar *) t->ptr(), t->length());
}
};
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 01dcfb39e0e..579cdc10057 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -4074,7 +4074,7 @@ static int srtcmp_in(CHARSET_INFO *cs, const String *x,const String *y)
{
return cs->coll->strnncollsp(cs,
(uchar *) x->ptr(),x->length(),
- (uchar *) y->ptr(),y->length(), 0);
+ (uchar *) y->ptr(),y->length());
}
void Item_func_in::fix_length_and_dec()
diff --git a/sql/key.cc b/sql/key.cc
index 1b00e951de0..31b65adabe9 100644
--- a/sql/key.cc
+++ b/sql/key.cc
@@ -328,7 +328,7 @@ bool key_cmp_if_same(TABLE *table,const uchar *key,uint idx,uint key_length)
}
if (cs->coll->strnncollsp(cs,
(const uchar*) key, length,
- (const uchar*) pos, char_length, 0))
+ (const uchar*) pos, char_length))
return 1;
continue;
}
@@ -891,8 +891,7 @@ bool key_buf_cmp(KEY *key_info, uint used_key_parts,
if (length1 != length2 ||
cs->coll->strnncollsp(cs,
pos1 + pack_length, byte_len1,
- pos2 + pack_length, byte_len2,
- 1))
+ pos2 + pack_length, byte_len2))
return TRUE;
key1+= pack_length; key2+= pack_length;
}
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index e53e2a9ee0d..79b28a5994e 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -4175,7 +4175,6 @@ SJ_TMP_TABLE::create_sj_weedout_tmp_table(THD *thd)
field->null_ptr,
field->null_bit)))
goto err;
- key_part_info->key_part_flag|= HA_END_SPACE_ARE_EQUAL; //todo need this?
}
keyinfo->key_length+= key_part_info->length;
}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index c1916aae58a..3134f8eb007 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -16725,8 +16725,6 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
cur_group->buff++; // Pointer to field data
group_buff++; // Skipp null flag
}
- /* In GROUP BY 'a' and 'a ' are equal for VARCHAR fields */
- key_part_info->key_part_flag|= HA_END_SPACE_ARE_EQUAL;
group_buff+= cur_group->field->pack_length();
}
keyinfo->key_length+= key_part_info->length;
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 00881adff1d..aa2b47fa4b7 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -3524,7 +3524,7 @@ bool get_lookup_value(THD *thd, Item_func *item_func,
/* Lookup value is database name */
if (!cs->coll->strnncollsp(cs, (uchar *) field_name1, strlen(field_name1),
(uchar *) item_field->field_name,
- strlen(item_field->field_name), 0))
+ strlen(item_field->field_name)))
{
thd->make_lex_string(&lookup_field_vals->db_value,
tmp_str->ptr(), tmp_str->length());
@@ -3533,7 +3533,7 @@ bool get_lookup_value(THD *thd, Item_func *item_func,
else if (!cs->coll->strnncollsp(cs, (uchar *) field_name2,
strlen(field_name2),
(uchar *) item_field->field_name,
- strlen(item_field->field_name), 0))
+ strlen(item_field->field_name)))
{
thd->make_lex_string(&lookup_field_vals->table_value,
tmp_str->ptr(), tmp_str->length());
@@ -3619,10 +3619,10 @@ bool uses_only_table_name_fields(Item *item, TABLE_LIST *table)
if (table->table != item_field->field->table ||
(cs->coll->strnncollsp(cs, (uchar *) field_name1, strlen(field_name1),
(uchar *) item_field->field_name,
- strlen(item_field->field_name), 0) &&
+ strlen(item_field->field_name)) &&
cs->coll->strnncollsp(cs, (uchar *) field_name2, strlen(field_name2),
(uchar *) item_field->field_name,
- strlen(item_field->field_name), 0)))
+ strlen(item_field->field_name))))
return 0;
}
else if (item->type() == Item::REF_ITEM)
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index 20772adcb22..40339d599af 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -759,7 +759,7 @@ int sortcmp(const String *s,const String *t, CHARSET_INFO *cs)
{
return cs->coll->strnncollsp(cs,
(uchar *) s->ptr(),s->length(),
- (uchar *) t->ptr(),t->length(), 0);
+ (uchar *) t->ptr(),t->length());
}
diff --git a/sql/strfunc.cc b/sql/strfunc.cc
index b8100e05ce5..bf5fe9d6f00 100644
--- a/sql/strfunc.cc
+++ b/sql/strfunc.cc
@@ -337,7 +337,7 @@ int find_string_in_array(LEX_STRING * const haystack, LEX_STRING * const needle,
const LEX_STRING *pos;
for (pos= haystack; pos->str; pos++)
if (!cs->coll->strnncollsp(cs, (uchar *) pos->str, pos->length,
- (uchar *) needle->str, needle->length, 0))
+ (uchar *) needle->str, needle->length))
{
return (pos - haystack);
}
diff --git a/storage/heap/heapdef.h b/storage/heap/heapdef.h
index d5c0ad96b05..8706819c182 100644
--- a/storage/heap/heapdef.h
+++ b/storage/heap/heapdef.h
@@ -86,8 +86,7 @@ extern ulong hp_mask(ulong hashnr,ulong buffmax,ulong maxlength);
extern void hp_movelink(HASH_INFO *pos,HASH_INFO *next_link,
HASH_INFO *newlink);
extern int hp_rec_key_cmp(HP_KEYDEF *keydef,const uchar *rec1,
- const uchar *rec2,
- my_bool diff_if_only_endspace_difference);
+ const uchar *rec2);
extern int hp_key_cmp(HP_KEYDEF *keydef,const uchar *rec,
const uchar *key);
extern void hp_make_key(HP_KEYDEF *keydef,uchar *key,const uchar *rec);
diff --git a/storage/heap/hp_delete.c b/storage/heap/hp_delete.c
index 0c1c2c4c8f8..12f2c65f00b 100644
--- a/storage/heap/hp_delete.c
+++ b/storage/heap/hp_delete.c
@@ -123,7 +123,7 @@ int hp_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo,
while (pos->ptr_to_rec != recpos)
{
- if (flag && !hp_rec_key_cmp(keyinfo, record, pos->ptr_to_rec, 0))
+ if (flag && !hp_rec_key_cmp(keyinfo, record, pos->ptr_to_rec))
last_ptr=pos; /* Previous same key */
gpos=pos;
if (!(pos=pos->next_key))
diff --git a/storage/heap/hp_hash.c b/storage/heap/hp_hash.c
index b727c71d3de..eaf284c2015 100644
--- a/storage/heap/hp_hash.c
+++ b/storage/heap/hp_hash.c
@@ -513,8 +513,6 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const uchar *rec)
keydef Key definition
rec1 Record to compare
rec2 Other record to compare
- diff_if_only_endspace_difference
- Different number of end space is significant
NOTES
diff_if_only_endspace_difference is used to allow us to insert
@@ -525,8 +523,7 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const uchar *rec)
<> 0 Key differes
*/
-int hp_rec_key_cmp(HP_KEYDEF *keydef, const uchar *rec1, const uchar *rec2,
- my_bool diff_if_only_endspace_difference)
+int hp_rec_key_cmp(HP_KEYDEF *keydef, const uchar *rec1, const uchar *rec2)
{
HA_KEYSEG *seg,*endseg;
@@ -561,7 +558,7 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const uchar *rec1, const uchar *rec2,
}
if (seg->charset->coll->strnncollsp(seg->charset,
pos1,char_length1,
- pos2,char_length2, 0))
+ pos2,char_length2))
return 1;
}
else if (seg->type == HA_KEYTYPE_VARTEXT1) /* Any VARCHAR segments */
@@ -601,9 +598,7 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const uchar *rec1, const uchar *rec2,
if (cs->coll->strnncollsp(seg->charset,
pos1, char_length1,
- pos2, char_length2,
- seg->flag & HA_END_SPACE_ARE_EQUAL ?
- 0 : diff_if_only_endspace_difference))
+ pos2, char_length2))
return 1;
}
else
@@ -671,7 +666,7 @@ int hp_key_cmp(HP_KEYDEF *keydef, const uchar *rec, const uchar *key)
if (seg->charset->coll->strnncollsp(seg->charset,
(uchar*) pos, char_length_rec,
- (uchar*) key, char_length_key, 0))
+ (uchar*) key, char_length_key))
return 1;
}
else if (seg->type == HA_KEYTYPE_VARTEXT1) /* Any VARCHAR segments */
@@ -699,7 +694,7 @@ int hp_key_cmp(HP_KEYDEF *keydef, const uchar *rec, const uchar *key)
if (cs->coll->strnncollsp(seg->charset,
(uchar*) pos, char_length_rec,
- (uchar*) key, char_length_key, 0))
+ (uchar*) key, char_length_key))
return 1;
}
else
diff --git a/storage/heap/hp_update.c b/storage/heap/hp_update.c
index 8757f8e87c5..7afd7f61788 100644
--- a/storage/heap/hp_update.c
+++ b/storage/heap/hp_update.c
@@ -37,7 +37,7 @@ int heap_update(HP_INFO *info, const uchar *old, const uchar *heap_new)
p_lastinx= share->keydef + info->lastinx;
for (keydef= share->keydef, end= keydef + share->keys; keydef < end; keydef++)
{
- if (hp_rec_key_cmp(keydef, old, heap_new, 0))
+ if (hp_rec_key_cmp(keydef, old, heap_new))
{
if ((*keydef->delete_key)(info, keydef, old, pos, keydef == p_lastinx) ||
(*keydef->write_key)(info, keydef, heap_new, pos))
@@ -76,7 +76,7 @@ int heap_update(HP_INFO *info, const uchar *old, const uchar *heap_new)
}
while (keydef >= share->keydef)
{
- if (hp_rec_key_cmp(keydef, old, heap_new, 0))
+ if (hp_rec_key_cmp(keydef, old, heap_new))
{
if ((*keydef->delete_key)(info, keydef, heap_new, pos, 0) ||
(*keydef->write_key)(info, keydef, old, pos))
diff --git a/storage/heap/hp_write.c b/storage/heap/hp_write.c
index a1d81fd808d..392662f69ae 100644
--- a/storage/heap/hp_write.c
+++ b/storage/heap/hp_write.c
@@ -386,7 +386,7 @@ int hp_write_key(HP_INFO *info, HP_KEYDEF *keyinfo,
do
{
if (pos->hash_of_key == hash_of_key &&
- ! hp_rec_key_cmp(keyinfo, record, pos->ptr_to_rec, 1))
+ ! hp_rec_key_cmp(keyinfo, record, pos->ptr_to_rec))
{
DBUG_RETURN(my_errno=HA_ERR_FOUND_DUPP_KEY);
}
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 5edb6dc5190..150f21ad8ae 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -6339,7 +6339,7 @@ innobase_mysql_cmp(
having indexes on such data need to rebuild their tables! */
ret = charset->coll->strnncollsp(
- charset, a, a_length, b, b_length, 0);
+ charset, a, a_length, b, b_length);
if (ret < 0) {
return(-1);
@@ -6433,7 +6433,7 @@ innobase_mysql_cmp_prefix(
charset = innobase_get_fts_charset(mysql_type, charset_number);
result = ha_compare_text(charset, (uchar*) a, a_length,
- (uchar*) b, b_length, 1, 0);
+ (uchar*) b, b_length, 1);
return(result);
}
@@ -6453,7 +6453,7 @@ innobase_fts_text_cmp(
return(ha_compare_text(
charset, s1->f_str, static_cast<uint>(s1->f_len),
- s2->f_str, static_cast<uint>(s2->f_len), 0, 0));
+ s2->f_str, static_cast<uint>(s2->f_len), 0));
}
/******************************************************************//**
compare two character string case insensitively according to their charset. */
@@ -6476,7 +6476,7 @@ innobase_fts_text_case_cmp(
return(ha_compare_text(
charset, s1->f_str, static_cast<uint>(s1->f_len),
- s2->f_str, static_cast<uint>(newlen), 0, 0));
+ s2->f_str, static_cast<uint>(newlen), 0));
}
/******************************************************************//**
Get the first character's code position for FTS index partition. */
@@ -6524,7 +6524,7 @@ innobase_fts_text_cmp_prefix(
result = ha_compare_text(
charset, s2->f_str, static_cast<uint>(s2->f_len),
- s1->f_str, static_cast<uint>(s1->f_len), 1, 0);
+ s1->f_str, static_cast<uint>(s1->f_len), 1);
/* We switched s1, s2 position in ha_compare_text. So we need
to negate the result */
diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c
index 5035df26b18..89b1a733fc9 100644
--- a/storage/maria/ma_check.c
+++ b/storage/maria/ma_check.c
@@ -5642,7 +5642,7 @@ static int sort_maria_ft_key_write(MARIA_SORT_PARAM *sort_param,
if (ha_compare_text(sort_param->seg->charset,
a+1,a_len-1,
- ft_buf->lastkey+1,val_off-1, 0, 0)==0)
+ ft_buf->lastkey+1,val_off-1, 0)==0)
{
uchar *p;
if (!ft_buf->buf) /* store in second-level tree */
diff --git a/storage/maria/ma_ft_boolean_search.c b/storage/maria/ma_ft_boolean_search.c
index af2ad6f1ba9..2d7989821fb 100644
--- a/storage/maria/ma_ft_boolean_search.c
+++ b/storage/maria/ma_ft_boolean_search.c
@@ -163,7 +163,7 @@ static int FTB_WORD_cmp_list(CHARSET_INFO *cs, FTB_WORD **a, FTB_WORD **b)
{
/* ORDER BY word, ndepth */
int i= ha_compare_text(cs, (uchar*) (*a)->word + 1,(*a)->len - 1,
- (uchar*) (*b)->word + 1,(*b)->len - 1, 0, 0);
+ (uchar*) (*b)->word + 1,(*b)->len - 1, 0);
if (!i)
i=CMP_NUM((*a)->ndepth, (*b)->ndepth);
return i;
@@ -413,7 +413,7 @@ static int _ft2_search_no_lock(FTB *ftb, FTB_WORD *ftbw, my_bool init_search)
extra-1,
(uchar*) ftbw->word+1,
ftbw->len-1,
- (my_bool) (ftbw->flags & FTB_FLAG_TRUNC), 0);
+ (my_bool) (ftbw->flags & FTB_FLAG_TRUNC));
}
if (r) /* not found */
@@ -905,7 +905,7 @@ static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param,
ftbw= ftb->list[c];
if (ha_compare_text(ftb->charset, (uchar*)word, len,
(uchar*)ftbw->word+1, ftbw->len-1,
- (my_bool)(ftbw->flags&FTB_FLAG_TRUNC), 0) < 0)
+ (my_bool)(ftbw->flags&FTB_FLAG_TRUNC)) < 0)
b= c;
else
a= c;
@@ -932,7 +932,7 @@ static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param,
ftbw= ftb->list[c];
if (ha_compare_text(ftb->charset, (uchar*)word, len,
(uchar*)ftbw->word + 1,ftbw->len - 1,
- (my_bool)(ftbw->flags & FTB_FLAG_TRUNC), 0))
+ (my_bool)(ftbw->flags & FTB_FLAG_TRUNC)))
{
if (ftb->with_scan & FTB_FLAG_TRUNC)
continue;
diff --git a/storage/maria/ma_ft_nlq_search.c b/storage/maria/ma_ft_nlq_search.c
index 5eb916112d7..6a148643428 100644
--- a/storage/maria/ma_ft_nlq_search.c
+++ b/storage/maria/ma_ft_nlq_search.c
@@ -119,7 +119,7 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
info->last_key.data+1,
info->last_key.data_length +
info->last_key.ref_length - extra - 1,
- key.data+1, key.data_length-1, 0, 0))
+ key.data+1, key.data_length-1, 0))
break;
if (subkeys.i < 0)
diff --git a/storage/maria/ma_ft_parser.c b/storage/maria/ma_ft_parser.c
index 81b5ea5119c..84a92a011c0 100644
--- a/storage/maria/ma_ft_parser.c
+++ b/storage/maria/ma_ft_parser.c
@@ -34,7 +34,7 @@ typedef struct st_my_maria_ft_parser_param
static int FT_WORD_cmp(CHARSET_INFO* cs, FT_WORD *w1, FT_WORD *w2)
{
return ha_compare_text(cs, (uchar*) w1->pos, w1->len,
- (uchar*) w2->pos, w2->len, 0, 0);
+ (uchar*) w2->pos, w2->len, 0);
}
static int walk_and_copy(FT_WORD *word,uint32 count,FT_DOCSTAT *docstat)
diff --git a/storage/maria/ma_ft_update.c b/storage/maria/ma_ft_update.c
index 99748c65ebf..a166b7b21fb 100644
--- a/storage/maria/ma_ft_update.c
+++ b/storage/maria/ma_ft_update.c
@@ -184,7 +184,7 @@ int _ma_ft_cmp(MARIA_HA *info, uint keynr, const uchar *rec1, const uchar *rec2)
if ((ftsi1.pos != ftsi2.pos) &&
(!ftsi1.pos || !ftsi2.pos ||
ha_compare_text(cs, ftsi1.pos,ftsi1.len,
- ftsi2.pos,ftsi2.len,0,0)))
+ ftsi2.pos,ftsi2.len,0)))
DBUG_RETURN(THOSE_TWO_DAMN_KEYS_ARE_REALLY_DIFFERENT);
}
DBUG_RETURN(GEE_THEY_ARE_ABSOLUTELY_IDENTICAL);
@@ -212,7 +212,7 @@ int _ma_ft_update(MARIA_HA *info, uint keynr, uchar *keybuf,
while(old_word->pos && new_word->pos)
{
cmp= ha_compare_text(cs, (uchar*) old_word->pos,old_word->len,
- (uchar*) new_word->pos,new_word->len,0,0);
+ (uchar*) new_word->pos,new_word->len,0);
cmp2= cmp ? 0 : (fabs(old_word->weight - new_word->weight) > 1.e-5);
if (cmp < 0 || cmp2)
diff --git a/storage/maria/ma_unique.c b/storage/maria/ma_unique.c
index fd823f7b52d..ec22a7a0112 100644
--- a/storage/maria/ma_unique.c
+++ b/storage/maria/ma_unique.c
@@ -238,7 +238,7 @@ my_bool _ma_unique_comp(MARIA_UNIQUEDEF *def, const uchar *a, const uchar *b,
type == HA_KEYTYPE_VARTEXT2)
{
if (ha_compare_text(keyseg->charset, pos_a, a_length,
- pos_b, b_length, 0, 1))
+ pos_b, b_length, 0))
return 1;
}
else
diff --git a/storage/maria/ma_write.c b/storage/maria/ma_write.c
index f57c462e7c0..63bbdf83854 100644
--- a/storage/maria/ma_write.c
+++ b/storage/maria/ma_write.c
@@ -880,7 +880,7 @@ ChangeSet@1.2562, 2008-04-09 07:41:40+02:00, serg@janus.mylan +9 -0
DBUG_ASSERT(info->ft1_to_ft2==0);
if (alen == blen &&
ha_compare_text(keyinfo->seg->charset, a, alen,
- b, blen, 0, 0) == 0)
+ b, blen, 0) == 0)
{
/* Yup. converting */
info->ft1_to_ft2=(DYNAMIC_ARRAY *)
diff --git a/storage/myisam/ft_boolean_search.c b/storage/myisam/ft_boolean_search.c
index 6befe3b2d7a..3b403a41c4c 100644
--- a/storage/myisam/ft_boolean_search.c
+++ b/storage/myisam/ft_boolean_search.c
@@ -163,7 +163,7 @@ static int FTB_WORD_cmp_list(CHARSET_INFO *cs, FTB_WORD **a, FTB_WORD **b)
{
/* ORDER BY word, ndepth */
int i= ha_compare_text(cs, (uchar*) (*a)->word + 1, (*a)->len - 1,
- (uchar*) (*b)->word + 1, (*b)->len - 1, 0, 0);
+ (uchar*) (*b)->word + 1, (*b)->len - 1, 0);
if (!i)
i= CMP_NUM((*a)->ndepth, (*b)->ndepth);
return i;
@@ -416,7 +416,7 @@ static int _ft2_search_no_lock(FTB *ftb, FTB_WORD *ftbw, my_bool init_search)
info->lastkey_length-extra-1,
(uchar*) ftbw->word+1,
ftbw->len-1,
- (my_bool) (ftbw->flags & FTB_FLAG_TRUNC),0);
+ (my_bool) (ftbw->flags & FTB_FLAG_TRUNC));
}
if (r) /* not found */
@@ -913,7 +913,7 @@ static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param,
ftbw= ftb->list[c];
if (ha_compare_text(ftb->charset, (uchar*)word, len,
(uchar*)ftbw->word+1, ftbw->len-1,
- (my_bool) (ftbw->flags & FTB_FLAG_TRUNC), 0) < 0)
+ (my_bool) (ftbw->flags & FTB_FLAG_TRUNC)) < 0)
b= c;
else
a= c;
@@ -940,7 +940,7 @@ static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param,
ftbw= ftb->list[c];
if (ha_compare_text(ftb->charset, (uchar*)word, len,
(uchar*)ftbw->word + 1,ftbw->len - 1,
- (my_bool)(ftbw->flags & FTB_FLAG_TRUNC), 0))
+ (my_bool)(ftbw->flags & FTB_FLAG_TRUNC)))
{
if (ftb->with_scan & FTB_FLAG_TRUNC)
continue;
diff --git a/storage/myisam/ft_nlq_search.c b/storage/myisam/ft_nlq_search.c
index 9524b6f1833..d9a9a03919e 100644
--- a/storage/myisam/ft_nlq_search.c
+++ b/storage/myisam/ft_nlq_search.c
@@ -114,7 +114,7 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
if (keylen &&
ha_compare_text(aio->charset,info->lastkey+1,
- info->lastkey_length-extra-1, keybuff+1,keylen-1,0,0))
+ info->lastkey_length-extra-1, keybuff+1,keylen-1,0))
break;
if (subkeys.i < 0)
diff --git a/storage/myisam/ft_parser.c b/storage/myisam/ft_parser.c
index 5612b4bec14..c8d99b68e8a 100644
--- a/storage/myisam/ft_parser.c
+++ b/storage/myisam/ft_parser.c
@@ -32,7 +32,7 @@ typedef struct st_my_ft_parser_param
static int FT_WORD_cmp(CHARSET_INFO* cs, FT_WORD *w1, FT_WORD *w2)
{
return ha_compare_text(cs, (uchar*) w1->pos, w1->len,
- (uchar*) w2->pos, w2->len, 0, 0);
+ (uchar*) w2->pos, w2->len, 0);
}
static int walk_and_copy(FT_WORD *word,uint32 count,FT_DOCSTAT *docstat)
diff --git a/storage/myisam/ft_stopwords.c b/storage/myisam/ft_stopwords.c
index 7b2d520a65a..3bf31bf3d66 100644
--- a/storage/myisam/ft_stopwords.c
+++ b/storage/myisam/ft_stopwords.c
@@ -35,7 +35,7 @@ static int FT_STOPWORD_cmp(void* cmp_arg __attribute__((unused)),
{
return ha_compare_text(ft_stopword_cs,
(uchar *)w1->pos,w1->len,
- (uchar *)w2->pos,w2->len,0,0);
+ (uchar *)w2->pos,w2->len,0);
}
static void FT_STOPWORD_free(FT_STOPWORD *w, TREE_FREE action,
diff --git a/storage/myisam/ft_update.c b/storage/myisam/ft_update.c
index 19144ff01fb..10a36650b0a 100644
--- a/storage/myisam/ft_update.c
+++ b/storage/myisam/ft_update.c
@@ -180,7 +180,7 @@ int _mi_ft_cmp(MI_INFO *info, uint keynr, const uchar *rec1, const uchar *rec2)
if ((ftsi1.pos != ftsi2.pos) &&
(!ftsi1.pos || !ftsi2.pos ||
ha_compare_text(cs, (uchar*) ftsi1.pos,ftsi1.len,
- (uchar*) ftsi2.pos,ftsi2.len,0,0)))
+ (uchar*) ftsi2.pos,ftsi2.len,0)))
DBUG_RETURN(THOSE_TWO_DAMN_KEYS_ARE_REALLY_DIFFERENT);
}
DBUG_RETURN(GEE_THEY_ARE_ABSOLUTELY_IDENTICAL);
@@ -209,7 +209,7 @@ int _mi_ft_update(MI_INFO *info, uint keynr, uchar *keybuf,
while(old_word->pos && new_word->pos)
{
cmp= ha_compare_text(cs, (uchar*) old_word->pos,old_word->len,
- (uchar*) new_word->pos,new_word->len,0,0);
+ (uchar*) new_word->pos,new_word->len,0);
cmp2= cmp ? 0 : (fabs(old_word->weight - new_word->weight) > 1.e-5);
if (cmp < 0 || cmp2)
diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c
index bab0ad2b6a4..57ac5bdca97 100644
--- a/storage/myisam/mi_check.c
+++ b/storage/myisam/mi_check.c
@@ -3939,7 +3939,7 @@ static int sort_ft_key_write(MI_SORT_PARAM *sort_param, const void *a)
if (ha_compare_text(sort_param->seg->charset,
((uchar *)a)+1,a_len-1,
- (uchar*) ft_buf->lastkey+1,val_off-1, 0, 0)==0)
+ (uchar*) ft_buf->lastkey+1,val_off-1, 0)==0)
{
if (!ft_buf->buf) /* store in second-level tree */
{
diff --git a/storage/myisam/mi_unique.c b/storage/myisam/mi_unique.c
index cdf3e618275..5192d404939 100644
--- a/storage/myisam/mi_unique.c
+++ b/storage/myisam/mi_unique.c
@@ -214,7 +214,7 @@ int mi_unique_comp(MI_UNIQUEDEF *def, const uchar *a, const uchar *b,
type == HA_KEYTYPE_VARTEXT2)
{
if (ha_compare_text(keyseg->charset, (uchar *) pos_a, a_length,
- (uchar *) pos_b, b_length, 0, 1))
+ (uchar *) pos_b, b_length, 0))
return 1;
}
else
diff --git a/storage/myisam/mi_write.c b/storage/myisam/mi_write.c
index ff96ee8751b..ff12f335af1 100644
--- a/storage/myisam/mi_write.c
+++ b/storage/myisam/mi_write.c
@@ -543,7 +543,7 @@ int _mi_insert(register MI_INFO *info, register MI_KEYDEF *keyinfo,
get_key_length(alen,a);
DBUG_ASSERT(info->ft1_to_ft2==0);
if (alen == blen &&
- ha_compare_text(keyinfo->seg->charset, a, alen, b, blen, 0, 0)==0)
+ ha_compare_text(keyinfo->seg->charset, a, alen, b, blen, 0)==0)
{
/* yup. converting */
info->ft1_to_ft2=(DYNAMIC_ARRAY *)
diff --git a/storage/tokudb/hatoku_cmp.cc b/storage/tokudb/hatoku_cmp.cc
index be0ea1e3ff3..606a771eb30 100644
--- a/storage/tokudb/hatoku_cmp.cc
+++ b/storage/tokudb/hatoku_cmp.cc
@@ -921,8 +921,7 @@ static inline int cmp_toku_string(
a_buf,
a_num_bytes,
b_buf,
- b_num_bytes,
- 0
+ b_num_bytes
);
return ret_val;
}
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index b6d259c8bda..df0f74fbb92 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -6675,7 +6675,7 @@ innobase_mysql_cmp(
having indexes on such data need to rebuild their tables! */
ret = charset->coll->strnncollsp(
- charset, a, a_length, b, b_length, 0);
+ charset, a, a_length, b, b_length);
if (ret < 0) {
return(-1);
@@ -6769,7 +6769,7 @@ innobase_mysql_cmp_prefix(
charset = innobase_get_fts_charset(mysql_type, charset_number);
result = ha_compare_text(charset, (uchar*) a, a_length,
- (uchar*) b, b_length, 1, 0);
+ (uchar*) b, b_length, 1);
return(result);
}
@@ -6789,7 +6789,7 @@ innobase_fts_text_cmp(
return(ha_compare_text(
charset, s1->f_str, static_cast<uint>(s1->f_len),
- s2->f_str, static_cast<uint>(s2->f_len), 0, 0));
+ s2->f_str, static_cast<uint>(s2->f_len), 0));
}
/******************************************************************//**
compare two character string case insensitively according to their charset. */
@@ -6812,7 +6812,7 @@ innobase_fts_text_case_cmp(
return(ha_compare_text(
charset, s1->f_str, static_cast<uint>(s1->f_len),
- s2->f_str, static_cast<uint>(newlen), 0, 0));
+ s2->f_str, static_cast<uint>(newlen), 0));
}
/******************************************************************//**
Get the first character's code position for FTS index partition. */
@@ -6860,7 +6860,7 @@ innobase_fts_text_cmp_prefix(
result = ha_compare_text(
charset, s2->f_str, static_cast<uint>(s2->f_len),
- s1->f_str, static_cast<uint>(s1->f_len), 1, 0);
+ s1->f_str, static_cast<uint>(s1->f_len), 1);
/* We switched s1, s2 position in ha_compare_text. So we need
to negate the result */
diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c
index 1027255af55..8331de34ee4 100644
--- a/strings/ctype-bin.c
+++ b/strings/ctype-bin.c
@@ -119,9 +119,7 @@ size_t my_lengthsp_binary(CHARSET_INFO *cs __attribute__((unused)),
static int my_strnncollsp_binary(CHARSET_INFO * cs __attribute__((unused)),
const uchar *s, size_t slen,
- const uchar *t, size_t tlen,
- my_bool diff_if_only_endspace_difference
- __attribute__((unused)))
+ const uchar *t, size_t tlen)
{
return my_strnncoll_binary(cs,s,slen,t,tlen,0);
}
@@ -139,6 +137,27 @@ static int my_strnncoll_8bit_bin(CHARSET_INFO * cs __attribute__((unused)),
/*
+ Compare a string to an array of spaces, for PAD SPACE behaviour.
+ @param str - the string
+ @param length - the length of the string
+ @return <0 - if a byte less than SPACE was found
+ @return >0 - if a byte greater than SPACE was found
+ @return 0 - if the string entirely consists of SPACE characters
+*/
+int my_strnncollsp_padspace_bin(const uchar *str, size_t length)
+{
+ for ( ; length ; str++, length--)
+ {
+ if (*str < ' ')
+ return -1;
+ else if (*str > ' ')
+ return 1;
+ }
+ return 0;
+}
+
+
+/*
Compare two strings. Result is sign(first_argument - second_argument)
SYNOPSIS
@@ -148,9 +167,6 @@ static int my_strnncoll_8bit_bin(CHARSET_INFO * cs __attribute__((unused)),
slen Length of 's'
t String to compare
tlen Length of 't'
- diff_if_only_endspace_difference
- Set to 1 if the strings should be regarded as different
- if they only difference in end space
NOTE
This function is used for character strings with binary collations.
@@ -165,16 +181,10 @@ static int my_strnncoll_8bit_bin(CHARSET_INFO * cs __attribute__((unused)),
static int my_strnncollsp_8bit_bin(CHARSET_INFO * cs __attribute__((unused)),
const uchar *a, size_t a_length,
- const uchar *b, size_t b_length,
- my_bool diff_if_only_endspace_difference)
+ const uchar *b, size_t b_length)
{
const uchar *end;
size_t length;
- int res;
-
-#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE
- diff_if_only_endspace_difference= 0;
-#endif
end= a + (length= MY_MIN(a_length, b_length));
while (a < end)
@@ -182,31 +192,10 @@ static int my_strnncollsp_8bit_bin(CHARSET_INFO * cs __attribute__((unused)),
if (*a++ != *b++)
return ((int) a[-1] - (int) b[-1]);
}
- res= 0;
- if (a_length != b_length)
- {
- int swap= 1;
- /*
- Check the next not space character of the longer key. If it's < ' ',
- then it's smaller than the other key.
- */
- if (diff_if_only_endspace_difference)
- res= 1; /* Assume 'a' is bigger */
- if (a_length < b_length)
- {
- /* put shorter key in s */
- a_length= b_length;
- a= b;
- swap= -1; /* swap sign of result */
- res= -res;
- }
- for (end= a + a_length-length; a < end ; a++)
- {
- if (*a != ' ')
- return (*a < ' ') ? -swap : swap;
- }
- }
- return res;
+ return a_length == b_length ? 0 :
+ a_length < b_length ?
+ -my_strnncollsp_padspace_bin(b, b_length - length) :
+ my_strnncollsp_padspace_bin(a, a_length - length);
}
diff --git a/strings/ctype-czech.c b/strings/ctype-czech.c
index e3abebad91d..a7efd20b259 100644
--- a/strings/ctype-czech.c
+++ b/strings/ctype-czech.c
@@ -276,9 +276,7 @@ static int my_strnncoll_czech(CHARSET_INFO *cs __attribute__((unused)),
static
int my_strnncollsp_czech(CHARSET_INFO * cs,
const uchar *s, size_t slen,
- const uchar *t, size_t tlen,
- my_bool diff_if_only_endspace_difference
- __attribute__((unused)))
+ const uchar *t, size_t tlen)
{
for ( ; slen && s[slen-1] == ' ' ; slen--);
for ( ; tlen && t[tlen-1] == ' ' ; tlen--);
diff --git a/strings/ctype-latin1.c b/strings/ctype-latin1.c
index cf8f9bb7e28..aba63d97abb 100644
--- a/strings/ctype-latin1.c
+++ b/strings/ctype-latin1.c
@@ -597,16 +597,10 @@ static int my_strnncoll_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
static int my_strnncollsp_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
const uchar *a, size_t a_length,
- const uchar *b, size_t b_length,
- my_bool diff_if_only_endspace_difference)
+ const uchar *b, size_t b_length)
{
const uchar *a_end= a + a_length, *b_end= b + b_length;
uchar a_char, a_extend= 0, b_char, b_extend= 0;
- int res;
-
-#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE
- diff_if_only_endspace_difference= 0;
-#endif
while ((a < a_end || a_extend) && (b < b_end || b_extend))
{
@@ -639,31 +633,11 @@ static int my_strnncollsp_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
if (b_extend)
return -1;
- res= 0;
- if (a != a_end || b != b_end)
- {
- int swap= 1;
- if (diff_if_only_endspace_difference)
- res= 1; /* Assume 'a' is bigger */
- /*
- Check the next not space character of the longer key. If it's < ' ',
- then it's smaller than the other key.
- */
- if (a == a_end)
- {
- /* put shorter key in a */
- a_end= b_end;
- a= b;
- swap= -1; /* swap sign of result */
- res= -res;
- }
- for ( ; a < a_end ; a++)
- {
- if (*a != ' ')
- return (*a < ' ') ? -swap : swap;
- }
- }
- return res;
+ if (a < a_end)
+ return my_strnncollsp_padspace_bin(a, a_end - a);
+ if (b < b_end)
+ return -my_strnncollsp_padspace_bin(b, b_end - b);
+ return 0;
}
diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c
index b205b1abc20..5e5a345a638 100644
--- a/strings/ctype-simple.c
+++ b/strings/ctype-simple.c
@@ -128,9 +128,6 @@ int my_strnncoll_simple(CHARSET_INFO * cs, const uchar *s, size_t slen,
a_length Length of 'a'
b Second string to compare
b_length Length of 'b'
- diff_if_only_endspace_difference
- Set to 1 if the strings should be regarded as different
- if they only difference in end space
IMPLEMENTATION
If one string is shorter as the other, then we space extend the other
@@ -149,17 +146,12 @@ int my_strnncoll_simple(CHARSET_INFO * cs, const uchar *s, size_t slen,
*/
int my_strnncollsp_simple(CHARSET_INFO * cs, const uchar *a, size_t a_length,
- const uchar *b, size_t b_length,
- my_bool diff_if_only_endspace_difference)
+ const uchar *b, size_t b_length)
{
const uchar *map= cs->sort_order, *end;
size_t length;
int res;
-#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE
- diff_if_only_endspace_difference= 0;
-#endif
-
end= a + (length= MY_MIN(a_length, b_length));
while (a < end)
{
@@ -170,8 +162,6 @@ int my_strnncollsp_simple(CHARSET_INFO * cs, const uchar *a, size_t a_length,
if (a_length != b_length)
{
int swap= 1;
- if (diff_if_only_endspace_difference)
- res= 1; /* Assume 'a' is bigger */
/*
Check the next not space character of the longer key. If it's < ' ',
then it's smaller than the other key.
diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c
index 6315b05ea96..711bb21773e 100644
--- a/strings/ctype-tis620.c
+++ b/strings/ctype-tis620.c
@@ -543,17 +543,12 @@ int my_strnncoll_tis620(CHARSET_INFO *cs __attribute__((unused)),
static
int my_strnncollsp_tis620(CHARSET_INFO * cs __attribute__((unused)),
const uchar *a0, size_t a_length,
- const uchar *b0, size_t b_length,
- my_bool diff_if_only_endspace_difference)
+ const uchar *b0, size_t b_length)
{
uchar buf[80], *end, *a, *b, *alloced= NULL;
size_t length;
int res= 0;
-#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE
- diff_if_only_endspace_difference= 0;
-#endif
-
a= buf;
if ((a_length + b_length +2) > (int) sizeof(buf))
alloced= a= (uchar*) my_str_malloc(a_length+b_length+2);
@@ -575,33 +570,12 @@ int my_strnncollsp_tis620(CHARSET_INFO * cs __attribute__((unused)),
goto ret;
}
}
- if (a_length != b_length)
- {
- int swap= 1;
- if (diff_if_only_endspace_difference)
- res= 1; /* Assume 'a' is bigger */
- /*
- Check the next not space character of the longer key. If it's < ' ',
- then it's smaller than the other key.
- */
- if (a_length < b_length)
- {
- /* put shorter key in s */
- a_length= b_length;
- a= b;
- swap= -1; /* swap sign of result */
- res= -res;
- }
- for (end= a + a_length-length; a < end ; a++)
- {
- if (*a != ' ')
- {
- res= (*a < ' ') ? -swap : swap;
- goto ret;
- }
- }
- }
-
+
+ res= a_length == b_length ? 0 :
+ a_length < b_length ?
+ -my_strnncollsp_padspace_bin(b, b_length - length) :
+ my_strnncollsp_padspace_bin(a, a_length - length);
+
ret:
if (alloced)
diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c
index b0728978e71..0b279b620fd 100644
--- a/strings/ctype-uca.c
+++ b/strings/ctype-uca.c
@@ -20775,9 +20775,6 @@ my_char_weight_addr(const MY_UCA_WEIGHT_LEVEL *level, uint wc)
slen First string length
t Second string
tlen Seconf string length
- diff_if_only_endspace_difference
- Set to 1 if the strings should be regarded as different
- if they only difference in end space
NOTES:
Works exactly the same with my_strnncoll_uca(),
@@ -20815,16 +20812,11 @@ my_char_weight_addr(const MY_UCA_WEIGHT_LEVEL *level, uint wc)
static int my_strnncollsp_uca(CHARSET_INFO *cs,
my_uca_scanner_handler *scanner_handler,
const uchar *s, size_t slen,
- const uchar *t, size_t tlen,
- my_bool diff_if_only_endspace_difference)
+ const uchar *t, size_t tlen)
{
my_uca_scanner sscanner, tscanner;
int s_res, t_res;
-#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE
- diff_if_only_endspace_difference= 0;
-#endif
-
scanner_handler->init(&sscanner, cs, &cs->uca->level[0], s, slen);
scanner_handler->init(&tscanner, cs, &cs->uca->level[0], t, tlen);
@@ -20846,7 +20838,7 @@ static int my_strnncollsp_uca(CHARSET_INFO *cs,
return (s_res - t_res);
s_res= scanner_handler->next(&sscanner);
} while (s_res > 0);
- return diff_if_only_endspace_difference ? 1 : 0;
+ return 0;
}
if (s_res < 0 && t_res > 0)
@@ -20861,7 +20853,7 @@ static int my_strnncollsp_uca(CHARSET_INFO *cs,
return (s_res - t_res);
t_res= scanner_handler->next(&tscanner);
} while (t_res > 0);
- return diff_if_only_endspace_difference ? -1 : 0;
+ return 0;
}
return ( s_res - t_res );
@@ -22845,12 +22837,9 @@ static int my_strnncoll_any_uca(CHARSET_INFO *cs,
static int my_strnncollsp_any_uca(CHARSET_INFO *cs,
const uchar *s, size_t slen,
- const uchar *t, size_t tlen,
- my_bool diff_if_only_endspace_difference)
+ const uchar *t, size_t tlen)
{
- return my_strnncollsp_uca(cs, &my_any_uca_scanner_handler,
- s, slen, t, tlen,
- diff_if_only_endspace_difference);
+ return my_strnncollsp_uca(cs, &my_any_uca_scanner_handler, s, slen, t, tlen);
}
static void my_hash_sort_any_uca(CHARSET_INFO *cs,
@@ -22890,12 +22879,9 @@ static int my_strnncoll_ucs2_uca(CHARSET_INFO *cs,
static int my_strnncollsp_ucs2_uca(CHARSET_INFO *cs,
const uchar *s, size_t slen,
- const uchar *t, size_t tlen,
- my_bool diff_if_only_endspace_difference)
+ const uchar *t, size_t tlen)
{
- return my_strnncollsp_uca(cs, &my_any_uca_scanner_handler,
- s, slen, t, tlen,
- diff_if_only_endspace_difference);
+ return my_strnncollsp_uca(cs, &my_any_uca_scanner_handler, s, slen, t, tlen);
}
static void my_hash_sort_ucs2_uca(CHARSET_INFO *cs,
diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c
index c0014b95d15..3a5616b7323 100644
--- a/strings/ctype-utf8.c
+++ b/strings/ctype-utf8.c
@@ -5678,8 +5678,7 @@ static int my_strnncoll_utf8_cs(CHARSET_INFO *cs,
static int my_strnncollsp_utf8_cs(CHARSET_INFO *cs,
const uchar *s, size_t slen,
- const uchar *t, size_t tlen,
- my_bool diff_if_only_endspace_difference)
+ const uchar *t, size_t tlen)
{
int s_res, t_res, res;
my_wc_t s_wc, t_wc;
@@ -5688,10 +5687,6 @@ static int my_strnncollsp_utf8_cs(CHARSET_INFO *cs,
int save_diff= 0;
MY_UNICASE_INFO *uni_plane= cs->caseinfo;
-#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE
- diff_if_only_endspace_difference= 0;
-#endif
-
while ( s < se && t < te )
{
s_res=my_utf8_uni(cs,&s_wc, s, se);
@@ -5722,37 +5717,22 @@ static int my_strnncollsp_utf8_cs(CHARSET_INFO *cs,
slen= se-s;
tlen= te-t;
- res= 0;
-
- if (slen != tlen)
- {
- int swap= 1;
- if (diff_if_only_endspace_difference)
- res= 1; /* Assume 'a' is bigger */
- if (slen < tlen)
- {
- slen= tlen;
- s= t;
- se= te;
- swap= -1;
- res= -res;
- }
- /*
- This following loop uses the fact that in UTF-8
- all multibyte characters are greater than space,
- and all multibyte head characters are greater than
- space. It means if we meet a character greater
- than space, it always means that the longer string
- is greater. So we can reuse the same loop from the
- 8bit version, without having to process full multibute
- sequences.
- */
- for ( ; s < se; s++)
- {
- if (*s != (uchar) ' ')
- return (*s < (uchar) ' ') ? -swap : swap;
- }
- }
+
+ /*
+ The following code uses the fact that in UTF-8
+ all multibyte characters are greater than space,
+ and all multibyte head characters are greater than
+ space. It means if we meet a character greater
+ than space, it always means that the longer string
+ is greater. So we can reuse the same loop from the
+ 8bit version, without having to process full multibute
+ sequences.
+ */
+ if ((res= slen == tlen ? 0 :
+ slen < tlen ?
+ -my_strnncollsp_padspace_bin(t, tlen) :
+ my_strnncollsp_padspace_bin(s, slen)))
+ return res;
return save_diff;
}
diff --git a/strings/ctype-win1250ch.c b/strings/ctype-win1250ch.c
index 8e3527f9ff1..c18733b06ae 100644
--- a/strings/ctype-win1250ch.c
+++ b/strings/ctype-win1250ch.c
@@ -478,9 +478,7 @@ static int my_strnncoll_win1250ch(CHARSET_INFO *cs __attribute__((unused)),
static
int my_strnncollsp_win1250ch(CHARSET_INFO * cs,
const uchar *s, size_t slen,
- const uchar *t, size_t tlen,
- my_bool diff_if_only_endspace_difference
- __attribute__((unused)))
+ const uchar *t, size_t tlen)
{
for ( ; slen && s[slen-1] == ' ' ; slen--);
for ( ; tlen && t[tlen-1] == ' ' ; tlen--);
diff --git a/strings/strcoll.ic b/strings/strcoll.ic
index 4ce362c1675..a9693b1f3c0 100644
--- a/strings/strcoll.ic
+++ b/strings/strcoll.ic
@@ -210,17 +210,13 @@ MY_FUNCTION_NAME(strnncoll)(CHARSET_INFO *cs __attribute__((unused)),
@param a_length - the length of the left string
@param b - the right string
@param b_length - the length of the right string
- @param diff_if_only_endspace_difference - not used in the code.
- TODO: this should be eventually removed (in 10.2?)
@return - the comparison result
*/
static int
MY_FUNCTION_NAME(strnncollsp)(CHARSET_INFO *cs __attribute__((unused)),
const uchar *a, size_t a_length,
- const uchar *b, size_t b_length,
- my_bool diff_if_only_endspace_difference
- __attribute__((unused)))
+ const uchar *b, size_t b_length)
{
const uchar *a_end= a + a_length;
const uchar *b_end= b + b_length;
diff --git a/unittest/strings/strings-t.c b/unittest/strings/strings-t.c
index fe595a5c303..22b50fc1659 100644
--- a/unittest/strings/strings-t.c
+++ b/unittest/strings/strings-t.c
@@ -627,7 +627,7 @@ strcollsp(CHARSET_INFO *cs, const STRNNCOLL_PARAM *param)
{
char ahex[64], bhex[64];
int res= cs->coll->strnncollsp(cs, (uchar *) p->a, p->alen,
- (uchar *) p->b, p->blen, 0);
+ (uchar *) p->b, p->blen);
str2hex(ahex, sizeof(ahex), p->a, p->alen);
str2hex(bhex, sizeof(bhex), p->b, p->blen);
diag("%-20s %-10s %-10s %10d %10d%s",
@@ -641,7 +641,7 @@ strcollsp(CHARSET_INFO *cs, const STRNNCOLL_PARAM *param)
{
/* Test in reverse order */
res= cs->coll->strnncollsp(cs, (uchar *) p->b, p->blen,
- (uchar *) p->a, p->alen, 0);
+ (uchar *) p->a, p->alen);
if (!eqres(res, -p->res))
{
diag("Comparison in reverse order failed. Expected %d, got %d",