Commit 0c70184b authored by Olivier Bertrand's avatar Olivier Bertrand

- Adding index.test (with some statements temporarily skipped)

- Updating xml.result

added:
  mysql-test/suite/connect/r/index.result
  mysql-test/suite/connect/std_data/emp.txt
  mysql-test/suite/connect/std_data/sexe.csv
  mysql-test/suite/connect/std_data/sitmat.csv
  mysql-test/suite/connect/t/index.test
modified:
  .bzrignore
  mysql-test/suite/connect/r/xml.result
parent 50beff5c
...@@ -1145,3 +1145,5 @@ sql/db.opt ...@@ -1145,3 +1145,5 @@ sql/db.opt
typescript typescript
storage/perfschema/gen_pfs_lex_token storage/perfschema/gen_pfs_lex_token
storage/perfschema/pfs_lex_token.h storage/perfschema/pfs_lex_token.h
*.bak
*.OLD
#
# Testing indexing
#
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 buf_length=10 date_format='YYMM',
ddnom DATE NOT NULL buf_length=10 date_format='YYMM',
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;
matricule nom prenom sexe aanais mmnais ddentree ddnom brut net service sitmat formation
5745 ESCOURCHE BENEDICTE 2 1935 7 1962-12-01 1994-05-01 18345 14275.50 0 M TECHN
9692 VICENTE LAURENCE 2 1941 8 1967-10-01 1989-01-01 16212 13032.80 0 M ANGL
9146 NICOLAS ROGER 1 1941 6 1964-07-01 1995-02-01 34173 25098.65 0 M SANS
2985 TESSEREAU MARIE HELENE 2 1941 9 1967-01-01 1990-01-01 19323 14933.78 0 V SANS
3368 MOGADOR ALAIN 1 1941 1 1961-09-01 1993-11-01 43303 31420.55 0 C SANS
7394 CHAUSSEE ERIC DENIS 1 1944 9 1965-11-01 1983-12-01 32002 23583.86 0 M ANGL
4655 MAILLOT GEORGES 1 1945 5 1970-09-01 1986-12-01 24700 18541.64 0 C ANGL
2825 CAMILLE NADINE 2 1956 9 1994-01-01 1993-01-01 19494 15050.45 0 M SANS
1460 BRUYERES JEAN MARC 1 1958 8 1984-08-01 1988-05-01 20902 15980.07 0 M SANS
4974 LONES GERARD 1 1959 10 1979-01-01 1994-12-01 16081 12916.70 0 M SANS
SELECT SUM(brut) from t1;
SUM(brut)
64319029
#
# Testing file mapping
#
ALTER TABLE T1 MAPPED=yes;
Warnings:
Warning 1105 The current version of CONNECT did not check what you changed in ALTER. Use on your own risk
SELECT * FROM t1 LIMIT 10;
matricule nom prenom sexe aanais mmnais ddentree ddnom brut net service sitmat formation
5745 ESCOURCHE BENEDICTE 2 1935 7 1962-12-01 1994-05-01 18345 14275.50 0 M TECHN
9692 VICENTE LAURENCE 2 1941 8 1967-10-01 1989-01-01 16212 13032.80 0 M ANGL
9146 NICOLAS ROGER 1 1941 6 1964-07-01 1995-02-01 34173 25098.65 0 M SANS
2985 TESSEREAU MARIE HELENE 2 1941 9 1967-01-01 1990-01-01 19323 14933.78 0 V SANS
3368 MOGADOR ALAIN 1 1941 1 1961-09-01 1993-11-01 43303 31420.55 0 C SANS
7394 CHAUSSEE ERIC DENIS 1 1944 9 1965-11-01 1983-12-01 32002 23583.86 0 M ANGL
4655 MAILLOT GEORGES 1 1945 5 1970-09-01 1986-12-01 24700 18541.64 0 C ANGL
2825 CAMILLE NADINE 2 1956 9 1994-01-01 1993-01-01 19494 15050.45 0 M SANS
1460 BRUYERES JEAN MARC 1 1958 8 1984-08-01 1988-05-01 20902 15980.07 0 M SANS
4974 LONES GERARD 1 1959 10 1979-01-01 1994-12-01 16081 12916.70 0 M SANS
SELECT SUM(brut) FROM t1;
SUM(brut)
64319029
#
# Make the indexes
#
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
SELECT * FROM t1 WHERE matricule = '0091';
matricule nom prenom sexe aanais mmnais ddentree ddnom brut net service sitmat formation
91 THIVERNAL DIDIER JEAN 1 1951 10 1980-05-01 1991-10-01 14715 12024.71 1 M SANS
SELECT * FROM t1 WHERE nom = 'FOCH';
matricule nom prenom sexe aanais mmnais ddentree ddnom brut net service sitmat formation
1977 FOCH BERNADETTE 2 1958 3 1992-02-01 1991-02-01 8656 8145.03 1 . SANS
5707 FOCH DENIS 1 1977 7 1996-07-01 1995-07-01 7803 7679.36 15 C COMPT
2552 FOCH FRANCK 1 1962 12 1986-06-01 1990-11-01 12882 10745.81 13 M SANS
2634 FOCH JOCELYNE 2 1953 3 1996-01-01 1995-01-01 12499 10473.09 41 M INFOR
5765 FOCH ROBERT 1 1957 1 1981-03-01 1993-03-01 16081 12916.32 52 M ALLEM
4080 FOCH SERGE 1 1959 3 1981-03-01 1981-05-01 11131 9658.24 5 M SANS
SELECT * FROM t1 WHERE nom = 'FOCH' and prenom = 'DENIS';
matricule nom prenom sexe aanais mmnais ddentree ddnom brut net service sitmat formation
5707 FOCH DENIS 1 1977 7 1996-07-01 1995-07-01 7803 7679.36 15 C COMPT
#
# Testing UPDATE (This currently fails
#
UPDATE t1 SET ddentree = '1980-07-01' WHERE matricule = '0091';
SELECT * FROM t1 WHERE matricule = '0091';
matricule nom prenom sexe aanais mmnais ddentree ddnom brut net service sitmat formation
91 THIVERNAL DIDIER JEAN 1 1951 10 1980-07-01 1991-10-01 14715 12024.71 1 M SANS
# Skipping next 4 commands (This currently fails in test mode
# skipped: UPDATE t1 SET aanais = aanais + 16;
# skipped: UPDATE t1 SET ddentree = adddate(ddentree, interval 16 year);
# skipped: UPDATE t1 SET ddnom = adddate(ddnom, interval 16 year);
# skipped: SELECT * FROM t1 WHERE nom = 'FOCH';
#
# Testing JOIN
#
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;
sexe genre
0 Inconnu
1 Masculin
2 Feminin
OPTIMIZE TABLE t2;
Table Op Msg_type Msg_text
test.t2 optimize status OK
SELECT nom, prenom, genre FROM t1 NATURAL JOIN t2 LIMIT 10;
nom prenom genre
ESCOURCHE BENEDICTE Feminin
VICENTE LAURENCE Feminin
NICOLAS ROGER Masculin
TESSEREAU MARIE HELENE Feminin
MOGADOR ALAIN Masculin
CHAUSSEE ERIC DENIS Masculin
MAILLOT GEORGES Masculin
CAMILLE NADINE Feminin
BRUYERES JEAN MARC Masculin
LONES GERARD Masculin
#
# Another table
#
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;
sitmat situation
. Inconnu
C Celibataire
D Divorce
L Union libre
M Marie
S Separe
V Veuf
OPTIMIZE TABLE t3;
Table Op Msg_type Msg_text
test.t3 optimize status OK
SELECT nom, prenom, genre, situation FROM t1 NATURAL JOIN t2 NATURAL JOIN t3 WHERE nom = 'FOCH';
nom prenom genre situation
FOCH BERNADETTE Feminin Inconnu
FOCH DENIS Masculin Celibataire
FOCH FRANCK Masculin Marie
FOCH JOCELYNE Feminin Marie
FOCH ROBERT Masculin Marie
FOCH SERGE Masculin Marie
#
# Testing DELETE
#
DELETE FROM t1;
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
...@@ -411,7 +411,7 @@ DROP TABLE t1; ...@@ -411,7 +411,7 @@ DROP TABLE t1;
SET @a=LOAD_FILE('test/t1.xml'); SET @a=LOAD_FILE('test/t1.xml');
SELECT CAST(@a AS CHAR CHARACTER SET latin1); SELECT CAST(@a AS CHAR CHARACTER SET latin1);
CAST(@a AS CHAR CHARACTER SET latin1) <?xml version="1.0" encoding="iso-8859-1"?> CAST(@a AS CHAR CHARACTER SET latin1) <?xml version="1.0" encoding="iso-8859-1"?>
<!-- Created by CONNECT Version 1.01.0002 February 19, 2013 --> <!-- Created by CONNECT Version 1.01.0003 March 02, 2013 -->
<t1> <t1>
<line> <line>
<node>ÀÁÂÃ</node> <node>ÀÁÂÃ</node>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
0;Inconnu
1;Masculin
2;Feminin
.;Inconnu
C;Celibataire
D;Divorce
L;Union libre
M;Marie
S;Separe
V;Veuf
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 buf_length=10 date_format='YYMM',
ddnom DATE NOT NULL buf_length=10 date_format='YYMM',
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 (This currently fails
--echo #
UPDATE t1 SET ddentree = '1980-07-01' WHERE matricule = '0091';
SELECT * FROM t1 WHERE matricule = '0091';
--echo # Skipping next 4 commands (This currently fails in test mode
--echo # skipped: UPDATE t1 SET aanais = aanais + 16;
--echo # skipped: UPDATE t1 SET ddentree = adddate(ddentree, interval 16 year);
--echo # skipped: UPDATE t1 SET ddnom = adddate(ddnom, interval 16 year);
--echo # skipped: 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