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
2d018862
Commit
2d018862
authored
Oct 21, 2005
by
jimw@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/jimw/my/mysql-4.1-11203
into mysql.com:/home/jimw/my/mysql-4.1-clean
parents
721873f7
dab88027
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
3 deletions
+37
-3
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
+9
-1
sql/sql_load.cc
sql/sql_load.cc
+17
-2
No files found.
mysql-test/r/loaddata.result
View file @
2d018862
...
...
@@ -76,3 +76,11 @@ select * from t1;
id
0
SET @@SQL_MODE=@OLD_SQL_MODE;
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 @
2d018862
"field1","field2"
"a""b","cd""ef"
"a"b",c"d"e
mysql-test/t/loaddata.test
View file @
2d018862
...
...
@@ -31,7 +31,6 @@ load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated
select
*
from
t1
;
drop
table
t1
;
#
# Bug #12053 LOAD DATA INFILE ignores NO_AUTO_VALUE_ON_ZERO setting
#
...
...
@@ -58,4 +57,13 @@ select * from t1;
--
exec
rm
$MYSQL_TEST_DIR
/
var
/
tmp
/
t1
SET
@@
SQL_MODE
=@
OLD_SQL_MODE
;
#
# 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
;
# End of 4.1 tests
sql/sql_load.cc
View file @
2d018862
...
...
@@ -806,8 +806,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