Commit e9307939 authored by Alexander Barkov's avatar Alexander Barkov

Adding READONLY tests

modified:
  mysql-test/suite/connect/r/bin.result
  mysql-test/suite/connect/r/csv.result
  mysql-test/suite/connect/r/dbf.result
  mysql-test/suite/connect/r/fix.result
  mysql-test/suite/connect/r/fmt.result
  mysql-test/suite/connect/r/ini.result
  mysql-test/suite/connect/r/vec.result
  mysql-test/suite/connect/t/bin.test
  mysql-test/suite/connect/t/csv.test
  mysql-test/suite/connect/t/dbf.test
  mysql-test/suite/connect/t/fix.test
  mysql-test/suite/connect/t/fmt.test
  mysql-test/suite/connect/t/ini.test
  mysql-test/suite/connect/t/vec.test
parent c5233703
...@@ -35,6 +35,57 @@ fig name birth id salary dept ...@@ -35,6 +35,57 @@ fig name birth id salary dept
5555 RONALD 1980-02-26 3333 4444.44 555 5555 RONALD 1980-02-26 3333 4444.44 555
DROP TABLE t1; DROP TABLE t1;
# #
# Testing READONLY tables
#
CREATE TABLE t1
(
fig INT(4) NOT NULL FIELD_FORMAT='C',
name CHAR(10) not null,
birth DATE NOT NULL,
id CHAR(5) NOT NULL FIELD_FORMAT='S',
salary DOUBLE(9,2) NOT NULL DEFAULT 0.00 FIELD_FORMAT='F',
dept INT(4) NOT NULL FIELD_FORMAT='S'
) ENGINE=CONNECT TABLE_TYPE=BIN READONLY=Yes FILE_NAME='Testbal.dat';
INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777);
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
ALTER TABLE t1 READONLY=NO;
Warnings:
Warning 1105 No check done for compatible changes, you are on your own!
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`fig` int(4) NOT NULL `FIELD_FORMAT`='C',
`name` char(10) NOT NULL,
`birth` date NOT NULL,
`id` char(5) NOT NULL `FIELD_FORMAT`='S',
`salary` double(9,2) NOT NULL DEFAULT '0.00' `FIELD_FORMAT`='F',
`dept` int(4) NOT NULL `FIELD_FORMAT`='S'
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=BIN `FILE_NAME`='Testbal.dat' `READONLY`=NO
INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777);
SELECT * FROM t1;
fig name birth id salary dept
5500 ARCHIBALD 1980-01-25 3789 4380.50 318
123 OLIVER 1953-08-10 23456 3400.68 2158
3123 FOO 2002-07-23 888 0.00 318
5555 RONALD 1980-02-26 3333 4444.44 555
7777 BILL 1973-06-30 4444 5555.56 777
ALTER TABLE t1 READONLY=YES;
Warnings:
Warning 1105 No check done for compatible changes, you are on your own!
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`fig` int(4) NOT NULL `FIELD_FORMAT`='C',
`name` char(10) NOT NULL,
`birth` date NOT NULL,
`id` char(5) NOT NULL `FIELD_FORMAT`='S',
`salary` double(9,2) NOT NULL DEFAULT '0.00' `FIELD_FORMAT`='F',
`dept` int(4) NOT NULL `FIELD_FORMAT`='S'
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=BIN `FILE_NAME`='Testbal.dat' `READONLY`=YES
INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777);
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
DROP TABLE t1;
#
# Testing that the underlying file is created # Testing that the underlying file is created
# #
CREATE TABLE t1 CREATE TABLE t1
......
...@@ -38,6 +38,65 @@ Name;birth;children ...@@ -38,6 +38,65 @@ Name;birth;children
"Nabucho";12/08/03;2 "Nabucho";12/08/03;2
"RONALD";26/02/80;4 "RONALD";26/02/80;4
#
# Testing READONLY tables
#
CREATE TABLE t1
(
name CHAR(12),
birth DATE DATE_FORMAT='DD/MM/YY',
children SMALLINT(2)
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='people.csv'
HEADER=1 SEP_CHAR=';' QUOTED=1 READONLY=yes;
INSERT INTO t1 VALUES ('BILL','1973-06-30',5);
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
UPDATE t1 SET children=6 WHERE name='BILL';
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
DELETE FROM t1 WHERE name='BILL';
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
TRUNCATE TABLE t1;
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
SELECT * FROM t1;
name birth children
Archibald 2001-05-17 3
Nabucho 2003-08-12 2
RONALD 1980-02-26 4
ALTER TABLE t1 READONLY=no;
Warnings:
Warning 1105 No check done for compatible changes, you are on your own!
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`name` char(12) DEFAULT NULL,
`birth` date DEFAULT NULL `DATE_FORMAT`='DD/MM/YY',
`children` smallint(2) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=CSV `FILE_NAME`='people.csv' `HEADER`=1 `SEP_CHAR`=';' `QUOTED`=1 `READONLY`=no
INSERT INTO t1 VALUES ('BILL','1973-06-30',5);
SELECT * FROM t1;
name birth children
Archibald 2001-05-17 3
Nabucho 2003-08-12 2
RONALD 1980-02-26 4
BILL 1973-06-30 5
ALTER TABLE t1 READONLY=1;
Warnings:
Warning 1105 No check done for compatible changes, you are on your own!
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`name` char(12) DEFAULT NULL,
`birth` date DEFAULT NULL `DATE_FORMAT`='DD/MM/YY',
`children` smallint(2) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=CSV `FILE_NAME`='people.csv' `HEADER`=1 `SEP_CHAR`=';' `QUOTED`=1 `READONLY`=1
INSERT INTO t1 VALUES ('BILL','1973-06-30',5);
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
SELECT * FROM t1;
name birth children
Archibald 2001-05-17 3
Nabucho 2003-08-12 2
RONALD 1980-02-26 4
BILL 1973-06-30 5
DROP TABLE t1;
# #
# Testing that the underlying file is created # Testing that the underlying file is created
# #
......
...@@ -54,6 +54,9 @@ SET fieldno=fieldno + 1; ...@@ -54,6 +54,9 @@ SET fieldno=fieldno + 1;
END WHILE; END WHILE;
SELECT '--------'; SELECT '--------';
END// END//
#
# Testing READONLY tables
#
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
...@@ -65,6 +68,36 @@ SELECT * FROM t1; ...@@ -65,6 +68,36 @@ SELECT * FROM t1;
a a
10 10
20 20
ALTER TABLE t1 READONLY=Yes;
Warnings:
Warning 1105 No check done for compatible changes, you are on your own!
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=DBF `FILE_NAME`='t1.dbf' `READONLY`=Yes
INSERT INTO t1 VALUES (30);
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
UPDATE t1 SET a=30 WHERE a=10;
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
DELETE FROM t1 WHERE a=10;
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
TRUNCATE TABLE t1;
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
ALTER TABLE t1 READONLY=NO;
Warnings:
Warning 1105 No check done for compatible changes, you are on your own!
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=DBF `FILE_NAME`='t1.dbf' `READONLY`=NO
INSERT INTO t1 VALUES (30);
SELECT * FROM t1;
a
10
20
30
DROP TABLE t1; DROP TABLE t1;
# #
# This SQL script crashed (dbf01.sql) # This SQL script crashed (dbf01.sql)
......
...@@ -11,6 +11,47 @@ Warnings: ...@@ -11,6 +11,47 @@ Warnings:
Warning 1105 Open(rb) error 2 on DATADIR/test/nonexistent.txt: No such file or directory Warning 1105 Open(rb) error 2 on DATADIR/test/nonexistent.txt: No such file or directory
DROP TABLE t1; DROP TABLE t1;
# #
# Testing READONLY tables
#
CREATE TABLE t1
(
id INT
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='t1.txt';
INSERT INTO t1 VALUES (10);
SELECT * FROM t1;
id
10
ALTER TABLE t1 READONLY=1;
Warnings:
Warning 1105 No check done for compatible changes, you are on your own!
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=FIX `FILE_NAME`='t1.txt' `READONLY`=1
INSERT INTO t1 VALUES (20);
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
UPDATE t1 SET id=20 WHERE id=10;
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
DELETE FROM t1 WHERE id=10;
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
TRUNCATE TABLE t1;
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
ALTER TABLE t1 READONLY=0;
Warnings:
Warning 1105 No check done for compatible changes, you are on your own!
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=FIX `FILE_NAME`='t1.txt' `READONLY`=0
INSERT INTO t1 VALUES (20);
SELECT * FROM t1;
id
10
20
DROP TABLE t1;
#
# Testing manual examples # Testing manual examples
# #
CREATE TABLE t1 CREATE TABLE t1
......
...@@ -11,6 +11,16 @@ Warnings: ...@@ -11,6 +11,16 @@ Warnings:
Warning 1105 Open(rb) error 2 on DATADIR/test/nonexistent.txt: No such file or directory Warning 1105 Open(rb) error 2 on DATADIR/test/nonexistent.txt: No such file or directory
DROP TABLE t1; DROP TABLE t1;
# #
# Testing update on FMT tables
#
CREATE TABLE t1
(
id INT field_format=' %n%d%n'
) ENGINE=CONNECT TABLE_TYPE=FMT FILE_NAME='t1.txt';
INSERT INTO t1 VALUES (10),(20);
ERROR HY000: Got error 122 'Writing FMT files is not implemented yet' from CONNECT
DROP TABLE t1;
#
# Testing manual examples # Testing manual examples
# #
CREATE TABLE t1 CREATE TABLE t1
...@@ -48,4 +58,11 @@ ID NAME DEPNO SALARY ...@@ -48,4 +58,11 @@ ID NAME DEPNO SALARY
12345 BERTRAND 200 5009.13 12345 BERTRAND 200 5009.13
56 POIROT-DELMOTTE 0 18009.00 56 POIROT-DELMOTTE 0 18009.00
345 67 19000.25 345 67 19000.25
UPDATE t1 SET SALARY=1234;
ERROR HY000: Got error 122 'Writing FMT files is not implemented yet' from CONNECT
DELETE FROM t1 WHERE ID=56;
SELECT * FROM t1;
ID NAME DEPNO SALARY
12345 BERTRAND 200 5009.13
345 67 19000.25
DROP TABLE t1; DROP TABLE t1;
...@@ -158,3 +158,63 @@ c2=4000 ...@@ -158,3 +158,63 @@ c2=4000
[a b] [a b]
c2=c d c2=c d
#
# Testing bad table
#
CREATE TABLE t1
(
id INT
) ENGINE=CONNECT TABLE_TYPE=INI FILE_NAME='t1.ini';
INSERT INTO t1 VALUES (10);
ERROR HY000: Got error 122 'Section name must come first on Insert' from CONNECT
SELECT * FROM t1;
id
DROP TABLE t1;
#
# Testing READONLY tables
#
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;
contact c2
UK 10
FR 20
RU 30
ALTER TABLE t1 READONLY=1;
Warnings:
Warning 1105 No check done for compatible changes, you are on your own!
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`contact` char(10) DEFAULT NULL `flag`=1,
`c2` char(60) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=INI `FILE_NAME`='t1.ini' `READONLY`=1
INSERT INTO t1 VALUES ('US',40);
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
UPDATE t1 SET c2=20 WHERE c2=10;
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
DELETE FROM t1 WHERE c2=10;
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
TRUNCATE TABLE t1;
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
ALTER TABLE t1 READONLY=0;
Warnings:
Warning 1105 No check done for compatible changes, you are on your own!
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`contact` char(10) DEFAULT NULL `flag`=1,
`c2` char(60) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=INI `FILE_NAME`='t1.ini' `READONLY`=0
INSERT INTO t1 VALUES ('US',40);
SELECT * FROM t1;
contact c2
UK 10
FR 20
RU 30
US 40
DROP TABLE t1;
...@@ -90,6 +90,51 @@ SELECT fname, ftype, size FROM dir1 ORDER BY fname, ftype; ...@@ -90,6 +90,51 @@ SELECT fname, ftype, size FROM dir1 ORDER BY fname, ftype;
fname ftype size fname ftype size
t1vec 1400 t1vec 1400
t1vec .blk 8 t1vec .blk 8
#
# Testing READONLY
#
ALTER TABLE t1 READONLY=yes;
Warnings:
Warning 1105 No check done for compatible changes, you are on your own!
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` char(10) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 MAX_ROWS=10 `TABLE_TYPE`=VEC `FILE_NAME`='t1vec' `READONLY`=yes
INSERT INTO t1 VALUES (4,'test04');
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
UPDATE t1 SET b='test04' WHERE a=3;
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
DELETE FROM t1 WHERE a=3;
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
TRUNCATE TABLE t1;
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
ALTER TABLE t1 READONLY=no;
Warnings:
Warning 1105 No check done for compatible changes, you are on your own!
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` char(10) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 MAX_ROWS=10 `TABLE_TYPE`=VEC `FILE_NAME`='t1vec' `READONLY`=no
INSERT INTO t1 VALUES (4,'test04');
UPDATE t1 SET b='test04a' WHERE a=4;
DELETE FROM t1 WHERE a=0;
SELECT * FROM t1;
a b
1 test01
2 test02
3 test03
4 test04a
TRUNCATE TABLE t1;
SELECT fname, ftype, size FROM dir1 ORDER BY fname, ftype;
fname ftype size
t1vec 0
t1vec .blk 8
SELECT * FROM t1;
a b
DROP TABLE t1; DROP TABLE t1;
# #
# Clean up # Clean up
......
...@@ -33,6 +33,31 @@ SELECT * FROM t1; ...@@ -33,6 +33,31 @@ SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # Testing READONLY tables
--echo #
CREATE TABLE t1
(
fig INT(4) NOT NULL FIELD_FORMAT='C',
name CHAR(10) not null,
birth DATE NOT NULL,
id CHAR(5) NOT NULL FIELD_FORMAT='S',
salary DOUBLE(9,2) NOT NULL DEFAULT 0.00 FIELD_FORMAT='F',
dept INT(4) NOT NULL FIELD_FORMAT='S'
) ENGINE=CONNECT TABLE_TYPE=BIN READONLY=Yes FILE_NAME='Testbal.dat';
--error ER_GET_ERRMSG
INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777);
ALTER TABLE t1 READONLY=NO;
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777);
SELECT * FROM t1;
ALTER TABLE t1 READONLY=YES;
SHOW CREATE TABLE t1;
--error ER_GET_ERRMSG
INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777);
DROP TABLE t1;
--echo # --echo #
--echo # Testing that the underlying file is created --echo # Testing that the underlying file is created
--echo # --echo #
......
...@@ -32,6 +32,36 @@ DROP TABLE t1; ...@@ -32,6 +32,36 @@ DROP TABLE t1;
--replace_result $MYSQLD_DATADIR DATADIR --replace_result $MYSQLD_DATADIR DATADIR
--eval SELECT REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/people.csv'),'\r\n','\n'); --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),
birth DATE DATE_FORMAT='DD/MM/YY',
children SMALLINT(2)
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='people.csv'
HEADER=1 SEP_CHAR=';' QUOTED=1 READONLY=yes;
--error ER_GET_ERRMSG
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_GET_ERRMSG
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_GET_ERRMSG
INSERT INTO t1 VALUES ('BILL','1973-06-30',5);
SELECT * FROM t1;
DROP TABLE t1;
--echo # --echo #
--echo # Testing that the underlying file is created --echo # Testing that the underlying file is created
......
...@@ -57,13 +57,31 @@ END// ...@@ -57,13 +57,31 @@ END//
DELIMITER ;// DELIMITER ;//
--echo #
--echo # Testing READONLY tables
--echo #
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES (10),(20); INSERT INTO t1 VALUES (10),(20);
SELECT * FROM t1; SELECT * FROM t1;
ALTER TABLE t1 READONLY=Yes;
SHOW CREATE TABLE t1;
--error ER_GET_ERRMSG
INSERT INTO t1 VALUES (30);
--error ER_GET_ERRMSG
UPDATE t1 SET a=30 WHERE a=10;
--error ER_GET_ERRMSG
DELETE FROM t1 WHERE a=10;
--error ER_GET_ERRMSG
TRUNCATE TABLE t1;
ALTER TABLE t1 READONLY=NO;
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES (30);
SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t1.dbf --remove_file $MYSQLD_DATADIR/test/t1.dbf
--echo # --echo #
--echo # This SQL script crashed (dbf01.sql) --echo # This SQL script crashed (dbf01.sql)
--echo # --echo #
......
...@@ -16,6 +16,32 @@ CREATE TABLE t1 ...@@ -16,6 +16,32 @@ CREATE TABLE t1
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # Testing READONLY tables
--echo #
CREATE TABLE t1
(
id INT
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='t1.txt';
INSERT INTO t1 VALUES (10);
SELECT * FROM t1;
ALTER TABLE t1 READONLY=1;
SHOW CREATE TABLE t1;
--error ER_GET_ERRMSG
INSERT INTO t1 VALUES (20);
--error ER_GET_ERRMSG
UPDATE t1 SET id=20 WHERE id=10;
--error ER_GET_ERRMSG
DELETE FROM t1 WHERE id=10;
--error ER_GET_ERRMSG
TRUNCATE TABLE t1;
ALTER TABLE t1 READONLY=0;
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES (20);
SELECT * FROM t1;
DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t1.txt
--echo # --echo #
--echo # Testing manual examples --echo # Testing manual examples
......
...@@ -16,6 +16,25 @@ SELECT * FROM t1; ...@@ -16,6 +16,25 @@ SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # Testing update on FMT tables
--echo #
CREATE TABLE t1
(
id INT field_format=' %n%d%n'
) ENGINE=CONNECT TABLE_TYPE=FMT FILE_NAME='t1.txt';
--error ER_GET_ERRMSG
INSERT INTO t1 VALUES (10),(20);
# TODO:
#--error ER_GET_ERRMSG
#UPDATE t1 SET id=20;
#TRUNCATE TABLE t1;
#DELETE FROM t1 WHERE id=10;
#SELECT * FROM t1;
DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t1.txt
--echo # --echo #
--echo # Testing manual examples --echo # Testing manual examples
--echo # --echo #
...@@ -51,6 +70,12 @@ CREATE TABLE t1 ...@@ -51,6 +70,12 @@ CREATE TABLE t1
SALARY Double(12,2) field_format=' ; %n%f%n' SALARY Double(12,2) field_format=' ; %n%f%n'
) Engine=CONNECT table_type=FMT file_name='funny2.txt'; ) Engine=CONNECT table_type=FMT file_name='funny2.txt';
SELECT * FROM t1; SELECT * FROM t1;
--error ER_GET_ERRMSG
UPDATE t1 SET SALARY=1234;
# TODO: this query crashes
# UPDATE t1 SET SALARY=1234 WHERE ID=56;
DELETE FROM t1 WHERE ID=56;
SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
# #
......
...@@ -72,6 +72,48 @@ DROP TABLE t1; ...@@ -72,6 +72,48 @@ DROP TABLE t1;
--replace_result $MYSQLD_DATADIR DATADIR --replace_result $MYSQLD_DATADIR DATADIR
--eval SELECT REPLACE(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/tmp.ini'),'\r\n','\n'),'\n\n','\n'); --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_GET_ERRMSG
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_GET_ERRMSG
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 # Clean up
# #
......
...@@ -47,6 +47,28 @@ SELECT a FROM t1; ...@@ -47,6 +47,28 @@ SELECT a FROM t1;
SELECT b FROM t1; SELECT b FROM t1;
--replace_result $MYSQLD_DATADIR DATADIR/ --replace_result $MYSQLD_DATADIR DATADIR/
SELECT fname, ftype, size FROM dir1 ORDER BY fname, ftype; 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_GET_ERRMSG
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_GET_ERRMSG
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; DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t1vec --remove_file $MYSQLD_DATADIR/test/t1vec
--remove_file $MYSQLD_DATADIR/test/t1vec.blk --remove_file $MYSQLD_DATADIR/test/t1vec.blk
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment