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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
e28976e0
Commit
e28976e0
authored
Oct 21, 2004
by
bar@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug #5679 utf8_unicode_ci LIKE--trailing % doesn't equal zero characters
parent
e9fde8f5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
4 deletions
+81
-4
mysql-test/t/ctype_uca.test
mysql-test/t/ctype_uca.test
+28
-1
strings/ctype-uca.c
strings/ctype-uca.c
+53
-3
No files found.
mysql-test/t/ctype_uca.test
View file @
e28976e0
...
...
@@ -7,8 +7,35 @@ DROP TABLE IF EXISTS t1;
#
# Test Unicode collations.
#
set
names
utf8
;
#
# Check trailing spaces
#
set
collation_connection
=
utf8_unicode_ci
;
select
'a'
=
'a'
,
'a'
=
'a '
,
'a '
=
'a'
;
select
'a\t'
=
'a'
,
'a\t'
<
'a'
,
'a\t'
>
'a'
;
select
'a\t'
=
'a '
,
'a\t'
<
'a '
,
'a\t'
>
'a '
;
select
'a'
=
'a\t'
,
'a'
<
'a\t'
,
'a'
>
'a\t'
;
select
'a '
=
'a\t'
,
'a '
<
'a\t'
,
'a '
>
'a\t'
;
select
'a a'
>
'a'
,
'a \t'
<
'a'
;
#
# Bug #5679 utf8_unicode_ci LIKE--trailing % doesn't equal zero characters
#
CREATE
TABLE
t
(
c
char
(
20
)
NOT
NULL
)
ENGINE
=
MyISAM
DEFAULT
CHARSET
=
utf8
COLLATE
=
utf8_unicode_ci
;
INSERT
INTO
t
VALUES
(
'a'
),(
'ab'
),(
'aba'
);
ALTER
TABLE
t
ADD
INDEX
(
c
);
SELECT
c
FROM
t
WHERE
c
LIKE
'a%'
;
#should find 3 rows but only found 2
DROP
TABLE
t
;
create
table
t1
(
c1
char
(
10
)
character
set
utf8
collate
utf8_bin
);
#
...
...
strings/ctype-uca.c
View file @
e28976e0
...
...
@@ -7052,6 +7052,28 @@ static int my_strnncoll_uca(CHARSET_INFO *cs,
NOTES:
Works exactly the same with my_strnncoll_uca(),
but ignores trailing spaces.
In the while() comparison these situations are possible:
1. (s_res>0) and (t_res>0) and (s_res == t_res)
Weights are the same so far, continue comparison
2. (s_res>0) and (t_res>0) and (s_res!=t_res)
A difference has been found, return.
3. (s_res>0) and (t_res<0)
We have reached the end of the second string, or found
an illegal multibyte sequence in the second string.
Compare the first string to an infinite array of
space characters until difference is found, or until
the end of the first string.
4. (s_res<0) and (t_res>0)
We have reached the end of the first string, or found
an illegal multibyte sequence in the first string.
Compare the second string to an infinite array of
space characters until difference is found or until
the end of the second steing.
5. (s_res<0) and (t_res<0)
Both scanners returned -1. It means we have riched
the end-of-string of illegal-sequence in both strings
at the same time. Return 0, strings are equal.
RETURN
Difference between two strings, according to the collation:
...
...
@@ -7070,9 +7092,6 @@ static int my_strnncollsp_uca(CHARSET_INFO *cs,
int
s_res
;
int
t_res
;
slen
=
cs
->
cset
->
lengthsp
(
cs
,
(
char
*
)
s
,
slen
);
tlen
=
cs
->
cset
->
lengthsp
(
cs
,
(
char
*
)
t
,
tlen
);
scanner_handler
->
init
(
&
sscanner
,
cs
,
s
,
slen
);
scanner_handler
->
init
(
&
tscanner
,
cs
,
t
,
tlen
);
...
...
@@ -7080,6 +7099,37 @@ static int my_strnncollsp_uca(CHARSET_INFO *cs,
{
s_res
=
scanner_handler
->
next
(
&
sscanner
);
t_res
=
scanner_handler
->
next
(
&
tscanner
);
if
(
s_res
>
0
&&
t_res
<
0
)
{
/* Calculate weight for SPACE character */
t_res
=
cs
->
sort_order_big
[
0
][
0x20
*
cs
->
sort_order
[
0
]];
/* compare the first string to spaces */
do
{
if
(
s_res
!=
t_res
)
return
(
s_res
-
t_res
);
s_res
=
scanner_handler
->
next
(
&
sscanner
);
}
while
(
s_res
>
0
);
return
0
;
}
if
(
s_res
<
0
&&
t_res
>
0
)
{
/* Calculate weight for SPACE character */
s_res
=
cs
->
sort_order_big
[
0
][
0x20
*
cs
->
sort_order
[
0
]];
/* compare the second string to spaces */
do
{
if
(
s_res
!=
t_res
)
return
(
s_res
-
t_res
);
t_res
=
scanner_handler
->
next
(
&
tscanner
);
}
while
(
t_res
>
0
);
return
0
;
}
}
while
(
s_res
==
t_res
&&
s_res
>
0
);
return
(
s_res
-
t_res
);
...
...
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