Commit 44efd729 authored by Olivier Bertrand's avatar Olivier Bertrand

- Updated to accept calculated default field length for date columns.

modified:
  mysql-test/suite/connect/r/index.result
  mysql-test/suite/connect/t/index.test
parent eab8fcfa
......@@ -9,8 +9,8 @@ prenom VARCHAR(20) NOT NULL,
sexe SMALLINT(1) NOT NULL COMMENT 'sexe 1:M 2:F',
aanais INT(4) NOT NULL,
mmnais INT(2) NOT NULL,
ddentree DATE NOT NULL field_length=6 date_format='YYYYMM',
ddnom DATE NOT NULL field_length=6 date_format='YYYYMM',
ddentree DATE NOT NULL date_format='YYYYMM',
ddnom DATE NOT NULL date_format='YYYYMM',
brut INT(5) NOT NULL,
net DOUBLE(8,2) NOT NULL,
service INT(2) NOT NULL,
......
let $MYSQLD_DATADIR= `select @@datadir`;
--copy_file $MYSQL_TEST_DIR/suite/connect/std_data/emp.txt $MYSQLD_DATADIR/test/emp.txt
--copy_file $MYSQL_TEST_DIR/suite/connect/std_data/sexe.csv $MYSQLD_DATADIR/test/sexe.csv
--copy_file $MYSQL_TEST_DIR/suite/connect/std_data/sitmat.csv $MYSQLD_DATADIR/test/sitmat.csv
--echo #
--echo # Testing indexing
--echo #
CREATE TABLE t1
(
matricule INT(4) KEY NOT NULL field_format='Z',
nom VARCHAR(16) NOT NULL,
prenom VARCHAR(20) NOT NULL,
sexe SMALLINT(1) NOT NULL COMMENT 'sexe 1:M 2:F',
aanais INT(4) NOT NULL,
mmnais INT(2) NOT NULL,
ddentree DATE NOT NULL field_length=6 date_format='YYYYMM',
ddnom DATE NOT NULL field_length=6 date_format='YYYYMM',
brut INT(5) NOT NULL,
net DOUBLE(8,2) NOT NULL,
service INT(2) NOT NULL,
sitmat CHAR(1) NOT NULL,
formation CHAR(5),
INDEX NP(nom,prenom)
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='emp.txt' ENDING=2;
SELECT * FROM t1 LIMIT 10;
SELECT SUM(brut) from t1;
--echo #
--echo # Testing file mapping
--echo #
ALTER TABLE t1 MAPPED=yes;
SELECT * FROM t1 LIMIT 10;
SELECT SUM(brut) FROM t1;
--echo #
--echo # Make the indexes
--echo #
OPTIMIZE TABLE t1;
SELECT * FROM t1 WHERE matricule = '0091';
SELECT * FROM t1 WHERE nom = 'FOCH';
SELECT * FROM t1 WHERE nom = 'FOCH' and prenom = 'DENIS';
--echo #
--echo # Testing UPDATE
--echo #
UPDATE t1 SET aanais = aanais + 16;
UPDATE t1 SET ddentree = adddate(ddentree, interval 16 year);
UPDATE t1 SET ddnom = adddate(ddnom, interval 16 year);
SELECT * FROM t1 WHERE nom = 'FOCH';
--echo #
--echo # Testing JOIN
--echo #
create table t2
(
sexe INT(1) KEY,
genre CHAR(8) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='sexe.csv' SEP_CHAR=';' MAPPED=yes ENDING=2;
SELECT * FROM t2;
OPTIMIZE TABLE t2;
SELECT nom, prenom, genre FROM t1 NATURAL JOIN t2 LIMIT 10;
--echo #
--echo # Another table
--echo #
CREATE TABLE t3 (
sitmat CHAR(1) KEY,
situation CHAR(12) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='sitmat.csv' SEP_CHAR=';' MAPPED=yes ENDING=2;
SELECT * FROM t3;
OPTIMIZE TABLE t3;
SELECT nom, prenom, genre, situation FROM t1 NATURAL JOIN t2 NATURAL JOIN t3 WHERE nom = 'FOCH';
--echo #
--echo # Testing DELETE
--echo #
DELETE FROM t1;
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
#
# Clean up
#
--remove_file $MYSQLD_DATADIR/test/emp.txt
--remove_file $MYSQLD_DATADIR/test/sexe.csv
--remove_file $MYSQLD_DATADIR/test/sitmat.csv
let $MYSQLD_DATADIR= `select @@datadir`;
--copy_file $MYSQL_TEST_DIR/suite/connect/std_data/emp.txt $MYSQLD_DATADIR/test/emp.txt
--copy_file $MYSQL_TEST_DIR/suite/connect/std_data/sexe.csv $MYSQLD_DATADIR/test/sexe.csv
--copy_file $MYSQL_TEST_DIR/suite/connect/std_data/sitmat.csv $MYSQLD_DATADIR/test/sitmat.csv
--echo #
--echo # Testing indexing
--echo #
CREATE TABLE t1
(
matricule INT(4) KEY NOT NULL field_format='Z',
nom VARCHAR(16) NOT NULL,
prenom VARCHAR(20) NOT NULL,
sexe SMALLINT(1) NOT NULL COMMENT 'sexe 1:M 2:F',
aanais INT(4) NOT NULL,
mmnais INT(2) NOT NULL,
ddentree DATE NOT NULL date_format='YYYYMM',
ddnom DATE NOT NULL date_format='YYYYMM',
brut INT(5) NOT NULL,
net DOUBLE(8,2) NOT NULL,
service INT(2) NOT NULL,
sitmat CHAR(1) NOT NULL,
formation CHAR(5),
INDEX NP(nom,prenom)
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='emp.txt' ENDING=2;
SELECT * FROM t1 LIMIT 10;
SELECT SUM(brut) from t1;
--echo #
--echo # Testing file mapping
--echo #
ALTER TABLE t1 MAPPED=yes;
SELECT * FROM t1 LIMIT 10;
SELECT SUM(brut) FROM t1;
--echo #
--echo # Make the indexes
--echo #
OPTIMIZE TABLE t1;
SELECT * FROM t1 WHERE matricule = '0091';
SELECT * FROM t1 WHERE nom = 'FOCH';
SELECT * FROM t1 WHERE nom = 'FOCH' and prenom = 'DENIS';
--echo #
--echo # Testing UPDATE
--echo #
UPDATE t1 SET aanais = aanais + 16;
UPDATE t1 SET ddentree = adddate(ddentree, interval 16 year);
UPDATE t1 SET ddnom = adddate(ddnom, interval 16 year);
SELECT * FROM t1 WHERE nom = 'FOCH';
--echo #
--echo # Testing JOIN
--echo #
create table t2
(
sexe INT(1) KEY,
genre CHAR(8) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='sexe.csv' SEP_CHAR=';' MAPPED=yes ENDING=2;
SELECT * FROM t2;
OPTIMIZE TABLE t2;
SELECT nom, prenom, genre FROM t1 NATURAL JOIN t2 LIMIT 10;
--echo #
--echo # Another table
--echo #
CREATE TABLE t3 (
sitmat CHAR(1) KEY,
situation CHAR(12) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='sitmat.csv' SEP_CHAR=';' MAPPED=yes ENDING=2;
SELECT * FROM t3;
OPTIMIZE TABLE t3;
SELECT nom, prenom, genre, situation FROM t1 NATURAL JOIN t2 NATURAL JOIN t3 WHERE nom = 'FOCH';
--echo #
--echo # Testing DELETE
--echo #
DELETE FROM t1;
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
#
# Clean up
#
--remove_file $MYSQLD_DATADIR/test/emp.txt
--remove_file $MYSQLD_DATADIR/test/sexe.csv
--remove_file $MYSQLD_DATADIR/test/sitmat.csv
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