let $MYSQLD_DATADIR= `select @@datadir`;

--echo #
--echo # Testing FIX null columns
--echo #
CREATE TABLE t1
(
  id INT NOT NULL,
  nb INT,
  msg VARCHAR(12)
) ENGINE=CONNECT TABLE_TYPE=FIX;
--error ER_BAD_NULL_ERROR
INSERT INTO t1 values(NULL,1,'Hello');
INSERT INTO t1 values(10,4,NULL),(20,2,'Hello'),(0,0,'Zero');
SELECT * FROM t1;
SELECT* FROM t1 WHERE id IS NULL;
SELECT * FROM t1 WHERE nb IS NULL;
SELECT * FROM t1 WHERE msg IS NOT NULL;
DROP TABLE t1;

--echo #
--echo # Testing CSV null columns
--echo #
CREATE TABLE t1
(
  id INT NOT NULL,
  nb INT,
  msg VARCHAR(12)
) ENGINE=CONNECT TABLE_TYPE=CSV HEADER=1;
--error ER_BAD_NULL_ERROR
INSERT INTO t1 values(NULL,1,'Hello');
INSERT INTO t1 values(10,4,NULL),(20,2,'Hello'),(0,0,'Zero');
SELECT * FROM t1;
SELECT* FROM t1 WHERE id IS NULL;
SELECT * FROM t1 WHERE nb IS NULL;
SELECT * FROM t1 WHERE msg IS NOT NULL;
DROP TABLE t1;

--echo #
--echo # Testing BIN null columns
--echo #
CREATE TABLE t1
(
  id INT NOT NULL,
  nb INT,
  msg VARCHAR(12)
) ENGINE=CONNECT TABLE_TYPE=BIN;
--error ER_BAD_NULL_ERROR
INSERT INTO t1 values(NULL,1,'Hello');
INSERT INTO t1 values(10,4,NULL),(20,2,'Hello'),(0,0,'Zero');
SELECT * FROM t1;
SELECT* FROM t1 WHERE id IS NULL;
SELECT * FROM t1 WHERE nb IS NULL;
SELECT * FROM t1 WHERE msg IS NOT NULL;
DROP TABLE t1;

--echo #
--echo # Testing DBF null columns
--echo #
CREATE TABLE t1
(
  id INT NOT NULL,
  nb INT,
  msg VARCHAR(12)
) ENGINE=CONNECT TABLE_TYPE=DBF;
--error ER_BAD_NULL_ERROR
INSERT INTO t1 values(NULL,1,'Hello');
INSERT INTO t1 values(10,4,NULL),(20,2,'Hello'),(0,0,'Zero');
SELECT * FROM t1;
SELECT* FROM t1 WHERE id IS NULL;
SELECT * FROM t1 WHERE nb IS NULL;
SELECT * FROM t1 WHERE msg IS NOT NULL;
DROP TABLE t1;

--echo #
--echo # Testing INI null columns
--echo #
CREATE TABLE t1
(
  `sec` char(8) NOT NULL flag=1,
  `key` char(12)
) ENGINE=CONNECT TABLE_TYPE=INI;
INSERT INTO t1(sec) values('S1');
SELECT * FROM t1;
INSERT INTO t1 values('S1','Newval');
SELECT * FROM t1;
DROP TABLE t1;
