summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/storage_engine/loaddata.test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:00:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:00:34 +0000
commit3f619478f796eddbba6e39502fe941b285dd97b1 (patch)
treee2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/suite/storage_engine/loaddata.test
parentInitial commit. (diff)
downloadmariadb-upstream.tar.xz
mariadb-upstream.zip
Adding upstream version 1:10.11.6.upstream/1%10.11.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/suite/storage_engine/loaddata.test')
-rw-r--r--mysql-test/suite/storage_engine/loaddata.test104
1 files changed, 104 insertions, 0 deletions
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 <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 <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 <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 <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 <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
+