From 3f619478f796eddbba6e39502fe941b285dd97b1 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 20:00:34 +0200 Subject: Adding upstream version 1:10.11.6. Signed-off-by: Daniel Baumann --- mysql-test/suite/storage_engine/loaddata.test | 104 ++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 mysql-test/suite/storage_engine/loaddata.test (limited to 'mysql-test/suite/storage_engine/loaddata.test') diff --git a/mysql-test/suite/storage_engine/loaddata.test b/mysql-test/suite/storage_engine/loaddata.test new file mode 100644 index 00000000..5a708626 --- /dev/null +++ b/mysql-test/suite/storage_engine/loaddata.test @@ -0,0 +1,104 @@ +# +# Basic LOAD DATA statements +# + +--source have_engine.inc + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +--source create_table.inc + +let $datadir = `SELECT @@datadir`; + +--write_file $datadir/se_loaddata.dat +1,foo, +2,bar, +3,, +4,abc, +EOF + +--replace_result $datadir +eval +LOAD DATA INFILE '$datadir/se_loaddata.dat' INTO TABLE t1 + FIELDS TERMINATED BY ',' (a,b); +if ($mysql_errname) +{ + --source unexpected_result.inc + --remove_file $datadir/se_loaddata.dat +} +if (!$mysql_errname) +{ + --sorted_result + SELECT a,b FROM t1; + + --replace_result $datadir + eval + LOAD DATA LOCAL INFILE '$datadir/se_loaddata.dat' INTO TABLE t1 + CHARACTER SET utf8 COLUMNS TERMINATED BY ',' + ESCAPED BY '/' (a,b); + --sorted_result + SELECT a,b FROM t1; + + --remove_file $datadir/se_loaddata.dat + --write_file $datadir/se_loaddata.dat +5;YYY; +102;'zzz'; +0;'test'; +EOF + + --replace_result $datadir + eval + LOAD DATA LOCAL INFILE '$datadir/se_loaddata.dat' INTO TABLE t1 + FIELDS TERMINATED BY ';' + (a) SET b='loaded'; + + --sorted_result + SELECT a,b FROM t1; + + --remove_file $datadir/se_loaddata.dat + --write_file $datadir/se_loaddata.dat +prefix:5;'foo'; +prefix:6;''; +prefix:100;foo; +prefix:7;'test';suffix +101;abc; +102;'z'; +prefix:0;; +EOF + + --replace_result $datadir + eval + LOAD DATA INFILE '$datadir/se_loaddata.dat' INTO TABLE t1 + FIELDS TERMINATED BY ';' + OPTIONALLY ENCLOSED BY '''' + LINES STARTING BY 'prefix:' + IGNORE 2 LINES (a,b); + + --sorted_result + SELECT a,b FROM t1; + + --remove_file $datadir/se_loaddata.dat + --write_file $datadir/se_loaddata.dat +1 foo +2 bar +3 +4 abc +EOF + + --replace_result $datadir + eval + LOAD DATA INFILE '$datadir/se_loaddata.dat' INTO TABLE t1; + --sorted_result + SELECT a,b FROM t1; + + --remove_file $datadir/se_loaddata.dat + +} + +# Cleanup +DROP TABLE t1; + +--source cleanup_engine.inc + -- cgit v1.2.3