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
a7af4f89
Commit
a7af4f89
authored
Mar 03, 2011
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Plain Diff
Merging from mysql-5.1
parents
c0dd8747
c82f9661
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
84 additions
and
7 deletions
+84
-7
mysql-test/r/ctype_sjis.result
mysql-test/r/ctype_sjis.result
+6
-0
mysql-test/r/ctype_ucs.result
mysql-test/r/ctype_ucs.result
+7
-2
mysql-test/t/ctype_sjis.test
mysql-test/t/ctype_sjis.test
+8
-0
mysql-test/t/ctype_ucs.test
mysql-test/t/ctype_ucs.test
+1
-0
sql/item_strfunc.cc
sql/item_strfunc.cc
+59
-3
sql/item_strfunc.h
sql/item_strfunc.h
+3
-2
No files found.
mysql-test/r/ctype_sjis.result
View file @
a7af4f89
...
...
@@ -218,6 +218,12 @@ hex(a) hex(lower(a)) hex(upper(a))
8352835E 8352835E 8352835E
8372835E 8372835E 8372835E
DROP TABLE t1;
#
# Bug#11766519 - Bug#59648: MY_STRTOLL10_MB2: ASSERTION `(*ENDPTR - S) % 2 == 0' FAILED.
#
SELECT QUOTE('\');
QUOTE('\')
'\'
# End of 5.1 tests
#
# Start of 5.5 tests
...
...
mysql-test/r/ctype_ucs.result
View file @
a7af4f89
...
...
@@ -990,8 +990,8 @@ old_password(name)
14e500b131773991
select quote(name) from bug20536;
quote(name)
????????
????????????????
'test1'
'\'test\\_2\''
drop table bug20536;
set names ucs2;
ERROR 42000: Variable 'character_set_client' can't be set to the value of 'ucs2'
...
...
@@ -1244,6 +1244,11 @@ DROP TABLE t1;
SELECT HEX(CHAR(COALESCE(NULL, CHAR(COUNT('%s') USING ucs2), 1, @@global.license, NULL) USING cp850));
HEX(CHAR(COALESCE(NULL, CHAR(COUNT('%s') USING ucs2), 1, @@global.license, NULL) USING cp850))
00
SELECT CONVERT(QUOTE(CHAR(0xf5 using ucs2)), SIGNED);
CONVERT(QUOTE(CHAR(0xf5 using ucs2)), SIGNED)
0
Warnings:
Warning 1292 Truncated incorrect INTEGER value: ''
End of 5.0 tests
#
# Start of 5.5 tests
...
...
mysql-test/t/ctype_sjis.test
View file @
a7af4f89
...
...
@@ -92,6 +92,14 @@ INSERT INTO t1 VALUES (0x8372835E),(0x8352835E);
SELECT
hex
(
a
),
hex
(
lower
(
a
)),
hex
(
upper
(
a
))
FROM
t1
ORDER
BY
binary
(
a
);
DROP
TABLE
t1
;
--
echo
#
--
echo
# Bug#11766519 - Bug#59648: MY_STRTOLL10_MB2: ASSERTION `(*ENDPTR - S) % 2 == 0' FAILED.
--
echo
#
# In the below string backslash (0x5C) is a part of a multi-byte
# character, so it should not be quoted.
SELECT
QUOTE
(
'\');
--echo # End of 5.1 tests
...
...
mysql-test/t/ctype_ucs.test
View file @
a7af4f89
...
...
@@ -745,6 +745,7 @@ DROP TABLE t1;
--
echo
# Bug#59648 my_strtoll10_mb2: Assertion `(*endptr - s) % 2 == 0' failed.
--
echo
#
SELECT
HEX
(
CHAR
(
COALESCE
(
NULL
,
CHAR
(
COUNT
(
'%s'
)
USING
ucs2
),
1
,
@@
global
.
license
,
NULL
)
USING
cp850
));
SELECT
CONVERT
(
QUOTE
(
CHAR
(
0xf5
using
ucs2
)),
SIGNED
);
--
echo
End
of
5.0
tests
...
...
sql/item_strfunc.cc
View file @
a7af4f89
...
...
@@ -3450,14 +3450,68 @@ String *Item_func_quote::val_str(String *str)
}
arg_length
=
arg
->
length
();
new_length
=
arg_length
+
2
;
/* for beginning and ending ' signs */
for
(
from
=
(
char
*
)
arg
->
ptr
(),
end
=
from
+
arg_length
;
from
<
end
;
from
++
)
new_length
+=
get_esc_bit
(
escmask
,
(
uchar
)
*
from
);
if
(
collation
.
collation
->
mbmaxlen
==
1
)
{
new_length
=
arg_length
+
2
;
/* for beginning and ending ' signs */
for
(
from
=
(
char
*
)
arg
->
ptr
(),
end
=
from
+
arg_length
;
from
<
end
;
from
++
)
new_length
+=
get_esc_bit
(
escmask
,
(
uchar
)
*
from
);
}
else
{
new_length
=
(
arg_length
*
2
)
+
/* For string characters */
(
2
*
collation
.
collation
->
mbmaxlen
);
/* For quotes */
}
if
(
tmp_value
.
alloc
(
new_length
))
goto
null
;
if
(
collation
.
collation
->
mbmaxlen
>
1
)
{
CHARSET_INFO
*
cs
=
collation
.
collation
;
int
mblen
;
uchar
*
to_end
;
to
=
(
char
*
)
tmp_value
.
ptr
();
to_end
=
(
uchar
*
)
to
+
new_length
;
/* Put leading quote */
if
((
mblen
=
cs
->
cset
->
wc_mb
(
cs
,
'\''
,
(
uchar
*
)
to
,
to_end
))
<=
0
)
goto
null
;
to
+=
mblen
;
for
(
start
=
(
char
*
)
arg
->
ptr
(),
end
=
start
+
arg_length
;
start
<
end
;
)
{
my_wc_t
wc
;
bool
escape
;
if
((
mblen
=
cs
->
cset
->
mb_wc
(
cs
,
&
wc
,
(
uchar
*
)
start
,
(
uchar
*
)
end
))
<=
0
)
goto
null
;
start
+=
mblen
;
switch
(
wc
)
{
case
0
:
escape
=
1
;
wc
=
'0'
;
break
;
case
'\032'
:
escape
=
1
;
wc
=
'Z'
;
break
;
case
'\''
:
escape
=
1
;
break
;
case
'\\'
:
escape
=
1
;
break
;
default:
escape
=
0
;
break
;
}
if
(
escape
)
{
if
((
mblen
=
cs
->
cset
->
wc_mb
(
cs
,
'\\'
,
(
uchar
*
)
to
,
to_end
))
<=
0
)
goto
null
;
to
+=
mblen
;
}
if
((
mblen
=
cs
->
cset
->
wc_mb
(
cs
,
wc
,
(
uchar
*
)
to
,
to_end
))
<=
0
)
goto
null
;
to
+=
mblen
;
}
/* Put trailing quote */
if
((
mblen
=
cs
->
cset
->
wc_mb
(
cs
,
'\''
,
(
uchar
*
)
to
,
to_end
))
<=
0
)
goto
null
;
to
+=
mblen
;
new_length
=
to
-
tmp_value
.
ptr
();
goto
ret
;
}
/*
We replace characters from the end to the beginning
*/
...
...
@@ -3489,6 +3543,8 @@ String *Item_func_quote::val_str(String *str)
}
}
*
to
=
'\''
;
ret:
tmp_value
.
length
(
new_length
);
tmp_value
.
set_charset
(
collation
.
collation
);
null_value
=
0
;
...
...
sql/item_strfunc.h
View file @
a7af4f89
...
...
@@ -787,9 +787,10 @@ class Item_func_quote :public Item_str_func
String
*
val_str
(
String
*
);
void
fix_length_and_dec
()
{
ulonglong
max_result_length
=
(
ulonglong
)
args
[
0
]
->
max_length
*
2
+
2
;
max_length
=
(
uint32
)
min
(
max_result_length
,
MAX_BLOB_WIDTH
);
collation
.
set
(
args
[
0
]
->
collation
);
ulonglong
max_result_length
=
(
ulonglong
)
args
[
0
]
->
max_length
*
2
+
2
*
collation
.
collation
->
mbmaxlen
;
max_length
=
(
uint32
)
min
(
max_result_length
,
MAX_BLOB_WIDTH
);
}
};
...
...
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