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
a38160f3
Commit
a38160f3
authored
Dec 01, 2004
by
bar@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move common trailing space checks into an include file.
Check UCS2 trailing spaces.
parent
0718f788
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
105 additions
and
10 deletions
+105
-10
mysql-test/include/endspace.inc
mysql-test/include/endspace.inc
+7
-0
mysql-test/r/ctype_ucs.result
mysql-test/r/ctype_ucs.result
+23
-0
mysql-test/t/ctype_ucs.test
mysql-test/t/ctype_ucs.test
+4
-0
mysql-test/t/endspace.test
mysql-test/t/endspace.test
+1
-7
strings/ctype-ucs2.c
strings/ctype-ucs2.c
+70
-3
No files found.
mysql-test/include/endspace.inc
0 → 100644
View file @
a38160f3
select
'a'
=
'a'
,
'a'
=
'a '
,
'a '
=
'a'
;
select
'a\0'
=
'a'
,
'a\0'
<
'a'
,
'a\0'
>
'a'
;
select
'a'
=
'a\0'
,
'a'
<
'a\0'
,
'a'
>
'a\0'
;
select
'a\0'
=
'a '
,
'a\0'
<
'a '
,
'a\0'
>
'a '
;
select
'a '
=
'a\0'
,
'a '
<
'a\0'
,
'a '
>
'a\0'
;
select
'a a'
>
'a'
,
'a \0'
<
'a'
;
select
binary
'a a'
>
'a'
,
binary
'a \0'
>
'a'
,
binary
'a\0'
>
'a'
;
mysql-test/r/ctype_ucs.result
View file @
a38160f3
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t1;
SET NAMES latin1;
SET character_set_connection=ucs2;
select 'a' = 'a', 'a' = 'a ', 'a ' = 'a';
'a' = 'a' 'a' = 'a ' 'a ' = 'a'
1 1 1
select 'a\0' = 'a', 'a\0' < 'a', 'a\0' > 'a';
'a\0' = 'a' 'a\0' < 'a' 'a\0' > 'a'
0 1 0
select 'a' = 'a\0', 'a' < 'a\0', 'a' > 'a\0';
'a' = 'a\0' 'a' < 'a\0' 'a' > 'a\0'
0 0 1
select 'a\0' = 'a ', 'a\0' < 'a ', 'a\0' > 'a ';
'a\0' = 'a ' 'a\0' < 'a ' 'a\0' > 'a '
0 1 0
select 'a ' = 'a\0', 'a ' < 'a\0', 'a ' > 'a\0';
'a ' = 'a\0' 'a ' < 'a\0' 'a ' > 'a\0'
0 0 1
select 'a a' > 'a', 'a \0' < 'a';
'a a' > 'a' 'a \0' < 'a'
1 1
select binary 'a a' > 'a', binary 'a \0' > 'a', binary 'a\0' > 'a';
binary 'a a' > 'a' binary 'a \0' > 'a' binary 'a\0' > 'a'
1 1 1
SET CHARACTER SET koi8r;
SET CHARACTER SET koi8r;
CREATE TABLE t1 (word VARCHAR(64) CHARACTER SET ucs2);
CREATE TABLE t1 (word VARCHAR(64) CHARACTER SET ucs2);
INSERT INTO t1 VALUES (_koi8r''), (X'2004');
INSERT INTO t1 VALUES (_koi8r''), (X'2004');
...
...
mysql-test/t/ctype_ucs.test
View file @
a38160f3
...
@@ -4,6 +4,10 @@
...
@@ -4,6 +4,10 @@
DROP
TABLE
IF
EXISTS
t1
;
DROP
TABLE
IF
EXISTS
t1
;
--
enable_warnings
--
enable_warnings
SET
NAMES
latin1
;
SET
character_set_connection
=
ucs2
;
--
source
include
/
endspace
.
inc
SET
CHARACTER
SET
koi8r
;
SET
CHARACTER
SET
koi8r
;
#
#
...
...
mysql-test/t/endspace.test
View file @
a38160f3
...
@@ -7,13 +7,7 @@
...
@@ -7,13 +7,7 @@
drop
table
if
exists
t1
;
drop
table
if
exists
t1
;
--
enable_warnings
--
enable_warnings
select
'a'
=
'a'
,
'a'
=
'a '
,
'a '
=
'a'
;
--
source
include
/
endspace
.
inc
select
'a\0'
=
'a'
,
'a\0'
<
'a'
,
'a\0'
>
'a'
;
select
'a'
=
'a\0'
,
'a'
<
'a\0'
,
'a'
>
'a\0'
;
select
'a\0'
=
'a '
,
'a\0'
<
'a '
,
'a\0'
>
'a '
;
select
'a '
=
'a\0'
,
'a '
<
'a\0'
,
'a '
>
'a\0'
;
select
'a a'
>
'a'
,
'a \0'
<
'a'
;
select
binary
'a a'
>
'a'
,
binary
'a \0'
>
'a'
,
binary
'a\0'
>
'a'
;
#
#
# Test MyISAM tables.
# Test MyISAM tables.
...
...
strings/ctype-ucs2.c
View file @
a38160f3
...
@@ -218,11 +218,78 @@ static int my_strnncoll_ucs2(CHARSET_INFO *cs,
...
@@ -218,11 +218,78 @@ static int my_strnncoll_ucs2(CHARSET_INFO *cs,
return
t_is_prefix
?
t
-
te
:
((
se
-
s
)
-
(
te
-
t
));
return
t_is_prefix
?
t
-
te
:
((
se
-
s
)
-
(
te
-
t
));
}
}
static
int
my_strnncollsp_ucs2
(
CHARSET_INFO
*
cs
,
/*
Compare strings, discarding end space
SYNOPSIS
my_strnncollsp_ucs2()
cs character set handler
a First string to compare
a_length Length of 'a'
b Second string to compare
b_length Length of 'b'
IMPLEMENTATION
If one string is shorter as the other, then we space extend the other
so that the strings have equal length.
This will ensure that the following things hold:
"a" == "a "
"a\0" < "a"
"a\0" < "a "
RETURN
< 0 a < b
= 0 a == b
> 0 a > b
*/
static
int
my_strnncollsp_ucs2
(
CHARSET_INFO
*
cs
__attribute__
((
unused
)),
const
uchar
*
s
,
uint
slen
,
const
uchar
*
s
,
uint
slen
,
const
uchar
*
t
,
uint
tlen
)
const
uchar
*
t
,
uint
tlen
)
{
{
return
my_strnncoll_ucs2
(
cs
,
s
,
slen
,
t
,
tlen
,
0
);
const
uchar
*
se
,
*
te
;
uint
minlen
;
/* extra safety to make sure the lengths are even numbers */
slen
=
(
slen
>>
1
)
<<
1
;
tlen
=
(
tlen
>>
1
)
<<
1
;
se
=
s
+
slen
;
te
=
t
+
tlen
;
for
(
minlen
=
min
(
slen
,
tlen
);
minlen
;
minlen
-=
2
)
{
int
s_wc
=
uni_plane
[
s
[
0
]]
?
(
int
)
uni_plane
[
s
[
0
]][
s
[
1
]].
sort
:
(((
int
)
s
[
0
])
<<
8
)
+
(
int
)
s
[
1
];
int
t_wc
=
uni_plane
[
t
[
0
]]
?
(
int
)
uni_plane
[
t
[
0
]][
t
[
1
]].
sort
:
(((
int
)
t
[
0
])
<<
8
)
+
(
int
)
t
[
1
];
if
(
s_wc
!=
t_wc
)
return
s_wc
-
t_wc
;
s
+=
2
;
t
+=
2
;
}
if
(
slen
!=
tlen
)
{
int
swap
=
0
;
if
(
slen
<
tlen
)
{
s
=
t
;
se
=
te
;
swap
=
-
1
;
}
for
(
;
s
<
se
;
s
+=
2
)
{
if
(
s
[
0
]
||
s
[
1
]
!=
' '
)
return
(((
int
)
s
[
0
]
<<
8
)
+
(
int
)
s
[
1
]
-
(
int
)
' '
)
^
swap
;
}
}
return
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