From 5a6b8bc4c7896f8b1f06018d16f70d52e80bdb77 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 29 Mar 2006 06:28:57 +0400 Subject: Post-review fixes for WL#3154 "Enable REPAIR for CSV tables" mysql-test/r/csv.result: update result file mysql-test/t/csv.test: add more tests storage/csv/ha_tina.cc: post-review fixes & cleanup storage/csv/ha_tina.h: post-review fixes --- mysql-test/t/csv.test | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'mysql-test/t/csv.test') 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" -- cgit v1.2.1