mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Merge mysql.com:/home/jimw/my/mysql-4.1-11203
into mysql.com:/home/jimw/my/mysql-4.1-clean
This commit is contained in:
@ -76,3 +76,11 @@ select * from t1;
|
|||||||
id
|
id
|
||||||
0
|
0
|
||||||
SET @@SQL_MODE=@OLD_SQL_MODE;
|
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;
|
||||||
|
3
mysql-test/std_data/loaddata5.dat
Normal file
3
mysql-test/std_data/loaddata5.dat
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
"field1","field2"
|
||||||
|
"a""b","cd""ef"
|
||||||
|
"a"b",c"d"e
|
@ -31,7 +31,6 @@ load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated
|
|||||||
select * from t1;
|
select * from t1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bug #12053 LOAD DATA INFILE ignores NO_AUTO_VALUE_ON_ZERO setting
|
# 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
|
--exec rm $MYSQL_TEST_DIR/var/tmp/t1
|
||||||
SET @@SQL_MODE=@OLD_SQL_MODE;
|
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
|
# End of 4.1 tests
|
||||||
|
@ -806,8 +806,23 @@ int READ_INFO::read_field()
|
|||||||
*to++= (byte) escape_char;
|
*to++= (byte) escape_char;
|
||||||
goto found_eof;
|
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
|
#ifdef ALLOW_LINESEPARATOR_IN_STRINGS
|
||||||
if (chr == line_term_char)
|
if (chr == line_term_char)
|
||||||
|
Reference in New Issue
Block a user