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
dab88027
Commit
dab88027
authored
Jun 22, 2005
by
jimw@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix LOAD DATA to handle having the escape and enclosed-by character
be the same. (Bug #11203)
parent
53761ce0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
2 deletions
+36
-2
mysql-test/r/loaddata.result
mysql-test/r/loaddata.result
+8
-0
mysql-test/std_data/loaddata5.dat
mysql-test/std_data/loaddata5.dat
+3
-0
mysql-test/t/loaddata.test
mysql-test/t/loaddata.test
+8
-0
sql/sql_load.cc
sql/sql_load.cc
+17
-2
No files found.
mysql-test/r/loaddata.result
View file @
dab88027
...
...
@@ -66,3 +66,11 @@ a b
3 row 3
0
drop table t1;
create table t1 (a varchar(20), b varchar(20));
load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by ',' enclosed by '"' escaped by '"' (a,b);
select * from t1;
a b
field1 field2
a"b cd"ef
a"b c"d"e
drop table t1;
mysql-test/std_data/loaddata5.dat
0 → 100644
View file @
dab88027
"field1","field2"
"a""b","cd""ef"
"a"b",c"d"e
mysql-test/t/loaddata.test
View file @
dab88027
...
...
@@ -31,3 +31,11 @@ load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated
select
*
from
t1
;
drop
table
t1
;
#
# Bug #11203: LOAD DATA does not accept same characters for ESCAPED and
# ENCLOSED
#
create
table
t1
(
a
varchar
(
20
),
b
varchar
(
20
));
load
data
infile
'../../std_data/loaddata5.dat'
into
table
t1
fields
terminated
by
','
enclosed
by
'"'
escaped
by
'"'
(
a
,
b
);
select
*
from
t1
;
drop
table
t1
;
sql/sql_load.cc
View file @
dab88027
...
...
@@ -799,8 +799,23 @@ int READ_INFO::read_field()
*
to
++=
(
byte
)
escape_char
;
goto
found_eof
;
}
*
to
++
=
(
byte
)
unescape
((
char
)
chr
);
continue
;
/*
When escape_char == enclosed_char, we treat it like we do for
handling quotes in SQL parsing -- you can double-up the
escape_char to include it literally, but it doesn't do escapes
like \n. This allows: LOAD DATA ... ENCLOSED BY '"' ESCAPED BY '"'
with data like: "fie""ld1", "field2"
*/
if
(
escape_char
!=
enclosed_char
||
chr
==
escape_char
)
{
*
to
++
=
(
byte
)
unescape
((
char
)
chr
);
continue
;
}
else
{
PUSH
(
chr
);
chr
=
escape_char
;
}
}
#ifdef ALLOW_LINESEPARATOR_IN_STRINGS
if
(
chr
==
line_term_char
)
...
...
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