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
9b8751d4
Commit
9b8751d4
authored
Nov 20, 2007
by
gshchepa/uchum@gleb.loc
Browse files
Options
Browse Files
Download
Plain Diff
Merge gleb.loc:/work/bk/5.0-opt-32533
into gleb.loc:/work/bk/5.0-opt
parents
7ab844c9
351d9f66
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
7 deletions
+52
-7
mysql-test/r/outfile_loaddata.result
mysql-test/r/outfile_loaddata.result
+18
-0
mysql-test/t/outfile_loaddata.test
mysql-test/t/outfile_loaddata.test
+24
-0
sql/sql_class.cc
sql/sql_class.cc
+10
-7
No files found.
mysql-test/r/outfile_loaddata.result
View file @
9b8751d4
...
...
@@ -82,4 +82,22 @@ c1 c2
-r- =raker=
DROP TABLE t2;
DROP TABLE t1;
#
# Bug#32533: SELECT INTO OUTFILE never escapes multibyte character
#
CREATE TABLE t1 (c1 VARCHAR(256));
INSERT INTO t1 VALUES (0xC3);
SELECT HEX(c1) FROM t1;
HEX(c1)
C3
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug32533.txt' FIELDS ENCLOSED BY 0xC3 FROM t1;
TRUNCATE t1;
SELECT HEX(LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug32533.txt'));
HEX(LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug32533.txt'))
C35CC3C30A
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug32533.txt' INTO TABLE t1 FIELDS ENCLOSED BY 0xC3;
SELECT HEX(c1) FROM t1;
HEX(c1)
C3
DROP TABLE t1;
# End of 5.0 tests.
mysql-test/t/outfile_loaddata.test
View file @
9b8751d4
...
...
@@ -86,4 +86,28 @@ DROP TABLE t2;
DROP
TABLE
t1
;
--
echo
#
--
echo
# Bug#32533: SELECT INTO OUTFILE never escapes multibyte character
--
echo
#
CREATE
TABLE
t1
(
c1
VARCHAR
(
256
));
INSERT
INTO
t1
VALUES
(
0xC3
);
SELECT
HEX
(
c1
)
FROM
t1
;
--
let
$file
=
$MYSQLTEST_VARDIR
/
tmp
/
bug32533
.
txt
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
eval
SELECT
*
INTO
OUTFILE
'$file'
FIELDS
ENCLOSED
BY
0xC3
FROM
t1
TRUNCATE
t1
;
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
eval
SELECT
HEX
(
LOAD_FILE
(
'$file'
))
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
eval
LOAD
DATA
INFILE
'$file'
INTO
TABLE
t1
FIELDS
ENCLOSED
BY
0xC3
SELECT
HEX
(
c1
)
FROM
t1
;
--
remove_file
$file
DROP
TABLE
t1
;
--
echo
# End of 5.0 tests.
sql/sql_class.cc
View file @
9b8751d4
...
...
@@ -1219,16 +1219,18 @@ select_export::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
}
}
field_term_length
=
exchange
->
field_term
->
length
();
field_term_char
=
field_term_length
?
(
*
exchange
->
field_term
)[
0
]
:
INT_MAX
;
field_term_char
=
field_term_length
?
(
int
)
(
uchar
)
(
*
exchange
->
field_term
)[
0
]
:
INT_MAX
;
if
(
!
exchange
->
line_term
->
length
())
exchange
->
line_term
=
exchange
->
field_term
;
// Use this if it exists
field_sep_char
=
(
exchange
->
enclosed
->
length
()
?
(
*
exchange
->
enclosed
)[
0
]
:
field_term_char
);
escape_char
=
(
exchange
->
escaped
->
length
()
?
(
*
exchange
->
escaped
)[
0
]
:
-
1
);
field_sep_char
=
(
exchange
->
enclosed
->
length
()
?
(
int
)
(
uchar
)
(
*
exchange
->
enclosed
)[
0
]
:
field_term_char
);
escape_char
=
(
exchange
->
escaped
->
length
()
?
(
int
)
(
uchar
)
(
*
exchange
->
escaped
)[
0
]
:
-
1
);
is_ambiguous_field_sep
=
test
(
strchr
(
ESCAPE_CHARS
,
field_sep_char
));
is_unsafe_field_sep
=
test
(
strchr
(
NUMERIC_CHARS
,
field_sep_char
));
line_sep_char
=
(
exchange
->
line_term
->
length
()
?
(
*
exchange
->
line_term
)[
0
]
:
INT_MAX
);
(
int
)
(
uchar
)
(
*
exchange
->
line_term
)[
0
]
:
INT_MAX
);
if
(
!
field_term_length
)
exchange
->
opt_enclosed
=
0
;
if
(
!
exchange
->
enclosed
->
length
())
...
...
@@ -1385,10 +1387,11 @@ bool select_export::send_data(List<Item> &items)
Don't escape field_term_char by doubling - doubling is only
valid for ENCLOSED BY characters:
*/
(
enclosed
||
!
is_ambiguous_field_term
||
*
pos
!=
field_term_char
))
(
enclosed
||
!
is_ambiguous_field_term
||
(
int
)
(
uchar
)
*
pos
!=
field_term_char
))
{
char
tmp_buff
[
2
];
tmp_buff
[
0
]
=
((
int
)
*
pos
==
field_sep_char
&&
tmp_buff
[
0
]
=
((
int
)
(
uchar
)
*
pos
==
field_sep_char
&&
is_ambiguous_field_sep
)
?
field_sep_char
:
escape_char
;
tmp_buff
[
1
]
=
*
pos
?
*
pos
:
'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