MDEV-8360 Clean-up CHARSET_INFO: strnncollsp: diff_if_only_endspace_difference
- Removing the "diff_if_only_endspace_difference" argument from MY_COLLATION_HANDLER::strnncollsp(), my_strnncollsp_simple(), as well as in the function template MY_FUNCTION_NAME(strnncollsp) in strcoll.ic - Removing the "diff_if_only_space_different" from ha_compare_text(), hp_rec_key_cmp(). - Adding a new function my_strnncollsp_padspace_bin() and reusing it instead of duplicate code pieces in my_strnncollsp_8bit_bin(), my_strnncollsp_latin1_de(), my_strnncollsp_tis620(), my_strnncollsp_utf8_cs(). - Adding more tests for better coverage of the trailing space handling. - Removing the unused definition of HA_END_SPACE_ARE_EQUAL
This commit is contained in:
parent
282497dd6d
commit
1d73005bf3
@ -325,8 +325,7 @@ struct my_collation_handler_st
|
|||||||
int (*strnncoll)(CHARSET_INFO *,
|
int (*strnncoll)(CHARSET_INFO *,
|
||||||
const uchar *, size_t, const uchar *, size_t, my_bool);
|
const uchar *, size_t, const uchar *, size_t, my_bool);
|
||||||
int (*strnncollsp)(CHARSET_INFO *,
|
int (*strnncollsp)(CHARSET_INFO *,
|
||||||
const uchar *, size_t, const uchar *, size_t,
|
const uchar *, size_t, const uchar *, size_t);
|
||||||
my_bool diff_if_only_endspace_difference);
|
|
||||||
size_t (*strnxfrm)(CHARSET_INFO *,
|
size_t (*strnxfrm)(CHARSET_INFO *,
|
||||||
uchar *dst, size_t dstlen, uint nweights,
|
uchar *dst, size_t dstlen, uint nweights,
|
||||||
const uchar *src, size_t srclen, uint flags);
|
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);
|
const uchar *, size_t, my_bool);
|
||||||
|
|
||||||
extern int my_strnncollsp_simple(CHARSET_INFO *, const uchar *, size_t,
|
extern int my_strnncollsp_simple(CHARSET_INFO *, const uchar *, size_t,
|
||||||
const uchar *, size_t,
|
const uchar *, size_t);
|
||||||
my_bool diff_if_only_endspace_difference);
|
|
||||||
|
|
||||||
extern void my_hash_sort_simple(CHARSET_INFO *cs,
|
extern void my_hash_sort_simple(CHARSET_INFO *cs,
|
||||||
const uchar *key, size_t len,
|
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,
|
const uchar *key, size_t len, ulong *nr1,
|
||||||
ulong *nr2);
|
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 size_t my_lengthsp_8bit(CHARSET_INFO *cs, const char *ptr, size_t length);
|
||||||
|
|
||||||
extern uint my_instr_simple(CHARSET_INFO *,
|
extern uint my_instr_simple(CHARSET_INFO *,
|
||||||
|
@ -298,11 +298,7 @@ enum ha_base_keytype {
|
|||||||
#define HA_SWAP_KEY 64
|
#define HA_SWAP_KEY 64
|
||||||
#define HA_REVERSE_SORT 128 /* Sort key in reverse order */
|
#define HA_REVERSE_SORT 128 /* Sort key in reverse order */
|
||||||
#define HA_NO_SORT 256 /* do not bother sorting on this keyseg */
|
#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_BIT_PART 1024
|
||||||
#define HA_CAN_MEMCMP 2048 /* internal, never stored in frm */
|
#define HA_CAN_MEMCMP 2048 /* internal, never stored in frm */
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ typedef struct st_HA_KEYSEG /* Key-portion */
|
|||||||
set_rec_bits(0, bit_ptr, bit_ofs, bit_len)
|
set_rec_bits(0, bit_ptr, bit_ofs, bit_len)
|
||||||
|
|
||||||
extern int ha_compare_text(CHARSET_INFO *, const uchar *, uint,
|
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,
|
extern int ha_key_cmp(HA_KEYSEG *keyseg, const uchar *a,
|
||||||
const uchar *b, uint key_length, uint nextflag,
|
const uchar *b, uint key_length, uint nextflag,
|
||||||
uint *diff_pos);
|
uint *diff_pos);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
SELECT strcmp('a','a ');
|
SELECT strcmp('a','a '), strcmp('a ','a');
|
||||||
SELECT strcmp('a\0','a' );
|
SELECT strcmp('a\0','a' ), strcmp('a','a\0');
|
||||||
SELECT strcmp('a\0','a ');
|
SELECT strcmp('a\0','a '), strcmp('a ','a\0');
|
||||||
SELECT strcmp('a\t','a' );
|
SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
|
||||||
SELECT strcmp('a\t','a ');
|
SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
|
||||||
|
@ -329,6 +329,21 @@ _ 5F
|
|||||||
} 7D
|
} 7D
|
||||||
7F
|
7F
|
||||||
drop table t1;
|
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';
|
SET collation_connection='big5_bin';
|
||||||
create table t1 select repeat('a',4000) a;
|
create table t1 select repeat('a',4000) a;
|
||||||
delete from t1;
|
delete from t1;
|
||||||
@ -476,6 +491,21 @@ a hex(b) c
|
|||||||
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
|
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
|
||||||
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
|
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
|
||||||
DROP TABLE t1;
|
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;
|
SET NAMES big5;
|
||||||
CREATE TABLE t1 (a text) character set big5;
|
CREATE TABLE t1 (a text) character set big5;
|
||||||
INSERT INTO t1 VALUES ('ùØ');
|
INSERT INTO t1 VALUES ('ùØ');
|
||||||
|
@ -377,21 +377,21 @@ a
|
|||||||
abcdefghá
|
abcdefghá
|
||||||
drop table t1;
|
drop table t1;
|
||||||
set names cp1250 collate cp1250_czech_cs;
|
set names cp1250 collate cp1250_czech_cs;
|
||||||
SELECT strcmp('a','a ');
|
SELECT strcmp('a','a '), strcmp('a ','a');
|
||||||
strcmp('a','a ')
|
strcmp('a','a ') strcmp('a ','a')
|
||||||
0
|
0 0
|
||||||
SELECT strcmp('a\0','a' );
|
SELECT strcmp('a\0','a' ), strcmp('a','a\0');
|
||||||
strcmp('a\0','a' )
|
strcmp('a\0','a' ) strcmp('a','a\0')
|
||||||
1
|
1 -1
|
||||||
SELECT strcmp('a\0','a ');
|
SELECT strcmp('a\0','a '), strcmp('a ','a\0');
|
||||||
strcmp('a\0','a ')
|
strcmp('a\0','a ') strcmp('a ','a\0')
|
||||||
1
|
1 -1
|
||||||
SELECT strcmp('a\t','a' );
|
SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
|
||||||
strcmp('a\t','a' )
|
strcmp('a\t','a' ) strcmp('a', 'a\t')
|
||||||
1
|
1 -1
|
||||||
SELECT strcmp('a\t','a ');
|
SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
|
||||||
strcmp('a\t','a ')
|
strcmp('a\t','a ') strcmp('a ', 'a\t')
|
||||||
1
|
1 -1
|
||||||
create table t1 select repeat('a',4000) a;
|
create table t1 select repeat('a',4000) a;
|
||||||
delete from t1;
|
delete from t1;
|
||||||
insert into t1 values ('a'), ('a '), ('a\t');
|
insert into t1 values ('a'), ('a '), ('a\t');
|
||||||
|
@ -388,6 +388,21 @@ FF FF FF D18F FF
|
|||||||
Warnings:
|
Warnings:
|
||||||
Warning 1977 Cannot convert 'cp1251' character 0x98 to 'utf8'
|
Warning 1977 Cannot convert 'cp1251' character 0x98 to 'utf8'
|
||||||
DROP TABLE t1;
|
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);
|
set global LC_TIME_NAMES=convert((-8388608) using cp1251);
|
||||||
ERROR HY000: Unknown locale: '-8388608'
|
ERROR HY000: Unknown locale: '-8388608'
|
||||||
#
|
#
|
||||||
|
@ -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)
|
HEX(subject) HEX(pattern) STR_TO_DATE(subject, pattern)
|
||||||
32303031F73031F73031 2559F7256DF72564 2001-01-01 00:00:00.000000
|
32303031F73031F73031 2559F7256DF72564 2001-01-01 00:00:00.000000
|
||||||
DROP TABLE t1;
|
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';
|
SET collation_connection='latin1_bin';
|
||||||
create table t1 select repeat('a',4000) a;
|
create table t1 select repeat('a',4000) a;
|
||||||
delete from t1;
|
delete from t1;
|
||||||
@ -621,6 +636,21 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
|
|||||||
c2h
|
c2h
|
||||||
ab_def
|
ab_def
|
||||||
drop table t1;
|
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);
|
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
|
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;
|
SELECT '„a' as str;
|
||||||
|
@ -30,21 +30,21 @@ select * from t1 where tt like '%AA%';
|
|||||||
id tt
|
id tt
|
||||||
drop table t1;
|
drop table t1;
|
||||||
set names latin2 collate latin2_czech_cs;
|
set names latin2 collate latin2_czech_cs;
|
||||||
SELECT strcmp('a','a ');
|
SELECT strcmp('a','a '), strcmp('a ','a');
|
||||||
strcmp('a','a ')
|
strcmp('a','a ') strcmp('a ','a')
|
||||||
0
|
0 0
|
||||||
SELECT strcmp('a\0','a' );
|
SELECT strcmp('a\0','a' ), strcmp('a','a\0');
|
||||||
strcmp('a\0','a' )
|
strcmp('a\0','a' ) strcmp('a','a\0')
|
||||||
1
|
1 -1
|
||||||
SELECT strcmp('a\0','a ');
|
SELECT strcmp('a\0','a '), strcmp('a ','a\0');
|
||||||
strcmp('a\0','a ')
|
strcmp('a\0','a ') strcmp('a ','a\0')
|
||||||
1
|
1 -1
|
||||||
SELECT strcmp('a\t','a' );
|
SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
|
||||||
strcmp('a\t','a' )
|
strcmp('a\t','a' ) strcmp('a', 'a\t')
|
||||||
0
|
0 0
|
||||||
SELECT strcmp('a\t','a ');
|
SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
|
||||||
strcmp('a\t','a ')
|
strcmp('a\t','a ') strcmp('a ', 'a\t')
|
||||||
0
|
0 0
|
||||||
#
|
#
|
||||||
# MDEV-7149 Constant condition propagation erroneously applied for LIKE
|
# MDEV-7149 Constant condition propagation erroneously applied for LIKE
|
||||||
#
|
#
|
||||||
@ -484,21 +484,21 @@ DROP TABLE t1;
|
|||||||
# WL#3664 WEIGHT_STRING
|
# WL#3664 WEIGHT_STRING
|
||||||
#
|
#
|
||||||
set names latin2 collate latin2_czech_cs;
|
set names latin2 collate latin2_czech_cs;
|
||||||
SELECT strcmp('a','a ');
|
SELECT strcmp('a','a '), strcmp('a ','a');
|
||||||
strcmp('a','a ')
|
strcmp('a','a ') strcmp('a ','a')
|
||||||
0
|
0 0
|
||||||
SELECT strcmp('a\0','a' );
|
SELECT strcmp('a\0','a' ), strcmp('a','a\0');
|
||||||
strcmp('a\0','a' )
|
strcmp('a\0','a' ) strcmp('a','a\0')
|
||||||
1
|
1 -1
|
||||||
SELECT strcmp('a\0','a ');
|
SELECT strcmp('a\0','a '), strcmp('a ','a\0');
|
||||||
strcmp('a\0','a ')
|
strcmp('a\0','a ') strcmp('a ','a\0')
|
||||||
1
|
1 -1
|
||||||
SELECT strcmp('a\t','a' );
|
SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
|
||||||
strcmp('a\t','a' )
|
strcmp('a\t','a' ) strcmp('a', 'a\t')
|
||||||
0
|
0 0
|
||||||
SELECT strcmp('a\t','a ');
|
SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
|
||||||
strcmp('a\t','a ')
|
strcmp('a\t','a ') strcmp('a ', 'a\t')
|
||||||
0
|
0 0
|
||||||
#
|
#
|
||||||
# Note:
|
# Note:
|
||||||
# latin2_czech_cs does not support WEIGHT_STRING in full extent
|
# latin2_czech_cs does not support WEIGHT_STRING in full extent
|
||||||
|
@ -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));
|
select hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE));
|
||||||
hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE))
|
hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE))
|
||||||
DFDF9C9D9E
|
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)));
|
select hex(weight_string(cast(0xE0A1 as char)));
|
||||||
hex(weight_string(cast(0xE0A1 as char)))
|
hex(weight_string(cast(0xE0A1 as char)))
|
||||||
A1E0
|
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));
|
select hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE));
|
||||||
hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE))
|
hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE))
|
||||||
DFDF9C9D9E
|
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)));
|
select hex(weight_string(cast(0xE0A1 as char)));
|
||||||
hex(weight_string(cast(0xE0A1 as char)))
|
hex(weight_string(cast(0xE0A1 as char)))
|
||||||
E0A1
|
E0A1
|
||||||
|
@ -18,11 +18,13 @@ SET collation_connection='big5_chinese_ci';
|
|||||||
-- source include/ctype_like_escape.inc
|
-- source include/ctype_like_escape.inc
|
||||||
-- source include/ctype_like_range_f1f2.inc
|
-- source include/ctype_like_range_f1f2.inc
|
||||||
-- source include/ctype_ascii_order.inc
|
-- source include/ctype_ascii_order.inc
|
||||||
|
-- source include/ctype_pad_space.inc
|
||||||
SET collation_connection='big5_bin';
|
SET collation_connection='big5_bin';
|
||||||
-- source include/ctype_filesort.inc
|
-- source include/ctype_filesort.inc
|
||||||
-- source include/ctype_innodb_like.inc
|
-- source include/ctype_innodb_like.inc
|
||||||
-- source include/ctype_like_escape.inc
|
-- source include/ctype_like_escape.inc
|
||||||
-- source include/ctype_like_range_f1f2.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.
|
# Bugs#9357: TEXT columns break string with special word in BIG5 charset.
|
||||||
|
@ -65,6 +65,7 @@ DROP TABLE t1;
|
|||||||
--echo #
|
--echo #
|
||||||
|
|
||||||
--source include/ctype_8bit.inc
|
--source include/ctype_8bit.inc
|
||||||
|
--source include/ctype_pad_space.inc
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bug #48053 String::c_ptr has a race and/or does an invalid
|
# Bug #48053 String::c_ptr has a race and/or does an invalid
|
||||||
|
@ -87,9 +87,11 @@ SET collation_connection='latin1_swedish_ci';
|
|||||||
-- source include/ctype_filesort.inc
|
-- source include/ctype_filesort.inc
|
||||||
-- source include/ctype_like_escape.inc
|
-- source include/ctype_like_escape.inc
|
||||||
-- source include/ctype_str_to_date.inc
|
-- source include/ctype_str_to_date.inc
|
||||||
|
-- source include/ctype_pad_space.inc
|
||||||
SET collation_connection='latin1_bin';
|
SET collation_connection='latin1_bin';
|
||||||
-- source include/ctype_filesort.inc
|
-- source include/ctype_filesort.inc
|
||||||
-- source include/ctype_like_escape.inc
|
-- source include/ctype_like_escape.inc
|
||||||
|
-- source include/ctype_pad_space.inc
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bug#8041
|
# Bug#8041
|
||||||
|
@ -178,12 +178,14 @@ set names tis620;
|
|||||||
set collation_connection=tis620_thai_ci;
|
set collation_connection=tis620_thai_ci;
|
||||||
--source include/weight_string.inc
|
--source include/weight_string.inc
|
||||||
--source include/weight_string_l1.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)));
|
||||||
select hex(weight_string(cast(0xE0A1 as char) as char(1)));
|
select hex(weight_string(cast(0xE0A1 as char) as char(1)));
|
||||||
|
|
||||||
set collation_connection=tis620_bin;
|
set collation_connection=tis620_bin;
|
||||||
--source include/weight_string.inc
|
--source include/weight_string.inc
|
||||||
--source include/weight_string_l1.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)));
|
||||||
select hex(weight_string(cast(0xE0A1 as char) as char(1)));
|
select hex(weight_string(cast(0xE0A1 as char) as char(1)));
|
||||||
|
|
||||||
|
@ -21,12 +21,11 @@
|
|||||||
#include <my_sys.h>
|
#include <my_sys.h>
|
||||||
|
|
||||||
int ha_compare_text(CHARSET_INFO *charset_info, const uchar *a, uint a_length,
|
int ha_compare_text(CHARSET_INFO *charset_info, const uchar *a, uint a_length,
|
||||||
const uchar *b, uint b_length, my_bool part_key,
|
const uchar *b, uint b_length, my_bool part_key)
|
||||||
my_bool skip_end_space)
|
|
||||||
{
|
{
|
||||||
if (!part_key)
|
if (!part_key)
|
||||||
return charset_info->coll->strnncollsp(charset_info, a, a_length,
|
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,
|
return charset_info->coll->strnncoll(charset_info, a, a_length,
|
||||||
b, b_length, part_key);
|
b, b_length, part_key);
|
||||||
}
|
}
|
||||||
@ -186,8 +185,7 @@ int ha_key_cmp(HA_KEYSEG *keyseg, const uchar *a,
|
|||||||
if (piks &&
|
if (piks &&
|
||||||
(flag=ha_compare_text(keyseg->charset,a,a_length,b,b_length,
|
(flag=ha_compare_text(keyseg->charset,a,a_length,b,b_length,
|
||||||
(my_bool) ((nextflag & SEARCH_PREFIX) &&
|
(my_bool) ((nextflag & SEARCH_PREFIX) &&
|
||||||
next_key_length <= 0),
|
next_key_length <= 0))))
|
||||||
(my_bool)!(nextflag & SEARCH_PREFIX))))
|
|
||||||
return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag);
|
return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag);
|
||||||
a+=a_length;
|
a+=a_length;
|
||||||
b+=b_length;
|
b+=b_length;
|
||||||
@ -199,8 +197,7 @@ int ha_key_cmp(HA_KEYSEG *keyseg, const uchar *a,
|
|||||||
if (piks &&
|
if (piks &&
|
||||||
(flag= ha_compare_text(keyseg->charset, a, a_length, b, b_length,
|
(flag= ha_compare_text(keyseg->charset, a, a_length, b, b_length,
|
||||||
(my_bool) ((nextflag & SEARCH_PREFIX) &&
|
(my_bool) ((nextflag & SEARCH_PREFIX) &&
|
||||||
next_key_length <= 0),
|
next_key_length <= 0))))
|
||||||
(my_bool)!(nextflag & SEARCH_PREFIX))))
|
|
||||||
return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag);
|
return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag);
|
||||||
a=end;
|
a=end;
|
||||||
b+=length;
|
b+=length;
|
||||||
@ -247,12 +244,7 @@ int ha_key_cmp(HA_KEYSEG *keyseg, const uchar *a,
|
|||||||
if (piks &&
|
if (piks &&
|
||||||
(flag= ha_compare_text(keyseg->charset,a,a_length,b,b_length,
|
(flag= ha_compare_text(keyseg->charset,a,a_length,b,b_length,
|
||||||
(my_bool) ((nextflag & SEARCH_PREFIX) &&
|
(my_bool) ((nextflag & SEARCH_PREFIX) &&
|
||||||
next_key_length <= 0),
|
next_key_length <= 0))))
|
||||||
(my_bool) ((nextflag & (SEARCH_FIND |
|
|
||||||
SEARCH_UPDATE)) ==
|
|
||||||
SEARCH_FIND &&
|
|
||||||
! (keyseg->flag &
|
|
||||||
HA_END_SPACE_ARE_EQUAL)))))
|
|
||||||
return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag);
|
return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag);
|
||||||
a+= a_length;
|
a+= a_length;
|
||||||
b+= b_length;
|
b+= b_length;
|
||||||
|
@ -102,7 +102,7 @@ ulong Events::inited;
|
|||||||
int sortcmp_lex_string(LEX_STRING s, LEX_STRING t, CHARSET_INFO *cs)
|
int sortcmp_lex_string(LEX_STRING s, LEX_STRING t, CHARSET_INFO *cs)
|
||||||
{
|
{
|
||||||
return cs->coll->strnncollsp(cs, (uchar *) s.str,s.length,
|
return cs->coll->strnncollsp(cs, (uchar *) s.str,s.length,
|
||||||
(uchar *) t.str,t.length, 0);
|
(uchar *) t.str,t.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
13
sql/field.cc
13
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,
|
return field_charset->coll->strnncollsp(field_charset,
|
||||||
a_ptr, a_len,
|
a_ptr, a_len,
|
||||||
b_ptr, b_len,
|
b_ptr, b_len);
|
||||||
0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -7511,7 +7510,7 @@ int Field_varstring::cmp_max(const uchar *a_ptr, const uchar *b_ptr,
|
|||||||
a_length,
|
a_length,
|
||||||
b_ptr+
|
b_ptr+
|
||||||
length_bytes,
|
length_bytes,
|
||||||
b_length,0);
|
b_length);
|
||||||
return diff;
|
return diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7534,7 +7533,7 @@ int Field_varstring::key_cmp(const uchar *key_ptr, uint max_key_length)
|
|||||||
length,
|
length,
|
||||||
key_ptr+
|
key_ptr+
|
||||||
HA_KEY_BLOB_LENGTH,
|
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,
|
a + HA_KEY_BLOB_LENGTH,
|
||||||
uint2korr(a),
|
uint2korr(a),
|
||||||
b + HA_KEY_BLOB_LENGTH,
|
b + HA_KEY_BLOB_LENGTH,
|
||||||
uint2korr(b),
|
uint2korr(b));
|
||||||
0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -8053,8 +8051,7 @@ int Field_blob::cmp(const uchar *a,uint32 a_length, const uchar *b,
|
|||||||
uint32 b_length)
|
uint32 b_length)
|
||||||
{
|
{
|
||||||
return field_charset->coll->strnncollsp(field_charset,
|
return field_charset->coll->strnncollsp(field_charset,
|
||||||
a, a_length, b, b_length,
|
a, a_length, b, b_length);
|
||||||
0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ public:
|
|||||||
{
|
{
|
||||||
return collation->coll->strnncollsp(collation,
|
return collation->coll->strnncollsp(collation,
|
||||||
(uchar *) s->ptr(), s->length(),
|
(uchar *) s->ptr(), s->length(),
|
||||||
(uchar *) t->ptr(), t->length(), 0);
|
(uchar *) t->ptr(), t->length());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4074,7 +4074,7 @@ static int srtcmp_in(CHARSET_INFO *cs, const String *x,const String *y)
|
|||||||
{
|
{
|
||||||
return cs->coll->strnncollsp(cs,
|
return cs->coll->strnncollsp(cs,
|
||||||
(uchar *) x->ptr(),x->length(),
|
(uchar *) x->ptr(),x->length(),
|
||||||
(uchar *) y->ptr(),y->length(), 0);
|
(uchar *) y->ptr(),y->length());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Item_func_in::fix_length_and_dec()
|
void Item_func_in::fix_length_and_dec()
|
||||||
|
@ -328,7 +328,7 @@ bool key_cmp_if_same(TABLE *table,const uchar *key,uint idx,uint key_length)
|
|||||||
}
|
}
|
||||||
if (cs->coll->strnncollsp(cs,
|
if (cs->coll->strnncollsp(cs,
|
||||||
(const uchar*) key, length,
|
(const uchar*) key, length,
|
||||||
(const uchar*) pos, char_length, 0))
|
(const uchar*) pos, char_length))
|
||||||
return 1;
|
return 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -891,8 +891,7 @@ bool key_buf_cmp(KEY *key_info, uint used_key_parts,
|
|||||||
if (length1 != length2 ||
|
if (length1 != length2 ||
|
||||||
cs->coll->strnncollsp(cs,
|
cs->coll->strnncollsp(cs,
|
||||||
pos1 + pack_length, byte_len1,
|
pos1 + pack_length, byte_len1,
|
||||||
pos2 + pack_length, byte_len2,
|
pos2 + pack_length, byte_len2))
|
||||||
1))
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
key1+= pack_length; key2+= pack_length;
|
key1+= pack_length; key2+= pack_length;
|
||||||
}
|
}
|
||||||
|
@ -4175,7 +4175,6 @@ SJ_TMP_TABLE::create_sj_weedout_tmp_table(THD *thd)
|
|||||||
field->null_ptr,
|
field->null_ptr,
|
||||||
field->null_bit)))
|
field->null_bit)))
|
||||||
goto err;
|
goto err;
|
||||||
key_part_info->key_part_flag|= HA_END_SPACE_ARE_EQUAL; //todo need this?
|
|
||||||
}
|
}
|
||||||
keyinfo->key_length+= key_part_info->length;
|
keyinfo->key_length+= key_part_info->length;
|
||||||
}
|
}
|
||||||
|
@ -16725,8 +16725,6 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
|
|||||||
cur_group->buff++; // Pointer to field data
|
cur_group->buff++; // Pointer to field data
|
||||||
group_buff++; // Skipp null flag
|
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();
|
group_buff+= cur_group->field->pack_length();
|
||||||
}
|
}
|
||||||
keyinfo->key_length+= key_part_info->length;
|
keyinfo->key_length+= key_part_info->length;
|
||||||
|
@ -3524,7 +3524,7 @@ bool get_lookup_value(THD *thd, Item_func *item_func,
|
|||||||
/* Lookup value is database name */
|
/* Lookup value is database name */
|
||||||
if (!cs->coll->strnncollsp(cs, (uchar *) field_name1, strlen(field_name1),
|
if (!cs->coll->strnncollsp(cs, (uchar *) field_name1, strlen(field_name1),
|
||||||
(uchar *) item_field->field_name,
|
(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,
|
thd->make_lex_string(&lookup_field_vals->db_value,
|
||||||
tmp_str->ptr(), tmp_str->length());
|
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,
|
else if (!cs->coll->strnncollsp(cs, (uchar *) field_name2,
|
||||||
strlen(field_name2),
|
strlen(field_name2),
|
||||||
(uchar *) item_field->field_name,
|
(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,
|
thd->make_lex_string(&lookup_field_vals->table_value,
|
||||||
tmp_str->ptr(), tmp_str->length());
|
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 ||
|
if (table->table != item_field->field->table ||
|
||||||
(cs->coll->strnncollsp(cs, (uchar *) field_name1, strlen(field_name1),
|
(cs->coll->strnncollsp(cs, (uchar *) field_name1, strlen(field_name1),
|
||||||
(uchar *) item_field->field_name,
|
(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),
|
cs->coll->strnncollsp(cs, (uchar *) field_name2, strlen(field_name2),
|
||||||
(uchar *) item_field->field_name,
|
(uchar *) item_field->field_name,
|
||||||
strlen(item_field->field_name), 0)))
|
strlen(item_field->field_name))))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (item->type() == Item::REF_ITEM)
|
else if (item->type() == Item::REF_ITEM)
|
||||||
|
@ -759,7 +759,7 @@ int sortcmp(const String *s,const String *t, CHARSET_INFO *cs)
|
|||||||
{
|
{
|
||||||
return cs->coll->strnncollsp(cs,
|
return cs->coll->strnncollsp(cs,
|
||||||
(uchar *) s->ptr(),s->length(),
|
(uchar *) s->ptr(),s->length(),
|
||||||
(uchar *) t->ptr(),t->length(), 0);
|
(uchar *) t->ptr(),t->length());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -337,7 +337,7 @@ int find_string_in_array(LEX_STRING * const haystack, LEX_STRING * const needle,
|
|||||||
const LEX_STRING *pos;
|
const LEX_STRING *pos;
|
||||||
for (pos= haystack; pos->str; pos++)
|
for (pos= haystack; pos->str; pos++)
|
||||||
if (!cs->coll->strnncollsp(cs, (uchar *) pos->str, pos->length,
|
if (!cs->coll->strnncollsp(cs, (uchar *) pos->str, pos->length,
|
||||||
(uchar *) needle->str, needle->length, 0))
|
(uchar *) needle->str, needle->length))
|
||||||
{
|
{
|
||||||
return (pos - haystack);
|
return (pos - haystack);
|
||||||
}
|
}
|
||||||
|
@ -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,
|
extern void hp_movelink(HASH_INFO *pos,HASH_INFO *next_link,
|
||||||
HASH_INFO *newlink);
|
HASH_INFO *newlink);
|
||||||
extern int hp_rec_key_cmp(HP_KEYDEF *keydef,const uchar *rec1,
|
extern int hp_rec_key_cmp(HP_KEYDEF *keydef,const uchar *rec1,
|
||||||
const uchar *rec2,
|
const uchar *rec2);
|
||||||
my_bool diff_if_only_endspace_difference);
|
|
||||||
extern int hp_key_cmp(HP_KEYDEF *keydef,const uchar *rec,
|
extern int hp_key_cmp(HP_KEYDEF *keydef,const uchar *rec,
|
||||||
const uchar *key);
|
const uchar *key);
|
||||||
extern void hp_make_key(HP_KEYDEF *keydef,uchar *key,const uchar *rec);
|
extern void hp_make_key(HP_KEYDEF *keydef,uchar *key,const uchar *rec);
|
||||||
|
@ -123,7 +123,7 @@ int hp_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo,
|
|||||||
|
|
||||||
while (pos->ptr_to_rec != recpos)
|
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 */
|
last_ptr=pos; /* Previous same key */
|
||||||
gpos=pos;
|
gpos=pos;
|
||||||
if (!(pos=pos->next_key))
|
if (!(pos=pos->next_key))
|
||||||
|
@ -513,8 +513,6 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const uchar *rec)
|
|||||||
keydef Key definition
|
keydef Key definition
|
||||||
rec1 Record to compare
|
rec1 Record to compare
|
||||||
rec2 Other record to compare
|
rec2 Other record to compare
|
||||||
diff_if_only_endspace_difference
|
|
||||||
Different number of end space is significant
|
|
||||||
|
|
||||||
NOTES
|
NOTES
|
||||||
diff_if_only_endspace_difference is used to allow us to insert
|
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
|
<> 0 Key differes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int hp_rec_key_cmp(HP_KEYDEF *keydef, const uchar *rec1, const uchar *rec2,
|
int hp_rec_key_cmp(HP_KEYDEF *keydef, const uchar *rec1, const uchar *rec2)
|
||||||
my_bool diff_if_only_endspace_difference)
|
|
||||||
{
|
{
|
||||||
HA_KEYSEG *seg,*endseg;
|
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,
|
if (seg->charset->coll->strnncollsp(seg->charset,
|
||||||
pos1,char_length1,
|
pos1,char_length1,
|
||||||
pos2,char_length2, 0))
|
pos2,char_length2))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (seg->type == HA_KEYTYPE_VARTEXT1) /* Any VARCHAR segments */
|
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,
|
if (cs->coll->strnncollsp(seg->charset,
|
||||||
pos1, char_length1,
|
pos1, char_length1,
|
||||||
pos2, char_length2,
|
pos2, char_length2))
|
||||||
seg->flag & HA_END_SPACE_ARE_EQUAL ?
|
|
||||||
0 : diff_if_only_endspace_difference))
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
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,
|
if (seg->charset->coll->strnncollsp(seg->charset,
|
||||||
(uchar*) pos, char_length_rec,
|
(uchar*) pos, char_length_rec,
|
||||||
(uchar*) key, char_length_key, 0))
|
(uchar*) key, char_length_key))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (seg->type == HA_KEYTYPE_VARTEXT1) /* Any VARCHAR segments */
|
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,
|
if (cs->coll->strnncollsp(seg->charset,
|
||||||
(uchar*) pos, char_length_rec,
|
(uchar*) pos, char_length_rec,
|
||||||
(uchar*) key, char_length_key, 0))
|
(uchar*) key, char_length_key))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -37,7 +37,7 @@ int heap_update(HP_INFO *info, const uchar *old, const uchar *heap_new)
|
|||||||
p_lastinx= share->keydef + info->lastinx;
|
p_lastinx= share->keydef + info->lastinx;
|
||||||
for (keydef= share->keydef, end= keydef + share->keys; keydef < end; keydef++)
|
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) ||
|
if ((*keydef->delete_key)(info, keydef, old, pos, keydef == p_lastinx) ||
|
||||||
(*keydef->write_key)(info, keydef, heap_new, pos))
|
(*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)
|
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) ||
|
if ((*keydef->delete_key)(info, keydef, heap_new, pos, 0) ||
|
||||||
(*keydef->write_key)(info, keydef, old, pos))
|
(*keydef->write_key)(info, keydef, old, pos))
|
||||||
|
@ -386,7 +386,7 @@ int hp_write_key(HP_INFO *info, HP_KEYDEF *keyinfo,
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (pos->hash_of_key == hash_of_key &&
|
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);
|
DBUG_RETURN(my_errno=HA_ERR_FOUND_DUPP_KEY);
|
||||||
}
|
}
|
||||||
|
@ -6339,7 +6339,7 @@ innobase_mysql_cmp(
|
|||||||
having indexes on such data need to rebuild their tables! */
|
having indexes on such data need to rebuild their tables! */
|
||||||
|
|
||||||
ret = charset->coll->strnncollsp(
|
ret = charset->coll->strnncollsp(
|
||||||
charset, a, a_length, b, b_length, 0);
|
charset, a, a_length, b, b_length);
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return(-1);
|
return(-1);
|
||||||
@ -6433,7 +6433,7 @@ innobase_mysql_cmp_prefix(
|
|||||||
charset = innobase_get_fts_charset(mysql_type, charset_number);
|
charset = innobase_get_fts_charset(mysql_type, charset_number);
|
||||||
|
|
||||||
result = ha_compare_text(charset, (uchar*) a, a_length,
|
result = ha_compare_text(charset, (uchar*) a, a_length,
|
||||||
(uchar*) b, b_length, 1, 0);
|
(uchar*) b, b_length, 1);
|
||||||
|
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
@ -6453,7 +6453,7 @@ innobase_fts_text_cmp(
|
|||||||
|
|
||||||
return(ha_compare_text(
|
return(ha_compare_text(
|
||||||
charset, s1->f_str, static_cast<uint>(s1->f_len),
|
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. */
|
compare two character string case insensitively according to their charset. */
|
||||||
@ -6476,7 +6476,7 @@ innobase_fts_text_case_cmp(
|
|||||||
|
|
||||||
return(ha_compare_text(
|
return(ha_compare_text(
|
||||||
charset, s1->f_str, static_cast<uint>(s1->f_len),
|
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. */
|
Get the first character's code position for FTS index partition. */
|
||||||
@ -6524,7 +6524,7 @@ innobase_fts_text_cmp_prefix(
|
|||||||
|
|
||||||
result = ha_compare_text(
|
result = ha_compare_text(
|
||||||
charset, s2->f_str, static_cast<uint>(s2->f_len),
|
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
|
/* We switched s1, s2 position in ha_compare_text. So we need
|
||||||
to negate the result */
|
to negate the result */
|
||||||
|
@ -5642,7 +5642,7 @@ static int sort_maria_ft_key_write(MARIA_SORT_PARAM *sort_param,
|
|||||||
|
|
||||||
if (ha_compare_text(sort_param->seg->charset,
|
if (ha_compare_text(sort_param->seg->charset,
|
||||||
a+1,a_len-1,
|
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;
|
uchar *p;
|
||||||
if (!ft_buf->buf) /* store in second-level tree */
|
if (!ft_buf->buf) /* store in second-level tree */
|
||||||
|
@ -163,7 +163,7 @@ static int FTB_WORD_cmp_list(CHARSET_INFO *cs, FTB_WORD **a, FTB_WORD **b)
|
|||||||
{
|
{
|
||||||
/* ORDER BY word, ndepth */
|
/* ORDER BY word, ndepth */
|
||||||
int i= ha_compare_text(cs, (uchar*) (*a)->word + 1,(*a)->len - 1,
|
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)
|
if (!i)
|
||||||
i=CMP_NUM((*a)->ndepth, (*b)->ndepth);
|
i=CMP_NUM((*a)->ndepth, (*b)->ndepth);
|
||||||
return i;
|
return i;
|
||||||
@ -413,7 +413,7 @@ static int _ft2_search_no_lock(FTB *ftb, FTB_WORD *ftbw, my_bool init_search)
|
|||||||
extra-1,
|
extra-1,
|
||||||
(uchar*) ftbw->word+1,
|
(uchar*) ftbw->word+1,
|
||||||
ftbw->len-1,
|
ftbw->len-1,
|
||||||
(my_bool) (ftbw->flags & FTB_FLAG_TRUNC), 0);
|
(my_bool) (ftbw->flags & FTB_FLAG_TRUNC));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r) /* not found */
|
if (r) /* not found */
|
||||||
@ -905,7 +905,7 @@ static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param,
|
|||||||
ftbw= ftb->list[c];
|
ftbw= ftb->list[c];
|
||||||
if (ha_compare_text(ftb->charset, (uchar*)word, len,
|
if (ha_compare_text(ftb->charset, (uchar*)word, len,
|
||||||
(uchar*)ftbw->word+1, ftbw->len-1,
|
(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;
|
b= c;
|
||||||
else
|
else
|
||||||
a= c;
|
a= c;
|
||||||
@ -932,7 +932,7 @@ static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param,
|
|||||||
ftbw= ftb->list[c];
|
ftbw= ftb->list[c];
|
||||||
if (ha_compare_text(ftb->charset, (uchar*)word, len,
|
if (ha_compare_text(ftb->charset, (uchar*)word, len,
|
||||||
(uchar*)ftbw->word + 1,ftbw->len - 1,
|
(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)
|
if (ftb->with_scan & FTB_FLAG_TRUNC)
|
||||||
continue;
|
continue;
|
||||||
|
@ -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+1,
|
||||||
info->last_key.data_length +
|
info->last_key.data_length +
|
||||||
info->last_key.ref_length - extra - 1,
|
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;
|
break;
|
||||||
|
|
||||||
if (subkeys.i < 0)
|
if (subkeys.i < 0)
|
||||||
|
@ -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)
|
static int FT_WORD_cmp(CHARSET_INFO* cs, FT_WORD *w1, FT_WORD *w2)
|
||||||
{
|
{
|
||||||
return ha_compare_text(cs, (uchar*) w1->pos, w1->len,
|
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)
|
static int walk_and_copy(FT_WORD *word,uint32 count,FT_DOCSTAT *docstat)
|
||||||
|
@ -184,7 +184,7 @@ int _ma_ft_cmp(MARIA_HA *info, uint keynr, const uchar *rec1, const uchar *rec2)
|
|||||||
if ((ftsi1.pos != ftsi2.pos) &&
|
if ((ftsi1.pos != ftsi2.pos) &&
|
||||||
(!ftsi1.pos || !ftsi2.pos ||
|
(!ftsi1.pos || !ftsi2.pos ||
|
||||||
ha_compare_text(cs, ftsi1.pos,ftsi1.len,
|
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(THOSE_TWO_DAMN_KEYS_ARE_REALLY_DIFFERENT);
|
||||||
}
|
}
|
||||||
DBUG_RETURN(GEE_THEY_ARE_ABSOLUTELY_IDENTICAL);
|
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)
|
while(old_word->pos && new_word->pos)
|
||||||
{
|
{
|
||||||
cmp= ha_compare_text(cs, (uchar*) old_word->pos,old_word->len,
|
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);
|
cmp2= cmp ? 0 : (fabs(old_word->weight - new_word->weight) > 1.e-5);
|
||||||
|
|
||||||
if (cmp < 0 || cmp2)
|
if (cmp < 0 || cmp2)
|
||||||
|
@ -238,7 +238,7 @@ my_bool _ma_unique_comp(MARIA_UNIQUEDEF *def, const uchar *a, const uchar *b,
|
|||||||
type == HA_KEYTYPE_VARTEXT2)
|
type == HA_KEYTYPE_VARTEXT2)
|
||||||
{
|
{
|
||||||
if (ha_compare_text(keyseg->charset, pos_a, a_length,
|
if (ha_compare_text(keyseg->charset, pos_a, a_length,
|
||||||
pos_b, b_length, 0, 1))
|
pos_b, b_length, 0))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -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);
|
DBUG_ASSERT(info->ft1_to_ft2==0);
|
||||||
if (alen == blen &&
|
if (alen == blen &&
|
||||||
ha_compare_text(keyinfo->seg->charset, a, alen,
|
ha_compare_text(keyinfo->seg->charset, a, alen,
|
||||||
b, blen, 0, 0) == 0)
|
b, blen, 0) == 0)
|
||||||
{
|
{
|
||||||
/* Yup. converting */
|
/* Yup. converting */
|
||||||
info->ft1_to_ft2=(DYNAMIC_ARRAY *)
|
info->ft1_to_ft2=(DYNAMIC_ARRAY *)
|
||||||
|
@ -163,7 +163,7 @@ static int FTB_WORD_cmp_list(CHARSET_INFO *cs, FTB_WORD **a, FTB_WORD **b)
|
|||||||
{
|
{
|
||||||
/* ORDER BY word, ndepth */
|
/* ORDER BY word, ndepth */
|
||||||
int i= ha_compare_text(cs, (uchar*) (*a)->word + 1, (*a)->len - 1,
|
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)
|
if (!i)
|
||||||
i= CMP_NUM((*a)->ndepth, (*b)->ndepth);
|
i= CMP_NUM((*a)->ndepth, (*b)->ndepth);
|
||||||
return i;
|
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,
|
info->lastkey_length-extra-1,
|
||||||
(uchar*) ftbw->word+1,
|
(uchar*) ftbw->word+1,
|
||||||
ftbw->len-1,
|
ftbw->len-1,
|
||||||
(my_bool) (ftbw->flags & FTB_FLAG_TRUNC),0);
|
(my_bool) (ftbw->flags & FTB_FLAG_TRUNC));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r) /* not found */
|
if (r) /* not found */
|
||||||
@ -913,7 +913,7 @@ static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param,
|
|||||||
ftbw= ftb->list[c];
|
ftbw= ftb->list[c];
|
||||||
if (ha_compare_text(ftb->charset, (uchar*)word, len,
|
if (ha_compare_text(ftb->charset, (uchar*)word, len,
|
||||||
(uchar*)ftbw->word+1, ftbw->len-1,
|
(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;
|
b= c;
|
||||||
else
|
else
|
||||||
a= c;
|
a= c;
|
||||||
@ -940,7 +940,7 @@ static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param,
|
|||||||
ftbw= ftb->list[c];
|
ftbw= ftb->list[c];
|
||||||
if (ha_compare_text(ftb->charset, (uchar*)word, len,
|
if (ha_compare_text(ftb->charset, (uchar*)word, len,
|
||||||
(uchar*)ftbw->word + 1,ftbw->len - 1,
|
(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)
|
if (ftb->with_scan & FTB_FLAG_TRUNC)
|
||||||
continue;
|
continue;
|
||||||
|
@ -114,7 +114,7 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
|
|||||||
|
|
||||||
if (keylen &&
|
if (keylen &&
|
||||||
ha_compare_text(aio->charset,info->lastkey+1,
|
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;
|
break;
|
||||||
|
|
||||||
if (subkeys.i < 0)
|
if (subkeys.i < 0)
|
||||||
|
@ -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)
|
static int FT_WORD_cmp(CHARSET_INFO* cs, FT_WORD *w1, FT_WORD *w2)
|
||||||
{
|
{
|
||||||
return ha_compare_text(cs, (uchar*) w1->pos, w1->len,
|
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)
|
static int walk_and_copy(FT_WORD *word,uint32 count,FT_DOCSTAT *docstat)
|
||||||
|
@ -35,7 +35,7 @@ static int FT_STOPWORD_cmp(void* cmp_arg __attribute__((unused)),
|
|||||||
{
|
{
|
||||||
return ha_compare_text(ft_stopword_cs,
|
return ha_compare_text(ft_stopword_cs,
|
||||||
(uchar *)w1->pos,w1->len,
|
(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,
|
static void FT_STOPWORD_free(FT_STOPWORD *w, TREE_FREE action,
|
||||||
|
@ -180,7 +180,7 @@ int _mi_ft_cmp(MI_INFO *info, uint keynr, const uchar *rec1, const uchar *rec2)
|
|||||||
if ((ftsi1.pos != ftsi2.pos) &&
|
if ((ftsi1.pos != ftsi2.pos) &&
|
||||||
(!ftsi1.pos || !ftsi2.pos ||
|
(!ftsi1.pos || !ftsi2.pos ||
|
||||||
ha_compare_text(cs, (uchar*) ftsi1.pos,ftsi1.len,
|
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(THOSE_TWO_DAMN_KEYS_ARE_REALLY_DIFFERENT);
|
||||||
}
|
}
|
||||||
DBUG_RETURN(GEE_THEY_ARE_ABSOLUTELY_IDENTICAL);
|
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)
|
while(old_word->pos && new_word->pos)
|
||||||
{
|
{
|
||||||
cmp= ha_compare_text(cs, (uchar*) old_word->pos,old_word->len,
|
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);
|
cmp2= cmp ? 0 : (fabs(old_word->weight - new_word->weight) > 1.e-5);
|
||||||
|
|
||||||
if (cmp < 0 || cmp2)
|
if (cmp < 0 || cmp2)
|
||||||
|
@ -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,
|
if (ha_compare_text(sort_param->seg->charset,
|
||||||
((uchar *)a)+1,a_len-1,
|
((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 */
|
if (!ft_buf->buf) /* store in second-level tree */
|
||||||
{
|
{
|
||||||
|
@ -214,7 +214,7 @@ int mi_unique_comp(MI_UNIQUEDEF *def, const uchar *a, const uchar *b,
|
|||||||
type == HA_KEYTYPE_VARTEXT2)
|
type == HA_KEYTYPE_VARTEXT2)
|
||||||
{
|
{
|
||||||
if (ha_compare_text(keyseg->charset, (uchar *) pos_a, a_length,
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -543,7 +543,7 @@ int _mi_insert(register MI_INFO *info, register MI_KEYDEF *keyinfo,
|
|||||||
get_key_length(alen,a);
|
get_key_length(alen,a);
|
||||||
DBUG_ASSERT(info->ft1_to_ft2==0);
|
DBUG_ASSERT(info->ft1_to_ft2==0);
|
||||||
if (alen == blen &&
|
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 */
|
/* yup. converting */
|
||||||
info->ft1_to_ft2=(DYNAMIC_ARRAY *)
|
info->ft1_to_ft2=(DYNAMIC_ARRAY *)
|
||||||
|
@ -921,8 +921,7 @@ static inline int cmp_toku_string(
|
|||||||
a_buf,
|
a_buf,
|
||||||
a_num_bytes,
|
a_num_bytes,
|
||||||
b_buf,
|
b_buf,
|
||||||
b_num_bytes,
|
b_num_bytes
|
||||||
0
|
|
||||||
);
|
);
|
||||||
return ret_val;
|
return ret_val;
|
||||||
}
|
}
|
||||||
|
@ -6675,7 +6675,7 @@ innobase_mysql_cmp(
|
|||||||
having indexes on such data need to rebuild their tables! */
|
having indexes on such data need to rebuild their tables! */
|
||||||
|
|
||||||
ret = charset->coll->strnncollsp(
|
ret = charset->coll->strnncollsp(
|
||||||
charset, a, a_length, b, b_length, 0);
|
charset, a, a_length, b, b_length);
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return(-1);
|
return(-1);
|
||||||
@ -6769,7 +6769,7 @@ innobase_mysql_cmp_prefix(
|
|||||||
charset = innobase_get_fts_charset(mysql_type, charset_number);
|
charset = innobase_get_fts_charset(mysql_type, charset_number);
|
||||||
|
|
||||||
result = ha_compare_text(charset, (uchar*) a, a_length,
|
result = ha_compare_text(charset, (uchar*) a, a_length,
|
||||||
(uchar*) b, b_length, 1, 0);
|
(uchar*) b, b_length, 1);
|
||||||
|
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
@ -6789,7 +6789,7 @@ innobase_fts_text_cmp(
|
|||||||
|
|
||||||
return(ha_compare_text(
|
return(ha_compare_text(
|
||||||
charset, s1->f_str, static_cast<uint>(s1->f_len),
|
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. */
|
compare two character string case insensitively according to their charset. */
|
||||||
@ -6812,7 +6812,7 @@ innobase_fts_text_case_cmp(
|
|||||||
|
|
||||||
return(ha_compare_text(
|
return(ha_compare_text(
|
||||||
charset, s1->f_str, static_cast<uint>(s1->f_len),
|
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. */
|
Get the first character's code position for FTS index partition. */
|
||||||
@ -6860,7 +6860,7 @@ innobase_fts_text_cmp_prefix(
|
|||||||
|
|
||||||
result = ha_compare_text(
|
result = ha_compare_text(
|
||||||
charset, s2->f_str, static_cast<uint>(s2->f_len),
|
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
|
/* We switched s1, s2 position in ha_compare_text. So we need
|
||||||
to negate the result */
|
to negate the result */
|
||||||
|
@ -119,9 +119,7 @@ size_t my_lengthsp_binary(CHARSET_INFO *cs __attribute__((unused)),
|
|||||||
|
|
||||||
static int my_strnncollsp_binary(CHARSET_INFO * cs __attribute__((unused)),
|
static int my_strnncollsp_binary(CHARSET_INFO * cs __attribute__((unused)),
|
||||||
const uchar *s, size_t slen,
|
const uchar *s, size_t slen,
|
||||||
const uchar *t, size_t tlen,
|
const uchar *t, size_t tlen)
|
||||||
my_bool diff_if_only_endspace_difference
|
|
||||||
__attribute__((unused)))
|
|
||||||
{
|
{
|
||||||
return my_strnncoll_binary(cs,s,slen,t,tlen,0);
|
return my_strnncoll_binary(cs,s,slen,t,tlen,0);
|
||||||
}
|
}
|
||||||
@ -138,6 +136,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)
|
Compare two strings. Result is sign(first_argument - second_argument)
|
||||||
|
|
||||||
@ -148,9 +167,6 @@ static int my_strnncoll_8bit_bin(CHARSET_INFO * cs __attribute__((unused)),
|
|||||||
slen Length of 's'
|
slen Length of 's'
|
||||||
t String to compare
|
t String to compare
|
||||||
tlen Length of 't'
|
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
|
NOTE
|
||||||
This function is used for character strings with binary collations.
|
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)),
|
static int my_strnncollsp_8bit_bin(CHARSET_INFO * cs __attribute__((unused)),
|
||||||
const uchar *a, size_t a_length,
|
const uchar *a, size_t a_length,
|
||||||
const uchar *b, size_t b_length,
|
const uchar *b, size_t b_length)
|
||||||
my_bool diff_if_only_endspace_difference)
|
|
||||||
{
|
{
|
||||||
const uchar *end;
|
const uchar *end;
|
||||||
size_t length;
|
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));
|
end= a + (length= MY_MIN(a_length, b_length));
|
||||||
while (a < end)
|
while (a < end)
|
||||||
@ -182,31 +192,10 @@ static int my_strnncollsp_8bit_bin(CHARSET_INFO * cs __attribute__((unused)),
|
|||||||
if (*a++ != *b++)
|
if (*a++ != *b++)
|
||||||
return ((int) a[-1] - (int) b[-1]);
|
return ((int) a[-1] - (int) b[-1]);
|
||||||
}
|
}
|
||||||
res= 0;
|
return a_length == b_length ? 0 :
|
||||||
if (a_length != b_length)
|
a_length < b_length ?
|
||||||
{
|
-my_strnncollsp_padspace_bin(b, b_length - length) :
|
||||||
int swap= 1;
|
my_strnncollsp_padspace_bin(a, a_length - length);
|
||||||
/*
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -276,9 +276,7 @@ static int my_strnncoll_czech(CHARSET_INFO *cs __attribute__((unused)),
|
|||||||
static
|
static
|
||||||
int my_strnncollsp_czech(CHARSET_INFO * cs,
|
int my_strnncollsp_czech(CHARSET_INFO * cs,
|
||||||
const uchar *s, size_t slen,
|
const uchar *s, size_t slen,
|
||||||
const uchar *t, size_t tlen,
|
const uchar *t, size_t tlen)
|
||||||
my_bool diff_if_only_endspace_difference
|
|
||||||
__attribute__((unused)))
|
|
||||||
{
|
{
|
||||||
for ( ; slen && s[slen-1] == ' ' ; slen--);
|
for ( ; slen && s[slen-1] == ' ' ; slen--);
|
||||||
for ( ; tlen && t[tlen-1] == ' ' ; tlen--);
|
for ( ; tlen && t[tlen-1] == ' ' ; tlen--);
|
||||||
|
@ -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)),
|
static int my_strnncollsp_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
|
||||||
const uchar *a, size_t a_length,
|
const uchar *a, size_t a_length,
|
||||||
const uchar *b, size_t b_length,
|
const uchar *b, size_t b_length)
|
||||||
my_bool diff_if_only_endspace_difference)
|
|
||||||
{
|
{
|
||||||
const uchar *a_end= a + a_length, *b_end= b + 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;
|
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))
|
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)
|
if (b_extend)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
res= 0;
|
if (a < a_end)
|
||||||
if (a != a_end || b != b_end)
|
return my_strnncollsp_padspace_bin(a, a_end - a);
|
||||||
{
|
if (b < b_end)
|
||||||
int swap= 1;
|
return -my_strnncollsp_padspace_bin(b, b_end - b);
|
||||||
if (diff_if_only_endspace_difference)
|
return 0;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -128,9 +128,6 @@ int my_strnncoll_simple(CHARSET_INFO * cs, const uchar *s, size_t slen,
|
|||||||
a_length Length of 'a'
|
a_length Length of 'a'
|
||||||
b Second string to compare
|
b Second string to compare
|
||||||
b_length Length of 'b'
|
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
|
IMPLEMENTATION
|
||||||
If one string is shorter as the other, then we space extend the other
|
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,
|
int my_strnncollsp_simple(CHARSET_INFO * cs, const uchar *a, size_t a_length,
|
||||||
const uchar *b, size_t b_length,
|
const uchar *b, size_t b_length)
|
||||||
my_bool diff_if_only_endspace_difference)
|
|
||||||
{
|
{
|
||||||
const uchar *map= cs->sort_order, *end;
|
const uchar *map= cs->sort_order, *end;
|
||||||
size_t length;
|
size_t length;
|
||||||
int res;
|
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));
|
end= a + (length= MY_MIN(a_length, b_length));
|
||||||
while (a < end)
|
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)
|
if (a_length != b_length)
|
||||||
{
|
{
|
||||||
int swap= 1;
|
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 < ' ',
|
Check the next not space character of the longer key. If it's < ' ',
|
||||||
then it's smaller than the other key.
|
then it's smaller than the other key.
|
||||||
|
@ -543,17 +543,12 @@ int my_strnncoll_tis620(CHARSET_INFO *cs __attribute__((unused)),
|
|||||||
static
|
static
|
||||||
int my_strnncollsp_tis620(CHARSET_INFO * cs __attribute__((unused)),
|
int my_strnncollsp_tis620(CHARSET_INFO * cs __attribute__((unused)),
|
||||||
const uchar *a0, size_t a_length,
|
const uchar *a0, size_t a_length,
|
||||||
const uchar *b0, size_t b_length,
|
const uchar *b0, size_t b_length)
|
||||||
my_bool diff_if_only_endspace_difference)
|
|
||||||
{
|
{
|
||||||
uchar buf[80], *end, *a, *b, *alloced= NULL;
|
uchar buf[80], *end, *a, *b, *alloced= NULL;
|
||||||
size_t length;
|
size_t length;
|
||||||
int res= 0;
|
int res= 0;
|
||||||
|
|
||||||
#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE
|
|
||||||
diff_if_only_endspace_difference= 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
a= buf;
|
a= buf;
|
||||||
if ((a_length + b_length +2) > (int) sizeof(buf))
|
if ((a_length + b_length +2) > (int) sizeof(buf))
|
||||||
alloced= a= (uchar*) my_str_malloc(a_length+b_length+2);
|
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;
|
goto ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (a_length != b_length)
|
|
||||||
{
|
res= a_length == b_length ? 0 :
|
||||||
int swap= 1;
|
a_length < b_length ?
|
||||||
if (diff_if_only_endspace_difference)
|
-my_strnncollsp_padspace_bin(b, b_length - length) :
|
||||||
res= 1; /* Assume 'a' is bigger */
|
my_strnncollsp_padspace_bin(a, a_length - length);
|
||||||
/*
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ret:
|
ret:
|
||||||
|
|
||||||
if (alloced)
|
if (alloced)
|
||||||
|
@ -20775,9 +20775,6 @@ my_char_weight_addr(const MY_UCA_WEIGHT_LEVEL *level, uint wc)
|
|||||||
slen First string length
|
slen First string length
|
||||||
t Second string
|
t Second string
|
||||||
tlen Seconf string length
|
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:
|
NOTES:
|
||||||
Works exactly the same with my_strnncoll_uca(),
|
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,
|
static int my_strnncollsp_uca(CHARSET_INFO *cs,
|
||||||
my_uca_scanner_handler *scanner_handler,
|
my_uca_scanner_handler *scanner_handler,
|
||||||
const uchar *s, size_t slen,
|
const uchar *s, size_t slen,
|
||||||
const uchar *t, size_t tlen,
|
const uchar *t, size_t tlen)
|
||||||
my_bool diff_if_only_endspace_difference)
|
|
||||||
{
|
{
|
||||||
my_uca_scanner sscanner, tscanner;
|
my_uca_scanner sscanner, tscanner;
|
||||||
int s_res, t_res;
|
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(&sscanner, cs, &cs->uca->level[0], s, slen);
|
||||||
scanner_handler->init(&tscanner, cs, &cs->uca->level[0], t, tlen);
|
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);
|
return (s_res - t_res);
|
||||||
s_res= scanner_handler->next(&sscanner);
|
s_res= scanner_handler->next(&sscanner);
|
||||||
} while (s_res > 0);
|
} while (s_res > 0);
|
||||||
return diff_if_only_endspace_difference ? 1 : 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s_res < 0 && t_res > 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);
|
return (s_res - t_res);
|
||||||
t_res= scanner_handler->next(&tscanner);
|
t_res= scanner_handler->next(&tscanner);
|
||||||
} while (t_res > 0);
|
} while (t_res > 0);
|
||||||
return diff_if_only_endspace_difference ? -1 : 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ( s_res - t_res );
|
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,
|
static int my_strnncollsp_any_uca(CHARSET_INFO *cs,
|
||||||
const uchar *s, size_t slen,
|
const uchar *s, size_t slen,
|
||||||
const uchar *t, size_t tlen,
|
const uchar *t, size_t tlen)
|
||||||
my_bool diff_if_only_endspace_difference)
|
|
||||||
{
|
{
|
||||||
return my_strnncollsp_uca(cs, &my_any_uca_scanner_handler,
|
return my_strnncollsp_uca(cs, &my_any_uca_scanner_handler, s, slen, t, tlen);
|
||||||
s, slen, t, tlen,
|
|
||||||
diff_if_only_endspace_difference);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void my_hash_sort_any_uca(CHARSET_INFO *cs,
|
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,
|
static int my_strnncollsp_ucs2_uca(CHARSET_INFO *cs,
|
||||||
const uchar *s, size_t slen,
|
const uchar *s, size_t slen,
|
||||||
const uchar *t, size_t tlen,
|
const uchar *t, size_t tlen)
|
||||||
my_bool diff_if_only_endspace_difference)
|
|
||||||
{
|
{
|
||||||
return my_strnncollsp_uca(cs, &my_any_uca_scanner_handler,
|
return my_strnncollsp_uca(cs, &my_any_uca_scanner_handler, s, slen, t, tlen);
|
||||||
s, slen, t, tlen,
|
|
||||||
diff_if_only_endspace_difference);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void my_hash_sort_ucs2_uca(CHARSET_INFO *cs,
|
static void my_hash_sort_ucs2_uca(CHARSET_INFO *cs,
|
||||||
|
@ -5678,8 +5678,7 @@ static int my_strnncoll_utf8_cs(CHARSET_INFO *cs,
|
|||||||
|
|
||||||
static int my_strnncollsp_utf8_cs(CHARSET_INFO *cs,
|
static int my_strnncollsp_utf8_cs(CHARSET_INFO *cs,
|
||||||
const uchar *s, size_t slen,
|
const uchar *s, size_t slen,
|
||||||
const uchar *t, size_t tlen,
|
const uchar *t, size_t tlen)
|
||||||
my_bool diff_if_only_endspace_difference)
|
|
||||||
{
|
{
|
||||||
int s_res, t_res, res;
|
int s_res, t_res, res;
|
||||||
my_wc_t s_wc, t_wc;
|
my_wc_t s_wc, t_wc;
|
||||||
@ -5688,10 +5687,6 @@ static int my_strnncollsp_utf8_cs(CHARSET_INFO *cs,
|
|||||||
int save_diff= 0;
|
int save_diff= 0;
|
||||||
MY_UNICASE_INFO *uni_plane= cs->caseinfo;
|
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 )
|
while ( s < se && t < te )
|
||||||
{
|
{
|
||||||
s_res=my_utf8_uni(cs,&s_wc, s, se);
|
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;
|
slen= se-s;
|
||||||
tlen= te-t;
|
tlen= te-t;
|
||||||
res= 0;
|
|
||||||
|
/*
|
||||||
if (slen != tlen)
|
The following code uses the fact that in UTF-8
|
||||||
{
|
all multibyte characters are greater than space,
|
||||||
int swap= 1;
|
and all multibyte head characters are greater than
|
||||||
if (diff_if_only_endspace_difference)
|
space. It means if we meet a character greater
|
||||||
res= 1; /* Assume 'a' is bigger */
|
than space, it always means that the longer string
|
||||||
if (slen < tlen)
|
is greater. So we can reuse the same loop from the
|
||||||
{
|
8bit version, without having to process full multibute
|
||||||
slen= tlen;
|
sequences.
|
||||||
s= t;
|
*/
|
||||||
se= te;
|
if ((res= slen == tlen ? 0 :
|
||||||
swap= -1;
|
slen < tlen ?
|
||||||
res= -res;
|
-my_strnncollsp_padspace_bin(t, tlen) :
|
||||||
}
|
my_strnncollsp_padspace_bin(s, slen)))
|
||||||
/*
|
return 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return save_diff;
|
return save_diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -478,9 +478,7 @@ static int my_strnncoll_win1250ch(CHARSET_INFO *cs __attribute__((unused)),
|
|||||||
static
|
static
|
||||||
int my_strnncollsp_win1250ch(CHARSET_INFO * cs,
|
int my_strnncollsp_win1250ch(CHARSET_INFO * cs,
|
||||||
const uchar *s, size_t slen,
|
const uchar *s, size_t slen,
|
||||||
const uchar *t, size_t tlen,
|
const uchar *t, size_t tlen)
|
||||||
my_bool diff_if_only_endspace_difference
|
|
||||||
__attribute__((unused)))
|
|
||||||
{
|
{
|
||||||
for ( ; slen && s[slen-1] == ' ' ; slen--);
|
for ( ; slen && s[slen-1] == ' ' ; slen--);
|
||||||
for ( ; tlen && t[tlen-1] == ' ' ; tlen--);
|
for ( ; tlen && t[tlen-1] == ' ' ; tlen--);
|
||||||
|
@ -210,17 +210,13 @@ MY_FUNCTION_NAME(strnncoll)(CHARSET_INFO *cs __attribute__((unused)),
|
|||||||
@param a_length - the length of the left string
|
@param a_length - the length of the left string
|
||||||
@param b - the right string
|
@param b - the right string
|
||||||
@param b_length - the length of 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
|
@return - the comparison result
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
MY_FUNCTION_NAME(strnncollsp)(CHARSET_INFO *cs __attribute__((unused)),
|
MY_FUNCTION_NAME(strnncollsp)(CHARSET_INFO *cs __attribute__((unused)),
|
||||||
const uchar *a, size_t a_length,
|
const uchar *a, size_t a_length,
|
||||||
const uchar *b, size_t b_length,
|
const uchar *b, size_t b_length)
|
||||||
my_bool diff_if_only_endspace_difference
|
|
||||||
__attribute__((unused)))
|
|
||||||
{
|
{
|
||||||
const uchar *a_end= a + a_length;
|
const uchar *a_end= a + a_length;
|
||||||
const uchar *b_end= b + b_length;
|
const uchar *b_end= b + b_length;
|
||||||
|
@ -627,7 +627,7 @@ strcollsp(CHARSET_INFO *cs, const STRNNCOLL_PARAM *param)
|
|||||||
{
|
{
|
||||||
char ahex[64], bhex[64];
|
char ahex[64], bhex[64];
|
||||||
int res= cs->coll->strnncollsp(cs, (uchar *) p->a, p->alen,
|
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(ahex, sizeof(ahex), p->a, p->alen);
|
||||||
str2hex(bhex, sizeof(bhex), p->b, p->blen);
|
str2hex(bhex, sizeof(bhex), p->b, p->blen);
|
||||||
diag("%-20s %-10s %-10s %10d %10d%s",
|
diag("%-20s %-10s %-10s %10d %10d%s",
|
||||||
@ -641,7 +641,7 @@ strcollsp(CHARSET_INFO *cs, const STRNNCOLL_PARAM *param)
|
|||||||
{
|
{
|
||||||
/* Test in reverse order */
|
/* Test in reverse order */
|
||||||
res= cs->coll->strnncollsp(cs, (uchar *) p->b, p->blen,
|
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))
|
if (!eqres(res, -p->res))
|
||||||
{
|
{
|
||||||
diag("Comparison in reverse order failed. Expected %d, got %d",
|
diag("Comparison in reverse order failed. Expected %d, got %d",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user