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