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
a9ac3cde
Commit
a9ac3cde
authored
Oct 13, 2010
by
Ramil Kalimullin
Browse files
Options
Browse Files
Download
Plain Diff
Merge.
parents
b265bd10
9ef7eac2
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
111 additions
and
0 deletions
+111
-0
mysql-test/r/ctype_utf8.result
mysql-test/r/ctype_utf8.result
+31
-0
mysql-test/r/func_misc.result
mysql-test/r/func_misc.result
+7
-0
mysql-test/t/ctype_utf8.test
mysql-test/t/ctype_utf8.test
+20
-0
mysql-test/t/func_misc.test
mysql-test/t/func_misc.test
+11
-0
sql/item_strfunc.cc
sql/item_strfunc.cc
+42
-0
No files found.
mysql-test/r/ctype_utf8.result
View file @
a9ac3cde
...
...
@@ -1898,6 +1898,37 @@ CONVERT(a, CHAR) CONVERT(b, CHAR)
70000 1092
DROP TABLE t1;
End of 5.0 tests
SELECT LENGTH(RPAD(0.0115E88, 61297, _utf8'яэюя'));
LENGTH(RPAD(0.0115E88, 61297, _utf8'яэюя'))
122587
SELECT LENGTH(RPAD(0.0115E88, 61297, _utf8'йцуя'));
LENGTH(RPAD(0.0115E88, 61297, _utf8'йцуя'))
122587
SELECT HEX(RPAD(0x20, 2, _utf8 0xD18F));
HEX(RPAD(0x20, 2, _utf8 0xD18F))
20D1
SELECT HEX(RPAD(0x20, 4, _utf8 0xD18F));
HEX(RPAD(0x20, 4, _utf8 0xD18F))
20D18FD1
SELECT HEX(LPAD(0x20, 2, _utf8 0xD18F));
HEX(LPAD(0x20, 2, _utf8 0xD18F))
D120
SELECT HEX(LPAD(0x20, 4, _utf8 0xD18F));
HEX(LPAD(0x20, 4, _utf8 0xD18F))
D18FD120
SELECT HEX(RPAD(_utf8 0xD18F, 3, 0x20));
HEX(RPAD(_utf8 0xD18F, 3, 0x20))
D18F20
SELECT HEX(LPAD(_utf8 0xD18F, 3, 0x20));
HEX(LPAD(_utf8 0xD18F, 3, 0x20))
20D18F
SELECT HEX(INSERT(_utf8 0xD18F, 2, 1, 0x20));
HEX(INSERT(_utf8 0xD18F, 2, 1, 0x20))
D120
SELECT HEX(INSERT(_utf8 0xD18FD18E, 2, 1, 0x20));
HEX(INSERT(_utf8 0xD18FD18E, 2, 1, 0x20))
D120D18E
End of 5.1 tests
Start of 5.4 tests
SET NAMES utf8mb3;
SHOW VARIABLES LIKE 'character_set_results%';
...
...
mysql-test/r/func_misc.result
View file @
a9ac3cde
...
...
@@ -375,4 +375,11 @@ GREATEST(a, (SELECT b FROM t1 LIMIT 1))
3
1
DROP TABLE t1;
SELECT INET_NTOA(0);
INET_NTOA(0)
0.0.0.0
SELECT '1' IN ('1', INET_NTOA(0));
'1' IN ('1', INET_NTOA(0))
1
End of 5.1 tests
End of tests
mysql-test/t/ctype_utf8.test
View file @
a9ac3cde
...
...
@@ -1439,6 +1439,26 @@ DROP TABLE t1;
--
echo
End
of
5.0
tests
#
# Bug #57272: crash in rpad() when using utf8
#
SELECT
LENGTH
(
RPAD
(
0.0115E88
,
61297
,
_utf8
'яэюя'
));
SELECT
LENGTH
(
RPAD
(
0.0115E88
,
61297
,
_utf8
'йцуя'
));
SELECT
HEX
(
RPAD
(
0x20
,
2
,
_utf8
0xD18F
));
SELECT
HEX
(
RPAD
(
0x20
,
4
,
_utf8
0xD18F
));
SELECT
HEX
(
LPAD
(
0x20
,
2
,
_utf8
0xD18F
));
SELECT
HEX
(
LPAD
(
0x20
,
4
,
_utf8
0xD18F
));
SELECT
HEX
(
RPAD
(
_utf8
0xD18F
,
3
,
0x20
));
SELECT
HEX
(
LPAD
(
_utf8
0xD18F
,
3
,
0x20
));
SELECT
HEX
(
INSERT
(
_utf8
0xD18F
,
2
,
1
,
0x20
));
SELECT
HEX
(
INSERT
(
_utf8
0xD18FD18E
,
2
,
1
,
0x20
));
--
echo
End
of
5.1
tests
--
echo
Start
of
5.4
tests
#
...
...
mysql-test/t/func_misc.test
View file @
a9ac3cde
...
...
@@ -504,4 +504,15 @@ SELECT DISTINCT GREATEST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1;
DROP
TABLE
t1
;
#
# Bug #57283: inet_ntoa() crashes
#
SELECT
INET_NTOA
(
0
);
SELECT
'1'
IN
(
'1'
,
INET_NTOA
(
0
));
--
echo
End
of
5.1
tests
--
echo
End
of
tests
sql/item_strfunc.cc
View file @
a9ac3cde
...
...
@@ -1184,6 +1184,20 @@ String *Item_func_insert::val_str(String *str)
if
((
length
<
0
)
||
(
length
>
res
->
length
()))
length
=
res
->
length
();
/*
There is one exception not handled (intentionaly) by the character set
aggregation code. If one string is strong side and is binary, and
another one is weak side and is a multi-byte character string,
then we need to operate on the second string in terms on bytes when
calling ::numchars() and ::charpos(), rather than in terms of characters.
Lets substitute its character set to binary.
*/
if
(
collation
.
collation
==
&
my_charset_bin
)
{
res
->
set_charset
(
&
my_charset_bin
);
res2
->
set_charset
(
&
my_charset_bin
);
}
/* start and length are now sufficiently valid to pass to charpos function */
start
=
res
->
charpos
((
int
)
start
);
length
=
res
->
charpos
((
int
)
length
,
(
uint32
)
start
);
...
...
@@ -2724,6 +2738,20 @@ String *Item_func_rpad::val_str(String *str)
/* Set here so that rest of code sees out-of-bound value as such. */
if
((
ulonglong
)
count
>
INT_MAX32
)
count
=
INT_MAX32
;
/*
There is one exception not handled (intentionaly) by the character set
aggregation code. If one string is strong side and is binary, and
another one is weak side and is a multi-byte character string,
then we need to operate on the second string in terms on bytes when
calling ::numchars() and ::charpos(), rather than in terms of characters.
Lets substitute its character set to binary.
*/
if
(
collation
.
collation
==
&
my_charset_bin
)
{
res
->
set_charset
(
&
my_charset_bin
);
rpad
->
set_charset
(
&
my_charset_bin
);
}
if
(
count
<=
(
res_char_length
=
res
->
numchars
()))
{
// String to pad is big enough
res
->
length
(
res
->
charpos
((
int
)
count
));
// Shorten result if longer
...
...
@@ -2813,6 +2841,20 @@ String *Item_func_lpad::val_str(String *str)
if
((
ulonglong
)
count
>
INT_MAX32
)
count
=
INT_MAX32
;
/*
There is one exception not handled (intentionaly) by the character set
aggregation code. If one string is strong side and is binary, and
another one is weak side and is a multi-byte character string,
then we need to operate on the second string in terms on bytes when
calling ::numchars() and ::charpos(), rather than in terms of characters.
Lets substitute its character set to binary.
*/
if
(
collation
.
collation
==
&
my_charset_bin
)
{
res
->
set_charset
(
&
my_charset_bin
);
pad
->
set_charset
(
&
my_charset_bin
);
}
res_char_length
=
res
->
numchars
();
if
(
count
<=
res_char_length
)
...
...
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