Bug#8840 Empty string comparison and character set 'cp1250'

Secondary weight out of bounds was picked up in mistake when
the string is empty, instead of returning 0.
This commit is contained in:
unknown 2005-03-03 14:15:37 +04:00
commit d6c9c19412
5 changed files with 28 additions and 1 deletions

View file

@ -0,0 +1,4 @@
-- require r/have_cp1250_ch.require
disable_query_log;
show collation like "cp1250_czech_cs";
enable_query_log;

View file

@ -0,0 +1,9 @@
SHOW COLLATION LIKE 'cp1250_czech_cs';
Collation Charset Id Default Compiled Sortlen
cp1250_czech_cs cp1250 34 Yes 2
CREATE TABLE t1 (a char(16)) character set cp1250 collate cp1250_czech_cs;
INSERT INTO t1 VALUES ('');
SELECT a, length(a), a='', a=' ', a=' ' FROM t1;
a length(a) a='' a=' ' a=' '
0 1 1 1
DROP TABLE t1;

View file

@ -0,0 +1,2 @@
Collation Charset Id Default Compiled Sortlen
cp1250_czech_cs cp1250 34 Yes 2

View file

@ -0,0 +1,12 @@
-- source include/have_cp1250_ch.inc
SHOW COLLATION LIKE 'cp1250_czech_cs';
#
# Bugs: #8840: Empty string comparison and character set 'cp1250'
#
CREATE TABLE t1 (a char(16)) character set cp1250 collate cp1250_czech_cs;
INSERT INTO t1 VALUES ('');
SELECT a, length(a), a='', a=' ', a=' ' FROM t1;
DROP TABLE t1;

View file

@ -416,7 +416,7 @@ static struct wordvalue doubles[] = {
#define NEXT_CMP_VALUE(src, p, pass, value, len) \
while (1) { \
if (IS_END(p, src, len)) { \
if (pass == 0) { p = src; pass++; } \
if (pass == 0 && len > 0) { p= src; pass++; } \
else { value = 0; break; } \
} \
value = ((pass == 0) ? _sort_order_win1250ch1[*p] \