diff options
author | Olivier Bertrand <bertrandop@gmail.com> | 2014-05-12 23:42:17 +0200 |
---|---|---|
committer | Olivier Bertrand <bertrandop@gmail.com> | 2014-05-12 23:42:17 +0200 |
commit | 8b7c7b9280a9d9a16cf7b97fb36e73cdc41c3759 (patch) | |
tree | abb0d06989f423bb6bdcfaf1ea0ff95ee5b6378d /storage | |
parent | 7bbcc3e4ed6eef226b6978615cd64294b6bfe95c (diff) | |
download | mariadb-git-8b7c7b9280a9d9a16cf7b97fb36e73cdc41c3759.tar.gz |
- Fix writing header of void CONNECT DBF tables on first insert. An error
occured when the table definition had a special column that was not skipped
from the header.
modified:
storage/connect/filamdbf.cpp
- Update some test cases to reflect a change of error message generated when
trying to update or delete a read only table.
modified:
storage/connect/mysql-test/connect/r/csv.result
storage/connect/mysql-test/connect/r/dbf.result
storage/connect/mysql-test/connect/r/fix.result
storage/connect/mysql-test/connect/r/ini.result
storage/connect/mysql-test/connect/r/vec.result
storage/connect/mysql-test/connect/t/csv.test
storage/connect/mysql-test/connect/t/dbf.test
storage/connect/mysql-test/connect/t/fix.test
storage/connect/mysql-test/connect/t/ini.test
storage/connect/mysql-test/connect/t/vec.test
Diffstat (limited to 'storage')
-rw-r--r-- | storage/connect/filamdbf.cpp | 58 | ||||
-rw-r--r-- | storage/connect/mysql-test/connect/r/csv.result | 4 | ||||
-rw-r--r-- | storage/connect/mysql-test/connect/r/dbf.result | 4 | ||||
-rw-r--r-- | storage/connect/mysql-test/connect/r/fix.result | 4 | ||||
-rw-r--r-- | storage/connect/mysql-test/connect/r/ini.result | 4 | ||||
-rw-r--r-- | storage/connect/mysql-test/connect/r/vec.result | 4 | ||||
-rw-r--r-- | storage/connect/mysql-test/connect/t/csv.test | 370 | ||||
-rw-r--r-- | storage/connect/mysql-test/connect/t/dbf.test | 4 | ||||
-rw-r--r-- | storage/connect/mysql-test/connect/t/fix.test | 4 | ||||
-rw-r--r-- | storage/connect/mysql-test/connect/t/ini.test | 312 | ||||
-rw-r--r-- | storage/connect/mysql-test/connect/t/vec.test | 160 |
11 files changed, 465 insertions, 463 deletions
diff --git a/storage/connect/filamdbf.cpp b/storage/connect/filamdbf.cpp index 7ac81117f35..7ca98eeff55 100644 --- a/storage/connect/filamdbf.cpp +++ b/storage/connect/filamdbf.cpp @@ -546,10 +546,11 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g) PDOSDEF tdp = (PDOSDEF)Tdbp->GetDef(); // Count the number of columns - for (cdp = tdp->GetCols(); cdp; cdp = cdp->GetNext()) { - reclen += cdp->GetLong(); - n++; - } // endfor cdp + for (cdp = tdp->GetCols(); cdp; cdp = cdp->GetNext()) + if (!(cdp->Flags & U_SPECIAL)) { + reclen += cdp->GetLong(); + n++; + } // endif Flags if (Lrecl != reclen) { sprintf(g->Message, MSG(BAD_LRECL), Lrecl, reclen); @@ -570,30 +571,31 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g) descp = (DESCRIPTOR*)header; // Currently only standard Xbase types are supported - for (cdp = tdp->GetCols(); cdp; cdp = cdp->GetNext()) { - descp++; - - switch ((c = *GetFormatType(cdp->GetType()))) { - case 'S': // Short integer - case 'L': // Large (big) integer - case 'T': // Tiny integer - c = 'N'; // Numeric - case 'N': // Numeric (integer) - case 'F': // Float (double) - descp->Decimals = (uchar)cdp->F.Prec; - case 'C': // Char - case 'D': // Date - break; - default: // Should never happen - sprintf(g->Message, "Unsupported DBF type %c for column %s", - c, cdp->GetName()); - return true; - } // endswitch c - - strncpy(descp->Name, cdp->GetName(), 11); - descp->Type = c; - descp->Length = (uchar)cdp->GetLong(); - } // endfor cdp + for (cdp = tdp->GetCols(); cdp; cdp = cdp->GetNext()) + if (!(cdp->Flags & U_SPECIAL)) { + descp++; + + switch ((c = *GetFormatType(cdp->GetType()))) { + case 'S': // Short integer + case 'L': // Large (big) integer + case 'T': // Tiny integer + c = 'N'; // Numeric + case 'N': // Numeric (integer) + case 'F': // Float (double) + descp->Decimals = (uchar)cdp->F.Prec; + case 'C': // Char + case 'D': // Date + break; + default: // Should never happen + sprintf(g->Message, "Unsupported DBF type %c for column %s", + c, cdp->GetName()); + return true; + } // endswitch c + + strncpy(descp->Name, cdp->GetName(), 11); + descp->Type = c; + descp->Length = (uchar)cdp->GetLong(); + } // endif Flags *(char*)(++descp) = EOH; diff --git a/storage/connect/mysql-test/connect/r/csv.result b/storage/connect/mysql-test/connect/r/csv.result index 3f424964881..be25a842bc4 100644 --- a/storage/connect/mysql-test/connect/r/csv.result +++ b/storage/connect/mysql-test/connect/r/csv.result @@ -52,9 +52,9 @@ children SMALLINT(2) NOT NULL INSERT INTO t1 VALUES ('BILL','1973-06-30',5); ERROR HY000: Table 't1' is read only UPDATE t1 SET children=6 WHERE name='BILL'; -ERROR HY000: Table 't1' is read only +ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT DELETE FROM t1 WHERE name='BILL'; -ERROR HY000: Table 't1' is read only +ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT TRUNCATE TABLE t1; ERROR HY000: Table 't1' is read only SELECT * FROM t1; diff --git a/storage/connect/mysql-test/connect/r/dbf.result b/storage/connect/mysql-test/connect/r/dbf.result index 30fac687119..d7b3fe0f114 100644 --- a/storage/connect/mysql-test/connect/r/dbf.result +++ b/storage/connect/mysql-test/connect/r/dbf.result @@ -77,9 +77,9 @@ t1 CREATE TABLE `t1` ( INSERT INTO t1 VALUES (30); ERROR HY000: Table 't1' is read only UPDATE t1 SET a=30 WHERE a=10; -ERROR HY000: Table 't1' is read only +ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT DELETE FROM t1 WHERE a=10; -ERROR HY000: Table 't1' is read only +ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT TRUNCATE TABLE t1; ERROR HY000: Table 't1' is read only ALTER TABLE t1 READONLY=NO; diff --git a/storage/connect/mysql-test/connect/r/fix.result b/storage/connect/mysql-test/connect/r/fix.result index a93948bb9c6..4d620c66a04 100644 --- a/storage/connect/mysql-test/connect/r/fix.result +++ b/storage/connect/mysql-test/connect/r/fix.result @@ -30,9 +30,9 @@ t1 CREATE TABLE `t1` ( INSERT INTO t1 VALUES (20); ERROR HY000: Table 't1' is read only UPDATE t1 SET id=20 WHERE id=10; -ERROR HY000: Table 't1' is read only +ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT DELETE FROM t1 WHERE id=10; -ERROR HY000: Table 't1' is read only +ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT TRUNCATE TABLE t1; ERROR HY000: Table 't1' is read only ALTER TABLE t1 READONLY=0; diff --git a/storage/connect/mysql-test/connect/r/ini.result b/storage/connect/mysql-test/connect/r/ini.result index 79996eb8525..a377cb3ee20 100644 --- a/storage/connect/mysql-test/connect/r/ini.result +++ b/storage/connect/mysql-test/connect/r/ini.result @@ -194,9 +194,9 @@ t1 CREATE TABLE `t1` ( INSERT INTO t1 VALUES ('US',40); ERROR HY000: Table 't1' is read only UPDATE t1 SET c2=20 WHERE c2=10; -ERROR HY000: Table 't1' is read only +ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT DELETE FROM t1 WHERE c2=10; -ERROR HY000: Table 't1' is read only +ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT TRUNCATE TABLE t1; ERROR HY000: Table 't1' is read only ALTER TABLE t1 READONLY=0; diff --git a/storage/connect/mysql-test/connect/r/vec.result b/storage/connect/mysql-test/connect/r/vec.result index e93305fb07a..51fb8aeee77 100644 --- a/storage/connect/mysql-test/connect/r/vec.result +++ b/storage/connect/mysql-test/connect/r/vec.result @@ -103,9 +103,9 @@ t1 CREATE TABLE `t1` ( INSERT INTO t1 VALUES (4,'test04'); ERROR HY000: Table 't1' is read only UPDATE t1 SET b='test04' WHERE a=3; -ERROR HY000: Table 't1' is read only +ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT DELETE FROM t1 WHERE a=3; -ERROR HY000: Table 't1' is read only +ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT TRUNCATE TABLE t1; ERROR HY000: Table 't1' is read only ALTER TABLE t1 READONLY=no; diff --git a/storage/connect/mysql-test/connect/t/csv.test b/storage/connect/mysql-test/connect/t/csv.test index a21686d8a08..5662fdb705b 100644 --- a/storage/connect/mysql-test/connect/t/csv.test +++ b/storage/connect/mysql-test/connect/t/csv.test @@ -1,185 +1,185 @@ -let $MYSQLD_DATADIR= `select @@datadir`;
-
---copy_file $MTR_SUITE_DIR/std_data/people.csv $MYSQLD_DATADIR/test/people.csv
-
-SET NAMES utf8;
-
---echo #
---echo # Testing errors
---echo #
-CREATE TABLE t1
-(
- ID INT NOT NULL
-) Engine=CONNECT TABLE_TYPE=CSV FILE_NAME='nonexistent.txt';
---replace_regex /on .*test.nonexistent.txt/on DATADIR\/test\/nonexistent.txt/
-# TODO: check why this is needed for Windows
---replace_result Open(rt) Open(rb)
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Testing examples from the manual
---echo #
-CREATE TABLE t1
-(
- name CHAR(12) NOT NULL,
- birth DATE NOT NULL DATE_FORMAT='DD/MM/YY',
- children SMALLINT(2) NOT NULL
-) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='people.csv'
- HEADER=1 SEP_CHAR=';' QUOTED=1;
-SELECT * FROM t1;
-INSERT INTO t1 VALUES ('RONALD','1980-02-26',4);
-SELECT * FROM t1;
-DROP TABLE t1;
---chmod 0777 $MYSQLD_DATADIR/test/people.csv
---replace_result $MYSQLD_DATADIR DATADIR
---eval SELECT REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/people.csv'),'\r\n','\n');
-
---echo #
---echo # Testing READONLY tables
---echo #
-CREATE TABLE t1
-(
- name CHAR(12) NOT NULL,
- birth DATE NOT NULL DATE_FORMAT='DD/MM/YY',
- children SMALLINT(2) NOT NULL
-) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='people.csv'
- HEADER=1 SEP_CHAR=';' QUOTED=1 READONLY=yes;
---error ER_OPEN_AS_READONLY
-INSERT INTO t1 VALUES ('BILL','1973-06-30',5);
---error ER_OPEN_AS_READONLY
-UPDATE t1 SET children=6 WHERE name='BILL';
---error ER_OPEN_AS_READONLY
-DELETE FROM t1 WHERE name='BILL';
---error ER_OPEN_AS_READONLY
-TRUNCATE TABLE t1;
-SELECT * FROM t1;
-ALTER TABLE t1 READONLY=no;
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES ('BILL','1973-06-30',5);
-SELECT * FROM t1;
-ALTER TABLE t1 READONLY=1;
-SHOW CREATE TABLE t1;
---error ER_OPEN_AS_READONLY
-INSERT INTO t1 VALUES ('BILL','1973-06-30',5);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-
---echo #
---echo # Testing that the underlying file is created
---echo #
-CREATE TABLE t1
-(
- c1 CHAR(12) NOT NULL,
- c2 CHAR(12) NOT NULL
-) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='tmp.csv'
- HEADER=1 SEP_CHAR=',' QUOTED=1;
-INSERT INTO t1 VALUES (10,10),(20,20),(300,300),(4000,4000), ('a b','c d');
-SELECT * FROM t1;
-DROP TABLE t1;
---chmod 0777 $MYSQLD_DATADIR/test/tmp.csv
---replace_result $MYSQLD_DATADIR DATADIR
---eval SELECT REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/tmp.csv'),'\r\n','\n');
-
---echo #
---echo # Creating a CSV table from a MyISAM table
---echo #
-CREATE TABLE t1 (a VARCHAR(10) NOT NULL, b INT NOT NULL) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('test1',1), ('test2',2);
-CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t2.csv'
- AS SELECT * FROM t1;
-SELECT * FROM t2;
-DROP TABLE t2;
-DROP TABLE t1;
---chmod 0777 $MYSQLD_DATADIR/test/t2.csv
---replace_result $MYSQLD_DATADIR DATADIR
---eval SELECT REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t2.csv'),'\r\n','\n');
---remove_file $MYSQLD_DATADIR/test/t2.csv
-
---echo #
---echo # Testing international data
---echo #
-CREATE TABLE t1
-(
- c1 CHAR(12) NOT NULL
-) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv'
- CHARSET=utf8;
-INSERT INTO t1 VALUES ('á');
-SELECT * FROM t1;
-DROP TABLE t1;
---chmod 0777 $MYSQLD_DATADIR/test/t1.csv
---replace_result $MYSQLD_DATADIR DATADIR
---eval SELECT HEX(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t1.csv'),'\r\n','\n'));
---remove_file $MYSQLD_DATADIR/test/t1.csv
-
-CREATE TABLE t1
-(
- c1 CHAR(12) NOT NULL
-) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv'
- CHARSET=utf8 DATA_CHARSET=latin1;
-INSERT INTO t1 VALUES ('á');
-SELECT * FROM t1;
-DROP TABLE t1;
---chmod 0777 $MYSQLD_DATADIR/test/t1.csv
---replace_result $MYSQLD_DATADIR DATADIR
---eval SELECT HEX(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t1.csv'),'\r\n','\n'));
---remove_file $MYSQLD_DATADIR/test/t1.csv
-
-CREATE TABLE t1
-(
- c1 CHAR(12) NOT NULL
-) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv';
-INSERT INTO t1 VALUES ('á');
-SELECT * FROM t1;
-DROP TABLE t1;
---chmod 0777 $MYSQLD_DATADIR/test/t1.csv
---replace_result $MYSQLD_DATADIR DATADIR
---eval SELECT HEX(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t1.csv'),'\r\n','\n'));
---remove_file $MYSQLD_DATADIR/test/t1.csv
-
-CREATE TABLE t1
-(
- c1 CHAR(12) NOT NULL
-) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv'
- CHARSET=latin1;
-INSERT INTO t1 VALUES ('á');
-SELECT * FROM t1;
-DROP TABLE t1;
---chmod 0777 $MYSQLD_DATADIR/test/t1.csv
---replace_result $MYSQLD_DATADIR DATADIR
---eval SELECT HEX(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t1.csv'),'\r\n','\n'));
---remove_file $MYSQLD_DATADIR/test/t1.csv
-
-CREATE TABLE t1
-(
- c1 CHAR(12) NOT NULL
-) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv'
- CHARSET=latin1 DATA_CHARSET=utf8;
-INSERT INTO t1 VALUES ('á');
-SELECT * FROM t1;
-DROP TABLE t1;
---chmod 0777 $MYSQLD_DATADIR/test/t1.csv
---replace_result $MYSQLD_DATADIR DATADIR
---eval SELECT HEX(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t1.csv'),'\r\n','\n'));
---remove_file $MYSQLD_DATADIR/test/t1.csv
-
-CREATE TABLE t1
-(
- c1 CHAR(12) CHARACTER SET latin1 NOT NULL,
- c2 CHAR(12) CHARACTER SET utf8 NOT NULL
-) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv';
-INSERT INTO t1 VALUES ('á','á');
-SELECT * FROM t1;
-DROP TABLE t1;
---chmod 0777 $MYSQLD_DATADIR/test/t1.csv
---replace_result $MYSQLD_DATADIR DATADIR
---eval SELECT HEX(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t1.csv'),'\r\n','\n'));
---remove_file $MYSQLD_DATADIR/test/t1.csv
-
-
-#
-# Clean up
-#
---remove_file $MYSQLD_DATADIR/test/people.csv
---remove_file $MYSQLD_DATADIR/test/tmp.csv
+let $MYSQLD_DATADIR= `select @@datadir`; + +--copy_file $MTR_SUITE_DIR/std_data/people.csv $MYSQLD_DATADIR/test/people.csv + +SET NAMES utf8; + +--echo # +--echo # Testing errors +--echo # +CREATE TABLE t1 +( + ID INT NOT NULL +) Engine=CONNECT TABLE_TYPE=CSV FILE_NAME='nonexistent.txt'; +--replace_regex /on .*test.nonexistent.txt/on DATADIR\/test\/nonexistent.txt/ +# TODO: check why this is needed for Windows +--replace_result Open(rt) Open(rb) +SELECT * FROM t1; +DROP TABLE t1; + +--echo # +--echo # Testing examples from the manual +--echo # +CREATE TABLE t1 +( + name CHAR(12) NOT NULL, + birth DATE NOT NULL DATE_FORMAT='DD/MM/YY', + children SMALLINT(2) NOT NULL +) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='people.csv' + HEADER=1 SEP_CHAR=';' QUOTED=1; +SELECT * FROM t1; +INSERT INTO t1 VALUES ('RONALD','1980-02-26',4); +SELECT * FROM t1; +DROP TABLE t1; +--chmod 0777 $MYSQLD_DATADIR/test/people.csv +--replace_result $MYSQLD_DATADIR DATADIR +--eval SELECT REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/people.csv'),'\r\n','\n'); + +--echo # +--echo # Testing READONLY tables +--echo # +CREATE TABLE t1 +( + name CHAR(12) NOT NULL, + birth DATE NOT NULL DATE_FORMAT='DD/MM/YY', + children SMALLINT(2) NOT NULL +) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='people.csv' + HEADER=1 SEP_CHAR=';' QUOTED=1 READONLY=yes; +--error ER_OPEN_AS_READONLY +INSERT INTO t1 VALUES ('BILL','1973-06-30',5); +--error ER_GET_ERRMSG +UPDATE t1 SET children=6 WHERE name='BILL'; +--error ER_GET_ERRMSG +DELETE FROM t1 WHERE name='BILL'; +--error ER_OPEN_AS_READONLY +TRUNCATE TABLE t1; +SELECT * FROM t1; +ALTER TABLE t1 READONLY=no; +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES ('BILL','1973-06-30',5); +SELECT * FROM t1; +ALTER TABLE t1 READONLY=1; +SHOW CREATE TABLE t1; +--error ER_OPEN_AS_READONLY +INSERT INTO t1 VALUES ('BILL','1973-06-30',5); +SELECT * FROM t1; +DROP TABLE t1; + + +--echo # +--echo # Testing that the underlying file is created +--echo # +CREATE TABLE t1 +( + c1 CHAR(12) NOT NULL, + c2 CHAR(12) NOT NULL +) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='tmp.csv' + HEADER=1 SEP_CHAR=',' QUOTED=1; +INSERT INTO t1 VALUES (10,10),(20,20),(300,300),(4000,4000), ('a b','c d'); +SELECT * FROM t1; +DROP TABLE t1; +--chmod 0777 $MYSQLD_DATADIR/test/tmp.csv +--replace_result $MYSQLD_DATADIR DATADIR +--eval SELECT REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/tmp.csv'),'\r\n','\n'); + +--echo # +--echo # Creating a CSV table from a MyISAM table +--echo # +CREATE TABLE t1 (a VARCHAR(10) NOT NULL, b INT NOT NULL) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('test1',1), ('test2',2); +CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t2.csv' + AS SELECT * FROM t1; +SELECT * FROM t2; +DROP TABLE t2; +DROP TABLE t1; +--chmod 0777 $MYSQLD_DATADIR/test/t2.csv +--replace_result $MYSQLD_DATADIR DATADIR +--eval SELECT REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t2.csv'),'\r\n','\n'); +--remove_file $MYSQLD_DATADIR/test/t2.csv + +--echo # +--echo # Testing international data +--echo # +CREATE TABLE t1 +( + c1 CHAR(12) NOT NULL +) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv' + CHARSET=utf8; +INSERT INTO t1 VALUES ('á'); +SELECT * FROM t1; +DROP TABLE t1; +--chmod 0777 $MYSQLD_DATADIR/test/t1.csv +--replace_result $MYSQLD_DATADIR DATADIR +--eval SELECT HEX(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t1.csv'),'\r\n','\n')); +--remove_file $MYSQLD_DATADIR/test/t1.csv + +CREATE TABLE t1 +( + c1 CHAR(12) NOT NULL +) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv' + CHARSET=utf8 DATA_CHARSET=latin1; +INSERT INTO t1 VALUES ('á'); +SELECT * FROM t1; +DROP TABLE t1; +--chmod 0777 $MYSQLD_DATADIR/test/t1.csv +--replace_result $MYSQLD_DATADIR DATADIR +--eval SELECT HEX(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t1.csv'),'\r\n','\n')); +--remove_file $MYSQLD_DATADIR/test/t1.csv + +CREATE TABLE t1 +( + c1 CHAR(12) NOT NULL +) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv'; +INSERT INTO t1 VALUES ('á'); +SELECT * FROM t1; +DROP TABLE t1; +--chmod 0777 $MYSQLD_DATADIR/test/t1.csv +--replace_result $MYSQLD_DATADIR DATADIR +--eval SELECT HEX(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t1.csv'),'\r\n','\n')); +--remove_file $MYSQLD_DATADIR/test/t1.csv + +CREATE TABLE t1 +( + c1 CHAR(12) NOT NULL +) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv' + CHARSET=latin1; +INSERT INTO t1 VALUES ('á'); +SELECT * FROM t1; +DROP TABLE t1; +--chmod 0777 $MYSQLD_DATADIR/test/t1.csv +--replace_result $MYSQLD_DATADIR DATADIR +--eval SELECT HEX(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t1.csv'),'\r\n','\n')); +--remove_file $MYSQLD_DATADIR/test/t1.csv + +CREATE TABLE t1 +( + c1 CHAR(12) NOT NULL +) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv' + CHARSET=latin1 DATA_CHARSET=utf8; +INSERT INTO t1 VALUES ('á'); +SELECT * FROM t1; +DROP TABLE t1; +--chmod 0777 $MYSQLD_DATADIR/test/t1.csv +--replace_result $MYSQLD_DATADIR DATADIR +--eval SELECT HEX(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t1.csv'),'\r\n','\n')); +--remove_file $MYSQLD_DATADIR/test/t1.csv + +CREATE TABLE t1 +( + c1 CHAR(12) CHARACTER SET latin1 NOT NULL, + c2 CHAR(12) CHARACTER SET utf8 NOT NULL +) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv'; +INSERT INTO t1 VALUES ('á','á'); +SELECT * FROM t1; +DROP TABLE t1; +--chmod 0777 $MYSQLD_DATADIR/test/t1.csv +--replace_result $MYSQLD_DATADIR DATADIR +--eval SELECT HEX(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t1.csv'),'\r\n','\n')); +--remove_file $MYSQLD_DATADIR/test/t1.csv + + +# +# Clean up +# +--remove_file $MYSQLD_DATADIR/test/people.csv +--remove_file $MYSQLD_DATADIR/test/tmp.csv diff --git a/storage/connect/mysql-test/connect/t/dbf.test b/storage/connect/mysql-test/connect/t/dbf.test index 467c608fe38..b798b1a2bc5 100644 --- a/storage/connect/mysql-test/connect/t/dbf.test +++ b/storage/connect/mysql-test/connect/t/dbf.test @@ -68,9 +68,9 @@ ALTER TABLE t1 READONLY=Yes; SHOW CREATE TABLE t1; --error ER_OPEN_AS_READONLY INSERT INTO t1 VALUES (30); ---error ER_OPEN_AS_READONLY +--error ER_GET_ERRMSG UPDATE t1 SET a=30 WHERE a=10; ---error ER_OPEN_AS_READONLY +--error ER_GET_ERRMSG DELETE FROM t1 WHERE a=10; --error ER_OPEN_AS_READONLY TRUNCATE TABLE t1; diff --git a/storage/connect/mysql-test/connect/t/fix.test b/storage/connect/mysql-test/connect/t/fix.test index 72eb274f7d6..f05abbb9b92 100644 --- a/storage/connect/mysql-test/connect/t/fix.test +++ b/storage/connect/mysql-test/connect/t/fix.test @@ -30,9 +30,9 @@ ALTER TABLE t1 READONLY=1; SHOW CREATE TABLE t1; --error ER_OPEN_AS_READONLY INSERT INTO t1 VALUES (20); ---error ER_OPEN_AS_READONLY +--error ER_GET_ERRMSG UPDATE t1 SET id=20 WHERE id=10; ---error ER_OPEN_AS_READONLY +--error ER_GET_ERRMSG DELETE FROM t1 WHERE id=10; --error ER_OPEN_AS_READONLY TRUNCATE TABLE t1; diff --git a/storage/connect/mysql-test/connect/t/ini.test b/storage/connect/mysql-test/connect/t/ini.test index dd3b84e4699..449b97204a6 100644 --- a/storage/connect/mysql-test/connect/t/ini.test +++ b/storage/connect/mysql-test/connect/t/ini.test @@ -1,156 +1,156 @@ -let $MYSQLD_DATADIR= `select @@datadir`;
-
---copy_file $MTR_SUITE_DIR/std_data/contact.ini $MYSQLD_DATADIR/test/contact.ini
-
---echo #
---echo # Testing errors
---echo #
-CREATE TABLE t1
-(
- ID INT
-) Engine=CONNECT TABLE_TYPE=INI FILE_NAME='nonexistent.txt';
---replace_regex /on .*test.nonexistent.txt/on DATADIR\/test\/nonexistent.txt/
-# TODO: check why this is needed for Windows
---replace_result Open(rt) Open(rb)
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Testing examples from the manual
---echo #
-
-CREATE TABLE t1
-(
- contact CHAR(16) flag=1,
- name CHAR(20),
- forename CHAR(32),
- hired date date_format='DD/MM/YYYY',
- address CHAR(64),
- city CHAR(20),
- zipcode CHAR(8),
- tel CHAR(16)
-) ENGINE=CONNECT TABLE_TYPE=INI FILE_NAME='contact.ini';
-SELECT contact, name, hired, city, tel FROM t1;
-
-UPDATE t1 SET forename= 'Harry' where contact='UK1';
-SELECT * FROM t1 WHERE contact='UK1';
-INSERT INTO t1 (contact,forename) VALUES ('UK1','Harrison');
-SELECT * FROM t1 WHERE contact='UK1';
-INSERT INTO t1 (contact,forename) VALUES ('UK2','John');
-SELECT * FROM t1 WHERE contact='UK2';
-DROP TABLE t1;
---chmod 0777 $MYSQLD_DATADIR/test/contact.ini
---replace_result $MYSQLD_DATADIR DATADIR
---eval SELECT REPLACE(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/contact.ini'),'\r\n','\n'),'\n\n','\n');
-
-CREATE TABLE t1
-(
- section CHAR(16) flag=1,
- keyname CHAR(16) flag=2,
- value CHAR(32)
-) ENGINE=CONNECT TABLE_TYPE=INI FILE_NAME='contact.ini'
- OPTION_LIST='Layout=Row';
-UPDATE t1 SET value='Paul' WHERE section='UK2' AND keyname='forename';
-SELECT * FROM t1;
-DROP TABLE t1;
---chmod 0777 $MYSQLD_DATADIR/test/contact.ini
---replace_result $MYSQLD_DATADIR DATADIR
---eval SELECT REPLACE(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/contact.ini'),'\r\n','\n'),'\n\n','\n');
-
-
---echo #
---echo # Testing that the underlying file is created
---echo #
-CREATE TABLE t1
-(
- contact CHAR(12) NOT NULL flag=1,
- c2 CHAR(12) NOT NULL
-) ENGINE=CONNECT TABLE_TYPE=INI FILE_NAME='tmp.ini';
-INSERT INTO t1 VALUES (10,10),(20,20),(300,300),(4000,4000), ('a b','c d');
-SELECT * FROM t1;
-DROP TABLE t1;
---chmod 0777 $MYSQLD_DATADIR/test/tmp.ini
---replace_result $MYSQLD_DATADIR DATADIR
---eval SELECT REPLACE(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/tmp.ini'),'\r\n','\n'),'\n\n','\n');
-
-
---echo #
---echo # Testing bad table
---echo #
-CREATE TABLE t1
-(
- id INT
-) ENGINE=CONNECT TABLE_TYPE=INI FILE_NAME='t1.ini';
---error ER_GET_ERRMSG
-INSERT INTO t1 VALUES (10);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-
---echo #
---echo # Testing READONLY tables
---echo #
-CREATE TABLE t1
-(
- contact CHAR(10) flag=1,
- c2 CHAR(60)
-) ENGINE=CONNECT TABLE_TYPE=INI FILE_NAME='t1.ini';
-INSERT INTO t1 VALUES ('UK',10),('FR',20),('RU',30);
-SELECT * FROM t1;
-ALTER TABLE t1 READONLY=1;
-SHOW CREATE TABLE t1;
---error ER_OPEN_AS_READONLY
-INSERT INTO t1 VALUES ('US',40);
---error ER_OPEN_AS_READONLY
-UPDATE t1 SET c2=20 WHERE c2=10;
---error ER_OPEN_AS_READONLY
-DELETE FROM t1 WHERE c2=10;
---error ER_OPEN_AS_READONLY
-TRUNCATE TABLE t1;
-ALTER TABLE t1 READONLY=0;
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES ('US',40);
-SELECT * FROM t1;
-DROP TABLE t1;
---remove_file $MYSQLD_DATADIR/test/t1.ini
-
-
-#
-# Clean up
-#
---remove_file $MYSQLD_DATADIR/test/contact.ini
---remove_file $MYSQLD_DATADIR/test/tmp.ini
-
-
---echo #
---echo # Bug: TABLE_TYPE=ini does not clear memory between CREATE TABLEs
---echo #
-CREATE TABLE t1 (sec CHAR(10) NOT NULL FLAG=1, val CHAR(10) NOT NULL)
-ENGINE=CONNECT TABLE_TYPE=INI;
-INSERT INTO t1 VALUES ('sec1','val1'),('sec2','val2');
-SELECT sec AS s, val AS v FROM t1;
-DROP TABLE t1;
-CREATE TABLE t1 (sec2 CHAR(10) NOT NULL FLAG=1, val2 CHAR(10) NOT NULL)
-ENGINE=CONNECT TABLE_TYPE=INI;
-INSERT INTO t1 VALUES ('sec1','val11'),('sec2','val22');
-SELECT sec2 AS s, val2 AS v FROM t1;
---chmod 0777 $MYSQLD_DATADIR/test/t1.ini
---replace_result $MYSQLD_DATADIR DATADIR
---eval SELECT REPLACE(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t1.ini'),'\r\n','\n'),'\n\n','\n');
-DROP TABLE t1;
-
-CREATE TABLE t1 (sec CHAR(10) NOT NULL FLAG=1, val CHAR(10) NOT NULL)
-ENGINE=CONNECT TABLE_TYPE=INI;
-CREATE TABLE t2 (sec CHAR(10) NOT NULL FLAG=1, val CHAR(10) NOT NULL)
-ENGINE=CONNECT TABLE_TYPE=INI;
-INSERT INTO t1 VALUES('1sec1','1val1'),('1sec2','1val2');
-INSERT INTO t2 VALUES('2sec1','2val1'),('2sec2','2val2');
-SELECT sec AS s, val AS v FROM t1;
---chmod 0777 $MYSQLD_DATADIR/test/t1.ini
---replace_result $MYSQLD_DATADIR DATADIR
---eval SELECT REPLACE(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t1.ini'),'\r\n','\n'),'\n\n','\n');
-SELECT sec AS s, val AS v FROM t2;
---chmod 0777 $MYSQLD_DATADIR/test/t2.ini
---replace_result $MYSQLD_DATADIR DATADIR
---eval SELECT REPLACE(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t2.ini'),'\r\n','\n'),'\n\n','\n');
-DROP TABLE t1, t2;
+let $MYSQLD_DATADIR= `select @@datadir`; + +--copy_file $MTR_SUITE_DIR/std_data/contact.ini $MYSQLD_DATADIR/test/contact.ini + +--echo # +--echo # Testing errors +--echo # +CREATE TABLE t1 +( + ID INT +) Engine=CONNECT TABLE_TYPE=INI FILE_NAME='nonexistent.txt'; +--replace_regex /on .*test.nonexistent.txt/on DATADIR\/test\/nonexistent.txt/ +# TODO: check why this is needed for Windows +--replace_result Open(rt) Open(rb) +SELECT * FROM t1; +DROP TABLE t1; + +--echo # +--echo # Testing examples from the manual +--echo # + +CREATE TABLE t1 +( + contact CHAR(16) flag=1, + name CHAR(20), + forename CHAR(32), + hired date date_format='DD/MM/YYYY', + address CHAR(64), + city CHAR(20), + zipcode CHAR(8), + tel CHAR(16) +) ENGINE=CONNECT TABLE_TYPE=INI FILE_NAME='contact.ini'; +SELECT contact, name, hired, city, tel FROM t1; + +UPDATE t1 SET forename= 'Harry' where contact='UK1'; +SELECT * FROM t1 WHERE contact='UK1'; +INSERT INTO t1 (contact,forename) VALUES ('UK1','Harrison'); +SELECT * FROM t1 WHERE contact='UK1'; +INSERT INTO t1 (contact,forename) VALUES ('UK2','John'); +SELECT * FROM t1 WHERE contact='UK2'; +DROP TABLE t1; +--chmod 0777 $MYSQLD_DATADIR/test/contact.ini +--replace_result $MYSQLD_DATADIR DATADIR +--eval SELECT REPLACE(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/contact.ini'),'\r\n','\n'),'\n\n','\n'); + +CREATE TABLE t1 +( + section CHAR(16) flag=1, + keyname CHAR(16) flag=2, + value CHAR(32) +) ENGINE=CONNECT TABLE_TYPE=INI FILE_NAME='contact.ini' + OPTION_LIST='Layout=Row'; +UPDATE t1 SET value='Paul' WHERE section='UK2' AND keyname='forename'; +SELECT * FROM t1; +DROP TABLE t1; +--chmod 0777 $MYSQLD_DATADIR/test/contact.ini +--replace_result $MYSQLD_DATADIR DATADIR +--eval SELECT REPLACE(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/contact.ini'),'\r\n','\n'),'\n\n','\n'); + + +--echo # +--echo # Testing that the underlying file is created +--echo # +CREATE TABLE t1 +( + contact CHAR(12) NOT NULL flag=1, + c2 CHAR(12) NOT NULL +) ENGINE=CONNECT TABLE_TYPE=INI FILE_NAME='tmp.ini'; +INSERT INTO t1 VALUES (10,10),(20,20),(300,300),(4000,4000), ('a b','c d'); +SELECT * FROM t1; +DROP TABLE t1; +--chmod 0777 $MYSQLD_DATADIR/test/tmp.ini +--replace_result $MYSQLD_DATADIR DATADIR +--eval SELECT REPLACE(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/tmp.ini'),'\r\n','\n'),'\n\n','\n'); + + +--echo # +--echo # Testing bad table +--echo # +CREATE TABLE t1 +( + id INT +) ENGINE=CONNECT TABLE_TYPE=INI FILE_NAME='t1.ini'; +--error ER_GET_ERRMSG +INSERT INTO t1 VALUES (10); +SELECT * FROM t1; +DROP TABLE t1; + + +--echo # +--echo # Testing READONLY tables +--echo # +CREATE TABLE t1 +( + contact CHAR(10) flag=1, + c2 CHAR(60) +) ENGINE=CONNECT TABLE_TYPE=INI FILE_NAME='t1.ini'; +INSERT INTO t1 VALUES ('UK',10),('FR',20),('RU',30); +SELECT * FROM t1; +ALTER TABLE t1 READONLY=1; +SHOW CREATE TABLE t1; +--error ER_OPEN_AS_READONLY +INSERT INTO t1 VALUES ('US',40); +--error ER_GET_ERRMSG +UPDATE t1 SET c2=20 WHERE c2=10; +--error ER_GET_ERRMSG +DELETE FROM t1 WHERE c2=10; +--error ER_OPEN_AS_READONLY +TRUNCATE TABLE t1; +ALTER TABLE t1 READONLY=0; +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES ('US',40); +SELECT * FROM t1; +DROP TABLE t1; +--remove_file $MYSQLD_DATADIR/test/t1.ini + + +# +# Clean up +# +--remove_file $MYSQLD_DATADIR/test/contact.ini +--remove_file $MYSQLD_DATADIR/test/tmp.ini + + +--echo # +--echo # Bug: TABLE_TYPE=ini does not clear memory between CREATE TABLEs +--echo # +CREATE TABLE t1 (sec CHAR(10) NOT NULL FLAG=1, val CHAR(10) NOT NULL) +ENGINE=CONNECT TABLE_TYPE=INI; +INSERT INTO t1 VALUES ('sec1','val1'),('sec2','val2'); +SELECT sec AS s, val AS v FROM t1; +DROP TABLE t1; +CREATE TABLE t1 (sec2 CHAR(10) NOT NULL FLAG=1, val2 CHAR(10) NOT NULL) +ENGINE=CONNECT TABLE_TYPE=INI; +INSERT INTO t1 VALUES ('sec1','val11'),('sec2','val22'); +SELECT sec2 AS s, val2 AS v FROM t1; +--chmod 0777 $MYSQLD_DATADIR/test/t1.ini +--replace_result $MYSQLD_DATADIR DATADIR +--eval SELECT REPLACE(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t1.ini'),'\r\n','\n'),'\n\n','\n'); +DROP TABLE t1; + +CREATE TABLE t1 (sec CHAR(10) NOT NULL FLAG=1, val CHAR(10) NOT NULL) +ENGINE=CONNECT TABLE_TYPE=INI; +CREATE TABLE t2 (sec CHAR(10) NOT NULL FLAG=1, val CHAR(10) NOT NULL) +ENGINE=CONNECT TABLE_TYPE=INI; +INSERT INTO t1 VALUES('1sec1','1val1'),('1sec2','1val2'); +INSERT INTO t2 VALUES('2sec1','2val1'),('2sec2','2val2'); +SELECT sec AS s, val AS v FROM t1; +--chmod 0777 $MYSQLD_DATADIR/test/t1.ini +--replace_result $MYSQLD_DATADIR DATADIR +--eval SELECT REPLACE(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t1.ini'),'\r\n','\n'),'\n\n','\n'); +SELECT sec AS s, val AS v FROM t2; +--chmod 0777 $MYSQLD_DATADIR/test/t2.ini +--replace_result $MYSQLD_DATADIR DATADIR +--eval SELECT REPLACE(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t2.ini'),'\r\n','\n'),'\n\n','\n'); +DROP TABLE t1, t2; diff --git a/storage/connect/mysql-test/connect/t/vec.test b/storage/connect/mysql-test/connect/t/vec.test index aca78987a97..c88a857761d 100644 --- a/storage/connect/mysql-test/connect/t/vec.test +++ b/storage/connect/mysql-test/connect/t/vec.test @@ -1,80 +1,80 @@ -let $MYSQLD_DATADIR= `select @@datadir`;
-
-CREATE TABLE dir1 (
- spath VARCHAR(256) NOT NULL flag=1,
- fname VARCHAR(256) NOT NULL,
- ftype CHAR(4) NOT NULL,
- size DOUBLE(12,0) NOT NULL flag=5
-) ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*vec*';
-
-
-CREATE TABLE t1
-(
- a INT NOT NULL,
- b CHAR(10) NOT NULL
-) ENGINE=CONNECT TABLE_TYPE=VEC FILE_NAME='t1vec';
-SHOW CREATE TABLE t1;
-# Testing SELECT on empty file
---replace_regex /Open.rb. error 2 on .*\/test\/t1vec/Open(rb) error 2 on DATADIR\/test\/t1vec/
-SELECT * FROM t1;
-INSERT INTO t1 VALUES (0,'test01'), (1,'test01'), (2,'test02'), (3,'test03');
-SELECT * FROM t1;
-SELECT a FROM t1;
-SELECT b FROM t1;
---replace_result $MYSQLD_DATADIR DATADIR/
-SELECT fname, ftype, size FROM dir1 ORDER BY fname, ftype;
-DROP TABLE t1;
---remove_file $MYSQLD_DATADIR/test/t1vec1
---remove_file $MYSQLD_DATADIR/test/t1vec2
-
-
-CREATE TABLE t1
-(
- a INT NOT NULL,
- b CHAR(10) NOT NULL
-) ENGINE=CONNECT TABLE_TYPE=VEC FILE_NAME='t1vec' MAX_ROWS=10;
-SHOW CREATE TABLE t1;
-# Testing SELECTs on empty file
---replace_regex /Open.rb. error 2 on .*\/test\/t1vec/Open(rb) error 2 on DATADIR\/test\/t1vec/
-SELECT * FROM t1;
---replace_regex /Open.rb. error 2 on .*\/test\/t1vec/Open(rb) error 2 on DATADIR\/test\/t1vec/
-SELECT a FROM t1;
---replace_regex /Open.rb. error 2 on .*\/test\/t1vec/Open(rb) error 2 on DATADIR\/test\/t1vec/
-SELECT b FROM t1;
-INSERT INTO t1 VALUES (0,'test01'), (1,'test01'), (2,'test02'), (3,'test03');
-SELECT * FROM t1;
-SELECT a FROM t1;
-SELECT b FROM t1;
---replace_result $MYSQLD_DATADIR DATADIR/
-SELECT fname, ftype, size FROM dir1 ORDER BY fname, ftype;
---echo #
---echo # Testing READONLY
---echo #
-ALTER TABLE t1 READONLY=yes;
-SHOW CREATE TABLE t1;
---error ER_OPEN_AS_READONLY
-INSERT INTO t1 VALUES (4,'test04');
---error ER_OPEN_AS_READONLY
-UPDATE t1 SET b='test04' WHERE a=3;
---error ER_OPEN_AS_READONLY
-DELETE FROM t1 WHERE a=3;
---error ER_OPEN_AS_READONLY
-TRUNCATE TABLE t1;
-ALTER TABLE t1 READONLY=no;
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (4,'test04');
-UPDATE t1 SET b='test04a' WHERE a=4;
-DELETE FROM t1 WHERE a=0;
-SELECT * FROM t1;
-TRUNCATE TABLE t1;
-SELECT fname, ftype, size FROM dir1 ORDER BY fname, ftype;
-SELECT * FROM t1;
-DROP TABLE t1;
---remove_file $MYSQLD_DATADIR/test/t1vec
---remove_file $MYSQLD_DATADIR/test/t1vec.blk
-
-
---echo #
---echo # Clean up
---echo #
-DROP TABLE dir1;
+let $MYSQLD_DATADIR= `select @@datadir`; + +CREATE TABLE dir1 ( + spath VARCHAR(256) NOT NULL flag=1, + fname VARCHAR(256) NOT NULL, + ftype CHAR(4) NOT NULL, + size DOUBLE(12,0) NOT NULL flag=5 +) ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*vec*'; + + +CREATE TABLE t1 +( + a INT NOT NULL, + b CHAR(10) NOT NULL +) ENGINE=CONNECT TABLE_TYPE=VEC FILE_NAME='t1vec'; +SHOW CREATE TABLE t1; +# Testing SELECT on empty file +--replace_regex /Open.rb. error 2 on .*\/test\/t1vec/Open(rb) error 2 on DATADIR\/test\/t1vec/ +SELECT * FROM t1; +INSERT INTO t1 VALUES (0,'test01'), (1,'test01'), (2,'test02'), (3,'test03'); +SELECT * FROM t1; +SELECT a FROM t1; +SELECT b FROM t1; +--replace_result $MYSQLD_DATADIR DATADIR/ +SELECT fname, ftype, size FROM dir1 ORDER BY fname, ftype; +DROP TABLE t1; +--remove_file $MYSQLD_DATADIR/test/t1vec1 +--remove_file $MYSQLD_DATADIR/test/t1vec2 + + +CREATE TABLE t1 +( + a INT NOT NULL, + b CHAR(10) NOT NULL +) ENGINE=CONNECT TABLE_TYPE=VEC FILE_NAME='t1vec' MAX_ROWS=10; +SHOW CREATE TABLE t1; +# Testing SELECTs on empty file +--replace_regex /Open.rb. error 2 on .*\/test\/t1vec/Open(rb) error 2 on DATADIR\/test\/t1vec/ +SELECT * FROM t1; +--replace_regex /Open.rb. error 2 on .*\/test\/t1vec/Open(rb) error 2 on DATADIR\/test\/t1vec/ +SELECT a FROM t1; +--replace_regex /Open.rb. error 2 on .*\/test\/t1vec/Open(rb) error 2 on DATADIR\/test\/t1vec/ +SELECT b FROM t1; +INSERT INTO t1 VALUES (0,'test01'), (1,'test01'), (2,'test02'), (3,'test03'); +SELECT * FROM t1; +SELECT a FROM t1; +SELECT b FROM t1; +--replace_result $MYSQLD_DATADIR DATADIR/ +SELECT fname, ftype, size FROM dir1 ORDER BY fname, ftype; +--echo # +--echo # Testing READONLY +--echo # +ALTER TABLE t1 READONLY=yes; +SHOW CREATE TABLE t1; +--error ER_OPEN_AS_READONLY +INSERT INTO t1 VALUES (4,'test04'); +--error ER_GET_ERRMSG +UPDATE t1 SET b='test04' WHERE a=3; +--error ER_GET_ERRMSG +DELETE FROM t1 WHERE a=3; +--error ER_OPEN_AS_READONLY +TRUNCATE TABLE t1; +ALTER TABLE t1 READONLY=no; +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES (4,'test04'); +UPDATE t1 SET b='test04a' WHERE a=4; +DELETE FROM t1 WHERE a=0; +SELECT * FROM t1; +TRUNCATE TABLE t1; +SELECT fname, ftype, size FROM dir1 ORDER BY fname, ftype; +SELECT * FROM t1; +DROP TABLE t1; +--remove_file $MYSQLD_DATADIR/test/t1vec +--remove_file $MYSQLD_DATADIR/test/t1vec.blk + + +--echo # +--echo # Clean up +--echo # +DROP TABLE dir1; |