summaryrefslogtreecommitdiff
path: root/mysql-test/t/csv.test
diff options
context:
space:
mode:
authorpetr@mysql.com <>2006-03-29 06:28:57 +0400
committerpetr@mysql.com <>2006-03-29 06:28:57 +0400
commit39a251f35bd0c387bbd622c8c257b32d924c7eae (patch)
tree5b20a87de3a35a93584ecf926b1aa1ffc94e8464 /mysql-test/t/csv.test
parent307b724bbc1d034d684857e3aa3b5957e7f38a70 (diff)
downloadmariadb-git-39a251f35bd0c387bbd622c8c257b32d924c7eae.tar.gz
Post-review fixes for WL#3154 "Enable REPAIR for CSV tables"
Diffstat (limited to 'mysql-test/t/csv.test')
-rw-r--r--mysql-test/t/csv.test47
1 files changed, 47 insertions, 0 deletions
diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test
index 3d23a838762..b72d4cc92be 100644
--- a/mysql-test/t/csv.test
+++ b/mysql-test/t/csv.test
@@ -1425,6 +1425,53 @@ REPAIR TABLE test_repair_table3;
SELECT * FROM test_repair_table3;
DROP TABLE test_repair_table3;
+# Test with more sophisticated table
+
+CREATE TABLE test_repair_table4 (
+ num int not null,
+ magic_no int(4) unsigned zerofill DEFAULT '0000' NOT NULL,
+ company_name char(30) DEFAULT '' NOT NULL,
+ founded char(4) DEFAULT '' NOT NULL
+) ENGINE = CSV;
+
+--exec rm $MYSQLTEST_VARDIR/master-data/test/test_repair_table4.CSM
+SELECT * FROM test_repair_table4;
+SELECT * FROM test_repair_table4;
+CHECK TABLE test_repair_table4;
+
+INSERT INTO test_repair_table4 VALUES (2,101,'SAP','1972');
+INSERT INTO test_repair_table4 VALUES (1,101,'Microsoft','1978');
+INSERT INTO test_repair_table4 VALUES (2,101,'MySQL','1995');
+
+# list table content
+SELECT * FROM test_repair_table4;
+CHECK TABLE test_repair_table4;
+REPAIR TABLE test_repair_table4;
+# check that nothing changed
+SELECT * FROM test_repair_table4;
+# verify that check/repair did non corrupt the table itself
+CHECK TABLE test_repair_table4;
+REPAIR TABLE test_repair_table4;
+SELECT * FROM test_repair_table4;
+DROP TABLE test_repair_table4;
+
+# Run CHECK/REPAIR on the CSV file with a single row, which misses a column.
+
+CREATE TABLE test_repair_table5 (
+ num int not null,
+ magic_no int(4) unsigned zerofill DEFAULT '0000' NOT NULL,
+ company_name char(30) DEFAULT '' NOT NULL,
+ founded char(4) DEFAULT '' NOT NULL
+) ENGINE = CSV;
+
+# Corrupt a table -- put a file with wrong # of columns
+--exec echo -n -e \"1\",\"101\",\"IBM\"\\n > $MYSQLTEST_VARDIR/master-data/test/test_repair_table5.CSV
+
+CHECK TABLE test_repair_table5;
+REPAIR TABLE test_repair_table5;
+SELECT * FROM test_repair_table5;
+DROP TABLE test_repair_table5;
+
#
# BUG#13406 - incorrect amount of "records deleted"