Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
ed75a5da
Commit
ed75a5da
authored
Feb 04, 2004
by
bar@bar.intranet.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
http://bugs.mysql.com/bug.php?id=2619
Bug #2619 ucs2 LIKE comparison fails in some cases Fixes
parent
147afc0f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
116 additions
and
10 deletions
+116
-10
mysql-test/r/ctype_ucs.result
mysql-test/r/ctype_ucs.result
+75
-0
mysql-test/t/ctype_ucs.test
mysql-test/t/ctype_ucs.test
+29
-0
strings/ctype-ucs2.c
strings/ctype-ucs2.c
+12
-10
No files found.
mysql-test/r/ctype_ucs.result
View file @
ed75a5da
...
...
@@ -77,6 +77,9 @@ a
test
select * from t1 where a like "%a%";
a
a
abc
abcd
select * from t1 where a like "%abcd%";
a
abcd
...
...
@@ -84,6 +87,78 @@ select * from t1 where a like "%abc\d%";
a
abcd
drop table t1;
select 'AA' like 'AA';
'AA' like 'AA'
1
select 'AA' like 'A%A';
'AA' like 'A%A'
1
select 'AA' like 'A%%A';
'AA' like 'A%%A'
1
select 'AA' like 'AA%';
'AA' like 'AA%'
1
select 'AA' like '%AA%';
'AA' like '%AA%'
1
select 'AA' like '%A';
'AA' like '%A'
1
select 'AA' like '%AA';
'AA' like '%AA'
1
select 'AA' like 'A%A%';
'AA' like 'A%A%'
1
select 'AA' like '_%_%';
'AA' like '_%_%'
1
select 'AA' like '%A%A';
'AA' like '%A%A'
1
select 'AAA'like 'A%A%A';
'AAA'like 'A%A%A'
1
select 'AZ' like 'AZ';
'AZ' like 'AZ'
1
select 'AZ' like 'A%Z';
'AZ' like 'A%Z'
1
select 'AZ' like 'A%%Z';
'AZ' like 'A%%Z'
1
select 'AZ' like 'AZ%';
'AZ' like 'AZ%'
1
select 'AZ' like '%AZ%';
'AZ' like '%AZ%'
1
select 'AZ' like '%Z';
'AZ' like '%Z'
1
select 'AZ' like '%AZ';
'AZ' like '%AZ'
1
select 'AZ' like 'A%Z%';
'AZ' like 'A%Z%'
1
select 'AZ' like '_%_%';
'AZ' like '_%_%'
1
select 'AZ' like '%A%Z';
'AZ' like '%A%Z'
1
select 'AZ' like 'A_';
'AZ' like 'A_'
1
select 'AZ' like '_Z';
'AZ' like '_Z'
1
select 'AMZ'like 'A%M%Z';
'AMZ'like 'A%M%Z'
1
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ucs2);
INSERT INTO t1 VALUES (''),(''),(''),(''),(''),('');
INSERT INTO t1 VALUES (''),(''),(''),('');
...
...
mysql-test/t/ctype_ucs.test
View file @
ed75a5da
...
...
@@ -69,6 +69,35 @@ select * from t1 where a like "%abcd%";
select
*
from
t1
where
a
like
"%abc\d%"
;
drop
table
t1
;
#
# More LIKE test: bug#2619
#
select
'AA'
like
'AA'
;
select
'AA'
like
'A%A'
;
select
'AA'
like
'A%%A'
;
select
'AA'
like
'AA%'
;
select
'AA'
like
'%AA%'
;
select
'AA'
like
'%A'
;
select
'AA'
like
'%AA'
;
select
'AA'
like
'A%A%'
;
select
'AA'
like
'_%_%'
;
select
'AA'
like
'%A%A'
;
select
'AAA'
like
'A%A%A'
;
select
'AZ'
like
'AZ'
;
select
'AZ'
like
'A%Z'
;
select
'AZ'
like
'A%%Z'
;
select
'AZ'
like
'AZ%'
;
select
'AZ'
like
'%AZ%'
;
select
'AZ'
like
'%Z'
;
select
'AZ'
like
'%AZ'
;
select
'AZ'
like
'A%Z%'
;
select
'AZ'
like
'_%_%'
;
select
'AZ'
like
'%A%Z'
;
select
'AZ'
like
'A_'
;
select
'AZ'
like
'_Z'
;
select
'AMZ'
like
'A%M%Z'
;
CREATE
TABLE
t1
(
a
VARCHAR
(
10
)
CHARACTER
SET
ucs2
);
INSERT
INTO
t1
VALUES
(
''
),(
''
),(
''
),(
''
),(
''
),(
''
);
INSERT
INTO
t1
VALUES
(
''
),(
''
),(
''
),(
''
);
...
...
strings/ctype-ucs2.c
View file @
ed75a5da
...
...
@@ -1044,14 +1044,13 @@ int my_wildcmp_ucs2(CHARSET_INFO *cs,
scan
=
my_ucs2_uni
(
cs
,
&
w_wc
,
(
const
uchar
*
)
wildstr
,
(
const
uchar
*
)
wildend
);
if
(
scan
<=
0
)
return
1
;
wildstr
+=
scan
;
if
(
w_wc
==
(
my_wc_t
)
escape
)
{
wildstr
+=
scan
;
scan
=
my_ucs2_uni
(
cs
,
&
w_wc
,
(
const
uchar
*
)
wildstr
,
(
const
uchar
*
)
wildend
);
if
(
scan
<=
0
)
return
1
;
wildstr
+=
scan
;
}
if
(
w_wc
==
(
my_wc_t
)
w_many
)
...
...
@@ -1060,6 +1059,7 @@ int my_wildcmp_ucs2(CHARSET_INFO *cs,
break
;
}
wildstr
+=
scan
;
scan
=
my_ucs2_uni
(
cs
,
&
s_wc
,
(
const
uchar
*
)
str
,
(
const
uchar
*
)
str_end
);
if
(
scan
<=
0
)
return
1
;
...
...
@@ -1095,13 +1095,16 @@ int my_wildcmp_ucs2(CHARSET_INFO *cs,
scan
=
my_ucs2_uni
(
cs
,
&
w_wc
,
(
const
uchar
*
)
wildstr
,
(
const
uchar
*
)
wildend
);
if
(
scan
<=
0
)
return
1
;
wildstr
+=
scan
;
if
(
w_wc
==
(
my_wc_t
)
w_many
)
{
wildstr
+=
scan
;
continue
;
}
if
(
w_wc
==
(
my_wc_t
)
w_one
)
{
wildstr
+=
scan
;
scan
=
my_ucs2_uni
(
cs
,
&
s_wc
,
(
const
uchar
*
)
str
,
(
const
uchar
*
)
str_end
);
if
(
scan
<=
0
)
return
1
;
...
...
@@ -1120,17 +1123,16 @@ int my_wildcmp_ucs2(CHARSET_INFO *cs,
scan
=
my_ucs2_uni
(
cs
,
&
w_wc
,
(
const
uchar
*
)
wildstr
,
(
const
uchar
*
)
wildend
);
if
(
scan
<=
0
)
return
1
;
wildstr
+=
scan
;
if
(
w_wc
==
(
my_wc_t
)
escape
)
{
wildstr
+=
scan
;
scan
=
my_ucs2_uni
(
cs
,
&
w_wc
,
(
const
uchar
*
)
wildstr
,
(
const
uchar
*
)
wildend
);
if
(
scan
<=
0
)
return
1
;
wildstr
+=
scan
;
}
do
while
(
1
)
{
/* Skip until the first character from wildstr is found */
while
(
str
!=
str_end
)
...
...
@@ -1138,8 +1140,6 @@ int my_wildcmp_ucs2(CHARSET_INFO *cs,
scan
=
my_ucs2_uni
(
cs
,
&
s_wc
,
(
const
uchar
*
)
str
,
(
const
uchar
*
)
str_end
);
if
(
scan
<=
0
)
return
1
;
str
+=
scan
;
if
(
weights
)
{
plane
=
(
s_wc
>>
8
)
&
0xFF
;
...
...
@@ -1150,17 +1150,19 @@ int my_wildcmp_ucs2(CHARSET_INFO *cs,
if
(
s_wc
==
w_wc
)
break
;
str
+=
scan
;
}
if
(
str
==
str_end
)
return
-
1
;
result
=
my_wildcmp_ucs2
(
cs
,
str
,
str_end
,
wildstr
,
wildend
,
escape
,
w_one
,
w_many
,
weights
);
if
(
result
<=
0
)
return
result
;
}
while
(
str
!=
str_end
&&
w_wc
!=
(
my_wc_t
)
w_many
)
;
return
-
1
;
str
+=
scan
;
}
}
}
return
(
str
!=
str_end
?
1
:
0
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment