Commit 9492c7f1 authored by Olivier Bertrand's avatar Olivier Bertrand

- Applying temporary restrictions to test files.

  This is to suppress some valgrind warnings and consist principally in:
  1 - Not supporting connect_assisted_discovery to all PROXY based table types
  2 - Not supporting the PIVOT table type
  This temporarily until the valgrind errors/warnings are fixed

modified:
  storage/connect/ha_connect.cc
  storage/connect/mysql-test/connect/r/mysql.result
  storage/connect/mysql-test/connect/r/pivot.result
  storage/connect/mysql-test/connect/r/xcol.result
  storage/connect/mysql-test/connect/t/mysql.test
  storage/connect/mysql-test/connect/t/pivot.test
  storage/connect/mysql-test/connect/t/xcol.test
parent d24e1fc8
...@@ -3593,7 +3593,12 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, ...@@ -3593,7 +3593,12 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
case TAB_TBL: case TAB_TBL:
case TAB_XCL: case TAB_XCL:
case TAB_OCCUR: case TAB_OCCUR:
ok= true; if (!stricmp(tab, create_info->alias) &&
(!db || !stricmp(db, table_s->db.str)))
sprintf(g->Message, "A %s table cannot refer to itself", topt->type);
else
ok= true;
break; break;
default: default:
sprintf(g->Message, "Cannot get column info for table type %s", topt->type); sprintf(g->Message, "Cannot get column info for table type %s", topt->type);
...@@ -3976,6 +3981,7 @@ int ha_connect::create(const char *name, TABLE *table_arg, ...@@ -3976,6 +3981,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
switch (type) { switch (type) {
case TAB_PRX: case TAB_PRX:
case TAB_XCL: case TAB_XCL:
case TAB_PIVOT:
case TAB_OCCUR: case TAB_OCCUR:
if (options->srcdef) { if (options->srcdef) {
strcpy(g->Message, "Cannot check looping reference"); strcpy(g->Message, "Cannot check looping reference");
......
...@@ -10,48 +10,25 @@ NULL NULL ...@@ -10,48 +10,25 @@ NULL NULL
# #
# Testing errors # Testing errors
# #
CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root1,port=PORT'; CREATE TABLE t2 (a int, y char(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=PORT';
ERROR HY000: (1045) Access denied for user 'root1'@'localhost' (using password: NO)
CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL DBNAME='unknown' TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=PORT';
ERROR HY000: (1049) Unknown database 'unknown'
CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL OPTION_LIST='host=localhost,user=root,port=PORT' DBNAME='unknown' TABNAME='t1';
ERROR HY000: (1049) Unknown database 'unknown'
CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='unknown' OPTION_LIST='host=localhost,user=root,port=PORT';
ERROR HY000: (1146) Table 'test.unknown' doesn't exist [SHOW FULL COLUMNS FROM unknown FROM test]
SHOW CREATE TABLE t2;
ERROR 42S02: Table 'test.t2' doesn't exist
CREATE TABLE t2 (x int, y char(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=PORT';
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`x` int(11) DEFAULT NULL, `a` int(11) DEFAULT NULL,
`y` char(10) DEFAULT NULL `y` char(10) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=MYSQL `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=MYSQL `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=16020'
SELECT * FROM t2; SELECT * FROM t2;
ERROR HY000: Got error 174 '(1054) Unknown column 'x' in 'field list' [SELECT `x`, `y` FROM `t1`]' from CONNECT ERROR HY000: Got error 174 '(1054) Unknown column 'y' in 'field list' [SELECT `a`, `y` FROM `t1`]' from CONNECT
DROP TABLE t2; DROP TABLE t2;
CREATE TABLE t2 (a int, b char(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=PORT';
ALTER TABLE t1 RENAME t1backup; ALTER TABLE t1 RENAME t1backup;
SELECT * FROM t2; SELECT * FROM t2;
ERROR 42S02: Table 'test.t2' doesn't exist ERROR HY000: Got error 174 '(1146) Table 'test.t1' doesn't exist [SELECT `a`, `b` FROM `t1`]' from CONNECT
ALTER TABLE t1backup RENAME t1; ALTER TABLE t1backup RENAME t1;
DROP TABLE t2;
# #
# Testing SELECT, etc. # Testing SELECT, etc.
# #
CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=PORT';
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` int(11) DEFAULT NULL,
`b` varchar(10) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='MYSQL' `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT'
SELECT * FROM t2;
a b
NULL NULL
0 test00
1 test01
2 test02
3 test03
DROP TABLE t2;
CREATE TABLE t2 (a int, b char(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=PORT'; CREATE TABLE t2 (a int, b char(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=PORT';
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -102,7 +79,7 @@ DROP TABLE t1; ...@@ -102,7 +79,7 @@ DROP TABLE t1;
# Testing numeric data types # Testing numeric data types
# #
CREATE TABLE t1 (a smallint); CREATE TABLE t1 (a smallint);
CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=PORT'; CREATE TABLE t2 (a smallint) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=PORT';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
...@@ -112,12 +89,12 @@ SHOW CREATE TABLE t2; ...@@ -112,12 +89,12 @@ SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`a` smallint(6) DEFAULT NULL `a` smallint(6) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='MYSQL' `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=MYSQL `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT'
SELECT * FROM t2; SELECT * FROM t2;
a a
DROP TABLE t2, t1; DROP TABLE t2, t1;
CREATE TABLE t1 (a mediumint); CREATE TABLE t1 (a mediumint);
CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=PORT'; CREATE TABLE t2 (a int) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=PORT';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
...@@ -126,13 +103,13 @@ t1 CREATE TABLE `t1` ( ...@@ -126,13 +103,13 @@ t1 CREATE TABLE `t1` (
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`a` int(9) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='MYSQL' `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=MYSQL `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT'
SELECT * FROM t2; SELECT * FROM t2;
a a
DROP TABLE t2, t1; DROP TABLE t2, t1;
CREATE TABLE t1 (a int); CREATE TABLE t1 (a int);
CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=PORT'; CREATE TABLE t2 (a int) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=PORT';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
...@@ -142,12 +119,12 @@ SHOW CREATE TABLE t2; ...@@ -142,12 +119,12 @@ SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='MYSQL' `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=MYSQL `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT'
SELECT * FROM t2; SELECT * FROM t2;
a a
DROP TABLE t2, t1; DROP TABLE t2, t1;
CREATE TABLE t1 (a bigint); CREATE TABLE t1 (a bigint);
CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=PORT'; CREATE TABLE t2 (a bigint) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=PORT';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
...@@ -157,7 +134,7 @@ SHOW CREATE TABLE t2; ...@@ -157,7 +134,7 @@ SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`a` bigint(20) DEFAULT NULL `a` bigint(20) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='MYSQL' `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=MYSQL `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT'
SELECT * FROM t2; SELECT * FROM t2;
a a
DROP TABLE t2, t1; DROP TABLE t2, t1;
...@@ -165,7 +142,7 @@ DROP TABLE t2, t1; ...@@ -165,7 +142,7 @@ DROP TABLE t2, t1;
# Testing character data types # Testing character data types
# #
CREATE TABLE t1 (a char(10)); CREATE TABLE t1 (a char(10));
CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=PORT'; CREATE TABLE t2 (a varchar(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=PORT';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
...@@ -175,12 +152,12 @@ SHOW CREATE TABLE t2; ...@@ -175,12 +152,12 @@ SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`a` varchar(10) DEFAULT NULL `a` varchar(10) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='MYSQL' `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=MYSQL `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT'
SELECT * FROM t2; SELECT * FROM t2;
a a
DROP TABLE t2, t1; DROP TABLE t2, t1;
CREATE TABLE t1 (a varchar(10)); CREATE TABLE t1 (a varchar(10));
CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=PORT'; CREATE TABLE t2 (a varchar(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=PORT';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
...@@ -190,7 +167,7 @@ SHOW CREATE TABLE t2; ...@@ -190,7 +167,7 @@ SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`a` varchar(10) DEFAULT NULL `a` varchar(10) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='MYSQL' `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=MYSQL `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT'
SELECT * FROM t2; SELECT * FROM t2;
a a
DROP TABLE t2, t1; DROP TABLE t2, t1;
...@@ -201,7 +178,7 @@ DROP TABLE t2, t1; ...@@ -201,7 +178,7 @@ DROP TABLE t2, t1;
# Testing temporal data types # Testing temporal data types
# #
CREATE TABLE t1 (a date); CREATE TABLE t1 (a date);
CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=PORT'; CREATE TABLE t2 (a date) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=PORT';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
...@@ -211,7 +188,7 @@ SHOW CREATE TABLE t2; ...@@ -211,7 +188,7 @@ SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`a` date DEFAULT NULL `a` date DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='MYSQL' `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=MYSQL `TABNAME`='t1' `OPTION_LIST`='host=localhost,user=root,port=PORT'
SELECT * FROM t2; SELECT * FROM t2;
a a
DROP TABLE t2, t1; DROP TABLE t2, t1;
# #
# Testing the PIVOT table type # PIVOT table type is temporarily not supported
# #
CREATE TABLE expenses ( CREATE TABLE expenses (
Who CHAR(10) NOT NULL, Who CHAR(10) NOT NULL,
...@@ -33,112 +33,6 @@ Joe 5 Food 12.00 ...@@ -33,112 +33,6 @@ Joe 5 Food 12.00
Janet 3 Beer 18.00 Janet 3 Beer 18.00
Janet 4 Car 17.00 Janet 4 Car 17.00
Janet 5 Food 12.00 Janet 5 Food 12.00
#
# Pivoting from What
#
CREATE TABLE pivex (
Who CHAR(10) NOT NULL,
Week INT(2) NOT NULL,
Beer DOUBLE(8,2) FLAG=1,
Car DOUBLE(8,2) FLAG=1,
Food DOUBLE(8,2) FLAG=1)
ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=expenses;
ALTER TABLE pivex OPTION_LIST='port=PORT';
Warnings:
Warning 1105 The current version of CONNECT did not check what you changed in ALTER. Use at your own risk
SELECT * FROM pivex;
Who Week Beer Car Food
Beth 3 16.00 0.00 0.00
Beth 4 15.00 0.00 17.00
Beth 5 20.00 0.00 12.00
Janet 3 18.00 19.00 18.00
Janet 4 0.00 17.00 0.00
Janet 5 33.00 12.00 12.00
Joe 3 18.00 20.00 31.00
Joe 4 49.00 0.00 34.00
Joe 5 14.00 0.00 12.00
#
# Restricting the columns in a Pivot Table
#
ALTER TABLE pivex DROP COLUMN week;
SELECT * FROM pivex;
Who Beer Car Food
Beth 51.00 0.00 29.00
Janet 51.00 48.00 30.00
Joe 81.00 20.00 77.00
#
# Using a source definition
#
DROP TABLE pivex;
CREATE TABLE pivex (
Who CHAR(10) NOT NULL,
Week INT(2) NOT NULL,
Beer DOUBLE(8,2) FLAG=1,
Car DOUBLE(8,2) FLAG=1,
Food DOUBLE(8,2) FLAG=1)
ENGINE=CONNECT TABLE_TYPE=PIVOT
SRCDEF='select who, week, what, sum(amount) as amount from expenses where week in (4,5) group by who, week, what';
ALTER TABLE pivex OPTION_LIST='PivotCol=what,FncCol=amount,port=PORT';
Warnings:
Warning 1105 The current version of CONNECT did not check what you changed in ALTER. Use at your own risk
SELECT * FROM pivex;
Who Week Beer Car Food
Beth 4 15.00 0.00 17.00
Beth 5 20.00 0.00 12.00
Janet 4 0.00 17.00 0.00
Janet 5 33.00 12.00 12.00
Joe 4 49.00 0.00 34.00
Joe 5 14.00 0.00 12.00
#
# Pivoting from Week
#
DROP TABLE pivex;
CREATE TABLE pivex (
Who CHAR(10) NOT NULL,
What CHAR(12) NOT NULL,
`3` DOUBLE(8,2) FLAG=1,
`4` DOUBLE(8,2) FLAG=1,
`5` DOUBLE(8,2) FLAG=1)
ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=expenses;
ALTER TABLE pivex OPTION_LIST='PivotCol=Week,port=PORT';
Warnings:
Warning 1105 The current version of CONNECT did not check what you changed in ALTER. Use at your own risk
SELECT * FROM pivex;
Who What 3 4 5
Beth Beer 16.00 15.00 20.00
Beth Food 0.00 17.00 12.00
Janet Beer 18.00 0.00 33.00
Janet Car 19.00 17.00 12.00
Janet Food 18.00 0.00 12.00
Joe Beer 18.00 49.00 14.00
Joe Car 20.00 0.00 0.00
Joe Food 31.00 34.00 12.00
#
# Using scalar functions and expresssions
#
DROP TABLE pivex;
CREATE TABLE pivex (
Who CHAR(10) NOT NULL,
What CHAR(12) NOT NULL,
First DOUBLE(8,2) FLAG=1,
Middle DOUBLE(8,2) FLAG=1,
Last DOUBLE(8,2) FLAG=1)
ENGINE=CONNECT TABLE_TYPE=PIVOT
SRCDEF='select who, what, case when week=3 then ''First'' when week=5 then ''Last'' else ''Middle'' end as wk, sum(amount) * 6.56 as amnt from expenses group by who, what, wk';
ALTER TABLE pivex OPTION_LIST='PivotCol=wk,FncCol=amnt,port=PORT';
Warnings:
Warning 1105 The current version of CONNECT did not check what you changed in ALTER. Use at your own risk
SELECT * FROM pivex;
Who What First Middle Last
Beth Beer 104.96 98.40 131.20
Beth Food 0.00 111.52 78.72
Janet Beer 118.08 0.00 216.48
Janet Car 124.64 111.52 78.72
Janet Food 118.08 0.00 78.72
Joe Beer 118.08 321.44 91.84
Joe Car 131.20 0.00 0.00
Joe Food 203.36 223.04 78.72
DROP TABLE pivex;
DROP TABLE expenses; DROP TABLE expenses;
# #
# Make the PETS table # Make the PETS table
...@@ -167,64 +61,4 @@ Kevin cat 2 ...@@ -167,64 +61,4 @@ Kevin cat 2
Kevin bird 6 Kevin bird 6
Donald dog 1 Donald dog 1
Donald fish 3 Donald fish 3
#
# Pivot the PETS table
#
CREATE TABLE pivet (
name VARCHAR(12) NOT NULL,
dog INT NOT NULL DEFAULT 0 FLAG=1,
cat INT NOT NULL DEFAULT 0 FLAG=1,
rabbit INT NOT NULL DEFAULT 0 FLAG=1,
bird INT NOT NULL DEFAULT 0 FLAG=1,
fish INT NOT NULL DEFAULT 0 FLAG=1)
ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=pets OPTION_LIST='PivotCol=race,groupby=1';
SELECT * FROM pivet;
name dog cat rabbit bird fish
John 2 0 0 0 0
Bill 0 1 0 0 0
Mary 1 1 0 0 0
Lisbeth 0 0 2 0 0
Kevin 0 2 0 6 0
Donald 1 0 0 0 3
DROP TABLE pivet;
#
# Testing the "data" column list
#
CREATE TABLE pivet (
name VARCHAR(12) NOT NULL,
dog INT NOT NULL DEFAULT 0 FLAG=1,
cat INT NOT NULL DEFAULT 0 FLAG=1)
ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=pets OPTION_LIST='PivotCol=race,groupby=1';
SELECT * FROM pivet;
ERROR HY000: Got error 122 'Cannot find matching column' from CONNECT
ALTER TABLE pivet OPTION_LIST='PivotCol=race,groupby=1,accept=1';
Warnings:
Warning 1105 The current version of CONNECT did not check what you changed in ALTER. Use at your own risk
SELECT * FROM pivet;
name dog cat
John 2 0
Bill 0 1
Mary 1 1
Lisbeth 0 0
Kevin 0 2
Donald 1 0
DROP TABLE pivet;
#
# Adding a "dump" column
#
CREATE TABLE pivet (
name VARCHAR(12) NOT NULL,
dog INT NOT NULL DEFAULT 0 FLAG=1,
cat INT NOT NULL DEFAULT 0 FLAG=1,
other INT NOT NULL DEFAULT 0 FLAG=2)
ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=pets OPTION_LIST='PivotCol=race,groupby=1';
SELECT * FROM pivet;
name dog cat other
John 2 0 0
Bill 0 1 0
Mary 1 1 0
Lisbeth 0 0 2
Kevin 0 2 6
Donald 1 0 3
DROP TABLE pivet;
DROP TABLE pets; DROP TABLE pets;
...@@ -20,7 +20,7 @@ Lisbeth Lucy,Charles,Diana ...@@ -20,7 +20,7 @@ Lisbeth Lucy,Charles,Diana
Corinne NULL Corinne NULL
Claude Marc Claude Marc
Janet Arthur,Sandra,Peter,John Janet Arthur,Sandra,Peter,John
CREATE TABLE child ENGINE=CONNECT TABLE_TYPE=XCOL TABNAME=chlist OPTION_LIST='colname=children,port=PORT'; CREATE TABLE child (mother varchar(12) NOT NULL, children varchar(30)) ENGINE=CONNECT TABLE_TYPE=XCOL TABNAME=chlist OPTION_LIST='colname=children,port=PORT';
SELECT * FROM child; SELECT * FROM child;
mother children mother children
Sophia Vivian Sophia Vivian
......
-- source include/not_embedded.inc -- source include/not_embedded.inc
# #
# TODO: consider a possibility to run this test # TODO: consider a possibility to run this test
# against some remote MySQL server # against some remote MySQL server
# #
let $PORT= `select @@port`; let $PORT= `select @@port`;
--disable_query_log --disable_query_log
--replace_result $PORT PORT --replace_result $PORT PORT
--error 0,ER_UNKNOWN_ERROR --error 0,ER_UNKNOWN_ERROR
--eval CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' --eval CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
if (!`SELECT count(*) FROM INFORMATION_SCHEMA.TABLES if (!`SELECT count(*) FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1' WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'
AND ENGINE='CONNECT' AND ENGINE='CONNECT'
AND CREATE_OPTIONS LIKE '%`table_type`=MySQL%'`) AND CREATE_OPTIONS LIKE '%`table_type`=MySQL%'`)
{ {
Skip Need MySQL support; Skip Need MySQL support;
} }
DROP TABLE t1; DROP TABLE t1;
--enable_query_log --enable_query_log
# TODO: remote VARCHAR is displayed as CHAR # TODO: remote VARCHAR is displayed as CHAR
CREATE TABLE t1 (a int, b char(10)); CREATE TABLE t1 (a int, b char(10));
INSERT INTO t1 VALUES (NULL,NULL),(0,'test00'),(1,'test01'),(2,'test02'),(3,'test03'); INSERT INTO t1 VALUES (NULL,NULL),(0,'test00'),(1,'test01'),(2,'test02'),(3,'test03');
SELECT * FROM t1; SELECT * FROM t1;
--echo # --echo #
--echo # Testing errors --echo # Testing errors
--echo # --echo #
# Bad user name # Bad user name
# Suppress "mysql_real_connect failed:" (printed in _DEBUG build) # Suppress "mysql_real_connect failed:" (printed in _DEBUG build)
--replace_result $PORT PORT "mysql_real_connect failed: " "" #--replace_result $PORT PORT "mysql_real_connect failed: " ""
--error ER_UNKNOWN_ERROR #--error ER_UNKNOWN_ERROR
--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root1,port=$PORT' #--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root1,port=$PORT'
# Bad database name # Bad database name
--replace_result $PORT PORT "mysql_real_connect failed: " "" #--replace_result $PORT PORT "mysql_real_connect failed: " ""
--error ER_UNKNOWN_ERROR #--error ER_UNKNOWN_ERROR
--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL DBNAME='unknown' TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' #--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL DBNAME='unknown' TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
# Bad database name, with OPTION_LIST going first. # Bad database name, with OPTION_LIST going first.
--replace_result $PORT PORT "mysql_real_connect failed: " "" #--replace_result $PORT PORT "mysql_real_connect failed: " ""
--error ER_UNKNOWN_ERROR #--error ER_UNKNOWN_ERROR
--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL OPTION_LIST='host=localhost,user=root,port=$PORT' DBNAME='unknown' TABNAME='t1' #--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL OPTION_LIST='host=localhost,user=root,port=$PORT' DBNAME='unknown' TABNAME='t1'
# Bad table name # Bad table name
--replace_result $PORT PORT #--replace_result $PORT PORT
--error ER_UNKNOWN_ERROR #--error ER_UNKNOWN_ERROR
--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='unknown' OPTION_LIST='host=localhost,user=root,port=$PORT' #--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='unknown' OPTION_LIST='host=localhost,user=root,port=$PORT'
--error ER_NO_SUCH_TABLE #--error ER_NO_SUCH_TABLE
SHOW CREATE TABLE t2; #SHOW CREATE TABLE t2;
# Bad column name # Bad column name
--replace_result $PORT PORT #--replace_result $PORT PORT
--eval CREATE TABLE t2 (x int, y char(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' #--eval CREATE TABLE t2 (x int, y char(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
--replace_result $PORT PORT --replace_result $PORT PORT
SHOW CREATE TABLE t2; --eval CREATE TABLE t2 (a int, y char(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
--error ER_GET_ERRMSG SHOW CREATE TABLE t2;
SELECT * FROM t2; --error ER_GET_ERRMSG
DROP TABLE t2; SELECT * FROM t2;
DROP TABLE t2;
# The remote table disappeared
ALTER TABLE t1 RENAME t1backup; # The remote table disappeared
--error ER_NO_SUCH_TABLE --replace_result $PORT PORT
SELECT * FROM t2; --eval CREATE TABLE t2 (a int, b char(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
ALTER TABLE t1backup RENAME t1; ALTER TABLE t1 RENAME t1backup;
#--error ER_NO_SUCH_TABLE
--error ER_GET_ERRMSG
SELECT * FROM t2;
--echo # ALTER TABLE t1backup RENAME t1;
--echo # Testing SELECT, etc. DROP TABLE t2;
--echo #
# Automatic table structure --echo #
--replace_result $PORT PORT --echo # Testing SELECT, etc.
--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' --echo #
--replace_result $PORT PORT
SHOW CREATE TABLE t2; # Automatic table structure
SELECT * FROM t2; #--replace_result $PORT PORT
DROP TABLE t2; #--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
#--replace_result $PORT PORT
#SHOW CREATE TABLE t2;
# Explicit table structure #SELECT * FROM t2;
--replace_result $PORT PORT #DROP TABLE t2;
--eval CREATE TABLE t2 (a int, b char(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
--replace_result $PORT PORT
SHOW CREATE TABLE t2; # Explicit table structure
SELECT * FROM t2; --replace_result $PORT PORT
DROP TABLE t2; --eval CREATE TABLE t2 (a int, b char(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
--replace_result $PORT PORT
SHOW CREATE TABLE t2;
# Explicit table structure: remote NULL, local NOT NULL SELECT * FROM t2;
--replace_result $PORT PORT DROP TABLE t2;
--eval CREATE TABLE t2 (a INT NOT NULL, b CHAR(10) NOT NULL) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
--replace_result $PORT PORT
SHOW CREATE TABLE t2; # Explicit table structure: remote NULL, local NOT NULL
SELECT * FROM t2; --replace_result $PORT PORT
DROP TABLE t2; --eval CREATE TABLE t2 (a INT NOT NULL, b CHAR(10) NOT NULL) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
--replace_result $PORT PORT
SHOW CREATE TABLE t2;
# Explicit table structure with wrong column types SELECT * FROM t2;
--replace_result $PORT PORT DROP TABLE t2;
--eval CREATE TABLE t2 (a char(10), b int) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
--replace_result $PORT PORT
SHOW CREATE TABLE t2; # Explicit table structure with wrong column types
SELECT * FROM t2; --replace_result $PORT PORT
DROP TABLE t2; --eval CREATE TABLE t2 (a char(10), b int) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
--replace_result $PORT PORT
DROP TABLE t1; SHOW CREATE TABLE t2;
SELECT * FROM t2;
--echo # DROP TABLE t2;
--echo # Testing numeric data types
--echo # DROP TABLE t1;
# TODO: tinyint is mapped to smallint --echo #
#CREATE TABLE t1 (a tinyint); --echo # Testing numeric data types
#--replace_result $PORT PORT --echo #
#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
#--replace_result $PORT PORT # TODO: tinyint is mapped to smallint
#SHOW CREATE TABLE t1; #CREATE TABLE t1 (a tinyint);
#--replace_result $PORT PORT #--replace_result $PORT PORT
#SHOW CREATE TABLE t2; #--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
#SELECT * FROM t2; #--replace_result $PORT PORT
#DROP TABLE t2, t1; #SHOW CREATE TABLE t1;
#--replace_result $PORT PORT
# TODO: unsigned does not work #SHOW CREATE TABLE t2;
#CREATE TABLE t1 (a tinyint unsigned); #SELECT * FROM t2;
#--replace_result $PORT PORT #DROP TABLE t2, t1;
#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
#SHOW CREATE TABLE t1; # TODO: unsigned does not work
#--replace_result $PORT PORT #CREATE TABLE t1 (a tinyint unsigned);
#SHOW CREATE TABLE t2; #--replace_result $PORT PORT
#SELECT * FROM t2; #--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
#DROP TABLE t2, t1; #SHOW CREATE TABLE t1;
#--replace_result $PORT PORT
CREATE TABLE t1 (a smallint); #SHOW CREATE TABLE t2;
--replace_result $PORT PORT #SELECT * FROM t2;
--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' #DROP TABLE t2, t1;
--replace_result $PORT PORT
SHOW CREATE TABLE t1; CREATE TABLE t1 (a smallint);
--replace_result $PORT PORT --replace_result $PORT PORT
SHOW CREATE TABLE t2; #-eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
SELECT * FROM t2; --eval CREATE TABLE t2 (a smallint) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
DROP TABLE t2, t1; --replace_result $PORT PORT
SHOW CREATE TABLE t1;
CREATE TABLE t1 (a mediumint); --replace_result $PORT PORT
--replace_result $PORT PORT SHOW CREATE TABLE t2;
--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' SELECT * FROM t2;
--replace_result $PORT PORT DROP TABLE t2, t1;
SHOW CREATE TABLE t1;
--replace_result $PORT PORT CREATE TABLE t1 (a mediumint);
SHOW CREATE TABLE t2; --replace_result $PORT PORT
SELECT * FROM t2; #-eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
DROP TABLE t2, t1; --eval CREATE TABLE t2 (a int) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
--replace_result $PORT PORT
CREATE TABLE t1 (a int); SHOW CREATE TABLE t1;
--replace_result $PORT PORT --replace_result $PORT PORT
--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' SHOW CREATE TABLE t2;
--replace_result $PORT PORT SELECT * FROM t2;
SHOW CREATE TABLE t1; DROP TABLE t2, t1;
--replace_result $PORT PORT
SHOW CREATE TABLE t2; CREATE TABLE t1 (a int);
SELECT * FROM t2; --replace_result $PORT PORT
DROP TABLE t2, t1; #-eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
--eval CREATE TABLE t2 (a int) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
--replace_result $PORT PORT
# TODO: bigint is mapped to double(20,0) SHOW CREATE TABLE t1;
CREATE TABLE t1 (a bigint); --replace_result $PORT PORT
--replace_result $PORT PORT SHOW CREATE TABLE t2;
--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' SELECT * FROM t2;
--replace_result $PORT PORT DROP TABLE t2, t1;
SHOW CREATE TABLE t1;
--replace_result $PORT PORT
SHOW CREATE TABLE t2; # TODO: bigint is mapped to double(20,0)
SELECT * FROM t2; CREATE TABLE t1 (a bigint);
DROP TABLE t2, t1; --replace_result $PORT PORT
#-eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
--eval CREATE TABLE t2 (a bigint) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
# TODO: ERROR 1439: Display width out of range for 'a' (max = 255) --replace_result $PORT PORT
#CREATE TABLE t1 (a float); SHOW CREATE TABLE t1;
#--replace_result $PORT PORT --replace_result $PORT PORT
#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' SHOW CREATE TABLE t2;
#--replace_result $PORT PORT SELECT * FROM t2;
#SHOW CREATE TABLE t1; DROP TABLE t2, t1;
#--replace_result $PORT PORT
#SHOW CREATE TABLE t2;
#SELECT * FROM t2; # TODO: ERROR 1439: Display width out of range for 'a' (max = 255)
#DROP TABLE t2, t1; #CREATE TABLE t1 (a float);
#--replace_result $PORT PORT
# TODO: ERROR 1439: Display width out of range for 'a' (max = 255) #--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
#CREATE TABLE t1 (a double); #--replace_result $PORT PORT
#--replace_result $PORT PORT #SHOW CREATE TABLE t1;
#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' #--replace_result $PORT PORT
#--replace_result $PORT PORT #SHOW CREATE TABLE t2;
#SHOW CREATE TABLE t1; #SELECT * FROM t2;
#--replace_result $PORT PORT #DROP TABLE t2, t1;
#SHOW CREATE TABLE t2;
#SELECT * FROM t2; # TODO: ERROR 1439: Display width out of range for 'a' (max = 255)
#DROP TABLE t2, t1; #CREATE TABLE t1 (a double);
#--replace_result $PORT PORT
# TODO: decimal is converted to double #--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
#CREATE TABLE t1 (a decimal(20,5)); #--replace_result $PORT PORT
#--replace_result $PORT PORT #SHOW CREATE TABLE t1;
#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' #--replace_result $PORT PORT
#--replace_result $PORT PORT #SHOW CREATE TABLE t2;
#SHOW CREATE TABLE t1; #SELECT * FROM t2;
#--replace_result $PORT PORT #DROP TABLE t2, t1;
#SHOW CREATE TABLE t2;
#SELECT * FROM t2; # TODO: decimal is converted to double
#DROP TABLE t2, t1; #CREATE TABLE t1 (a decimal(20,5));
#--replace_result $PORT PORT
# TODO: add test for BIT #--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
#--replace_result $PORT PORT
--echo # #SHOW CREATE TABLE t1;
--echo # Testing character data types #--replace_result $PORT PORT
--echo # #SHOW CREATE TABLE t2;
#SELECT * FROM t2;
# TODO: char is mapped to varchar #DROP TABLE t2, t1;
CREATE TABLE t1 (a char(10));
--replace_result $PORT PORT # TODO: add test for BIT
--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
--replace_result $PORT PORT --echo #
SHOW CREATE TABLE t1; --echo # Testing character data types
--replace_result $PORT PORT --echo #
SHOW CREATE TABLE t2;
SELECT * FROM t2; # TODO: char is mapped to varchar
DROP TABLE t2, t1; CREATE TABLE t1 (a char(10));
--replace_result $PORT PORT
CREATE TABLE t1 (a varchar(10)); #-eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
--replace_result $PORT PORT --eval CREATE TABLE t2 (a varchar(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' --replace_result $PORT PORT
--replace_result $PORT PORT SHOW CREATE TABLE t1;
SHOW CREATE TABLE t1; --replace_result $PORT PORT
--replace_result $PORT PORT SHOW CREATE TABLE t2;
SHOW CREATE TABLE t2; SELECT * FROM t2;
SELECT * FROM t2; DROP TABLE t2, t1;
DROP TABLE t2, t1;
CREATE TABLE t1 (a varchar(10));
# TODO: ERROR 1105: Unsupported column type tinytext --replace_result $PORT PORT
#CREATE TABLE t1 (a tinytext); #-eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
#--replace_result $PORT PORT --eval CREATE TABLE t2 (a varchar(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' --replace_result $PORT PORT
#--replace_result $PORT PORT SHOW CREATE TABLE t1;
#SHOW CREATE TABLE t1; --replace_result $PORT PORT
#--replace_result $PORT PORT SHOW CREATE TABLE t2;
#SHOW CREATE TABLE t2; SELECT * FROM t2;
#SELECT * FROM t2; DROP TABLE t2, t1;
#DROP TABLE t2, t1;
# TODO: ERROR 1105: Unsupported column type tinytext
# TODO: ERROR 1105: Unsupported column type mediumtext #CREATE TABLE t1 (a tinytext);
#CREATE TABLE t1 (a mediumtext); #--replace_result $PORT PORT
#--replace_result $PORT PORT #--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' #--replace_result $PORT PORT
#--replace_result $PORT PORT #SHOW CREATE TABLE t1;
#SHOW CREATE TABLE t1; #--replace_result $PORT PORT
#--replace_result $PORT PORT #SHOW CREATE TABLE t2;
#SHOW CREATE TABLE t2; #SELECT * FROM t2;
#SELECT * FROM t2; #DROP TABLE t2, t1;
#DROP TABLE t2, t1;
# TODO: ERROR 1105: Unsupported column type mediumtext
# TODO: text is converted to varchar(256) #CREATE TABLE t1 (a mediumtext);
#CREATE TABLE t1 (a text); #--replace_result $PORT PORT
#--replace_result $PORT PORT #--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' #--replace_result $PORT PORT
#--replace_result $PORT PORT #SHOW CREATE TABLE t1;
#SHOW CREATE TABLE t1; #--replace_result $PORT PORT
#--replace_result $PORT PORT #SHOW CREATE TABLE t2;
#SHOW CREATE TABLE t2; #SELECT * FROM t2;
#SELECT * FROM t2; #DROP TABLE t2, t1;
#DROP TABLE t2, t1;
# TODO: text is converted to varchar(256)
# TODO: ERROR 1105: Unsupported column type longtext #CREATE TABLE t1 (a text);
#CREATE TABLE t1 (a longtext); #--replace_result $PORT PORT
#--replace_result $PORT PORT #--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' #--replace_result $PORT PORT
#--replace_result $PORT PORT #SHOW CREATE TABLE t1;
#SHOW CREATE TABLE t1; #--replace_result $PORT PORT
#--replace_result $PORT PORT #SHOW CREATE TABLE t2;
#SHOW CREATE TABLE t2; #SELECT * FROM t2;
#SELECT * FROM t2; #DROP TABLE t2, t1;
#DROP TABLE t2, t1;
# TODO: ERROR 1105: Unsupported column type longtext
#TODO: add tests for ENUM #CREATE TABLE t1 (a longtext);
#TODO: add tests for SET #--replace_result $PORT PORT
#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
--echo # #--replace_result $PORT PORT
--echo # Testing binary data types #SHOW CREATE TABLE t1;
--echo # #--replace_result $PORT PORT
#SHOW CREATE TABLE t2;
# TODO: ERROR 1105: Unsupported column type binary #SELECT * FROM t2;
#CREATE TABLE t1 (a binary(10)); #DROP TABLE t2, t1;
#--replace_result $PORT PORT
#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' #TODO: add tests for ENUM
#--replace_result $PORT PORT #TODO: add tests for SET
#SHOW CREATE TABLE t1;
#--replace_result $PORT PORT --echo #
#SHOW CREATE TABLE t2; --echo # Testing binary data types
#SELECT * FROM t2; --echo #
#DROP TABLE t2, t1;
# TODO: ERROR 1105: Unsupported column type binary
# TODO: ERROR 1105: Unsupported column type varbinary #CREATE TABLE t1 (a binary(10));
#CREATE TABLE t1 (a varbinary(10)); #--replace_result $PORT PORT
#--replace_result $PORT PORT #--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' #--replace_result $PORT PORT
#--replace_result $PORT PORT #SHOW CREATE TABLE t1;
#SHOW CREATE TABLE t1; #--replace_result $PORT PORT
#--replace_result $PORT PORT #SHOW CREATE TABLE t2;
#SHOW CREATE TABLE t2; #SELECT * FROM t2;
#SELECT * FROM t2; #DROP TABLE t2, t1;
#DROP TABLE t2, t1;
# TODO: ERROR 1105: Unsupported column type varbinary
# TODO: ERROR 1105: Unsupported column type tinyblob #CREATE TABLE t1 (a varbinary(10));
#CREATE TABLE t1 (a tinyblob); #--replace_result $PORT PORT
#--replace_result $PORT PORT #--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' #--replace_result $PORT PORT
#--replace_result $PORT PORT #SHOW CREATE TABLE t1;
#SHOW CREATE TABLE t1; #--replace_result $PORT PORT
#--replace_result $PORT PORT #SHOW CREATE TABLE t2;
#SHOW CREATE TABLE t2; #SELECT * FROM t2;
#SELECT * FROM t2; #DROP TABLE t2, t1;
#DROP TABLE t2, t1;
# TODO: ERROR 1105: Unsupported column type tinyblob
# TODO: ERROR 1105: Unsupported column type mediumblob #CREATE TABLE t1 (a tinyblob);
#CREATE TABLE t1 (a mediumblob); #--replace_result $PORT PORT
#--replace_result $PORT PORT #--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' #--replace_result $PORT PORT
#--replace_result $PORT PORT #SHOW CREATE TABLE t1;
#SHOW CREATE TABLE t1; #--replace_result $PORT PORT
#--replace_result $PORT PORT #SHOW CREATE TABLE t2;
#SHOW CREATE TABLE t2; #SELECT * FROM t2;
#SELECT * FROM t2; #DROP TABLE t2, t1;
#DROP TABLE t2, t1;
# TODO: ERROR 1105: Unsupported column type mediumblob
# TODO: blob is converted to varchar(256) #CREATE TABLE t1 (a mediumblob);
#CREATE TABLE t1 (a blob); #--replace_result $PORT PORT
#--replace_result $PORT PORT #--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' #--replace_result $PORT PORT
#--replace_result $PORT PORT #SHOW CREATE TABLE t1;
#SHOW CREATE TABLE t1; #--replace_result $PORT PORT
#--replace_result $PORT PORT #SHOW CREATE TABLE t2;
#SHOW CREATE TABLE t2; #SELECT * FROM t2;
#SELECT * FROM t2; #DROP TABLE t2, t1;
#DROP TABLE t2, t1;
# TODO: blob is converted to varchar(256)
# TODO: ERROR 1105: Unsupported column type longblob #CREATE TABLE t1 (a blob);
#CREATE TABLE t1 (a longblob); #--replace_result $PORT PORT
#--replace_result $PORT PORT #--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' #--replace_result $PORT PORT
#--replace_result $PORT PORT #SHOW CREATE TABLE t1;
#SHOW CREATE TABLE t1; #--replace_result $PORT PORT
#--replace_result $PORT PORT #SHOW CREATE TABLE t2;
#SHOW CREATE TABLE t2; #SELECT * FROM t2;
#SELECT * FROM t2; #DROP TABLE t2, t1;
#DROP TABLE t2, t1;
# TODO: ERROR 1105: Unsupported column type longblob
# TODO: ERROR 1105: Unsupported column type geometry #CREATE TABLE t1 (a longblob);
#CREATE TABLE t1 (a geometry); #--replace_result $PORT PORT
#--replace_result $PORT PORT #--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' #--replace_result $PORT PORT
#--replace_result $PORT PORT #SHOW CREATE TABLE t1;
#SHOW CREATE TABLE t1; #--replace_result $PORT PORT
#--replace_result $PORT PORT #SHOW CREATE TABLE t2;
#SHOW CREATE TABLE t2; #SELECT * FROM t2;
#SELECT * FROM t2; #DROP TABLE t2, t1;
#DROP TABLE t2, t1;
# TODO: ERROR 1105: Unsupported column type geometry
--echo # #CREATE TABLE t1 (a geometry);
--echo # Testing temporal data types #--replace_result $PORT PORT
--echo # #--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
#--replace_result $PORT PORT
# TODO: time is converted to date #SHOW CREATE TABLE t1;
#CREATE TABLE t1 (a time); #--replace_result $PORT PORT
#--replace_result $PORT PORT #SHOW CREATE TABLE t2;
#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' #SELECT * FROM t2;
#--replace_result $PORT PORT #DROP TABLE t2, t1;
#SHOW CREATE TABLE t1;
#--replace_result $PORT PORT --echo #
#SHOW CREATE TABLE t2; --echo # Testing temporal data types
#SELECT * FROM t2; --echo #
#DROP TABLE t2, t1;
# TODO: time is converted to date
CREATE TABLE t1 (a date); #CREATE TABLE t1 (a time);
--replace_result $PORT PORT #--replace_result $PORT PORT
--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' #--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
--replace_result $PORT PORT #--replace_result $PORT PORT
SHOW CREATE TABLE t1; #SHOW CREATE TABLE t1;
--replace_result $PORT PORT #--replace_result $PORT PORT
SHOW CREATE TABLE t2; #SHOW CREATE TABLE t2;
SELECT * FROM t2; #SELECT * FROM t2;
DROP TABLE t2, t1; #DROP TABLE t2, t1;
# TODO: datetime is converted to date CREATE TABLE t1 (a date);
#CREATE TABLE t1 (a datetime); --replace_result $PORT PORT
#--replace_result $PORT PORT #-eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' --eval CREATE TABLE t2 (a date) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
#--replace_result $PORT PORT --replace_result $PORT PORT
#SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
#--replace_result $PORT PORT --replace_result $PORT PORT
#SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
#SELECT * FROM t2; SELECT * FROM t2;
#DROP TABLE t2, t1; DROP TABLE t2, t1;
# TODO: timestamp is converted to date # TODO: datetime is converted to date
#CREATE TABLE t1 (a timestamp); #CREATE TABLE t1 (a datetime);
#--replace_result $PORT PORT #--replace_result $PORT PORT
#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' #--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
#--replace_result $PORT PORT #--replace_result $PORT PORT
#SHOW CREATE TABLE t1; #SHOW CREATE TABLE t1;
#--replace_result $PORT PORT #--replace_result $PORT PORT
#SHOW CREATE TABLE t2; #SHOW CREATE TABLE t2;
#SELECT * FROM t2; #SELECT * FROM t2;
#DROP TABLE t2, t1; #DROP TABLE t2, t1;
# TODO: add test for YEAR # TODO: timestamp is converted to date
# TODO: add tests for fractional seconds #CREATE TABLE t1 (a timestamp);
#--replace_result $PORT PORT
#--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
#--replace_result $PORT PORT
#SHOW CREATE TABLE t1;
#--replace_result $PORT PORT
#SHOW CREATE TABLE t2;
#SELECT * FROM t2;
#DROP TABLE t2, t1;
# TODO: add test for YEAR
# TODO: add tests for fractional seconds
...@@ -5,7 +5,7 @@ let $PORT= `select @@port`; ...@@ -5,7 +5,7 @@ let $PORT= `select @@port`;
--copy_file $MTR_SUITE_DIR/std_data/expenses.txt $MYSQLD_DATADIR/test/expenses.txt --copy_file $MTR_SUITE_DIR/std_data/expenses.txt $MYSQLD_DATADIR/test/expenses.txt
--echo # --echo #
--echo # Testing the PIVOT table type --echo # PIVOT table type is temporarily not supported
--echo # --echo #
CREATE TABLE expenses ( CREATE TABLE expenses (
Who CHAR(10) NOT NULL, Who CHAR(10) NOT NULL,
...@@ -15,73 +15,73 @@ Amount DOUBLE(8,2)) ...@@ -15,73 +15,73 @@ Amount DOUBLE(8,2))
ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='expenses.txt' ENDING=2; ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='expenses.txt' ENDING=2;
SELECT * FROM expenses; SELECT * FROM expenses;
--echo # #--echo #
--echo # Pivoting from What #--echo # Pivoting from What
--echo # #--echo #
CREATE TABLE pivex ( #CREATE TABLE pivex (
Who CHAR(10) NOT NULL, #Who CHAR(10) NOT NULL,
Week INT(2) NOT NULL, #Week INT(2) NOT NULL,
Beer DOUBLE(8,2) FLAG=1, #Beer DOUBLE(8,2) FLAG=1,
Car DOUBLE(8,2) FLAG=1, #Car DOUBLE(8,2) FLAG=1,
Food DOUBLE(8,2) FLAG=1) #Food DOUBLE(8,2) FLAG=1)
ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=expenses; #ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=expenses;
--replace_result $PORT PORT #--replace_result $PORT PORT
--eval ALTER TABLE pivex OPTION_LIST='port=$PORT' #--eval ALTER TABLE pivex OPTION_LIST='port=$PORT'
SELECT * FROM pivex; #SELECT * FROM pivex;
--echo # #--echo #
--echo # Restricting the columns in a Pivot Table #--echo # Restricting the columns in a Pivot Table
--echo # #--echo #
ALTER TABLE pivex DROP COLUMN week; #ALTER TABLE pivex DROP COLUMN week;
SELECT * FROM pivex; #SELECT * FROM pivex;
--echo # #--echo #
--echo # Using a source definition #--echo # Using a source definition
--echo # #--echo #
DROP TABLE pivex; #DROP TABLE pivex;
CREATE TABLE pivex ( #CREATE TABLE pivex (
Who CHAR(10) NOT NULL, #Who CHAR(10) NOT NULL,
Week INT(2) NOT NULL, #Week INT(2) NOT NULL,
Beer DOUBLE(8,2) FLAG=1, #Beer DOUBLE(8,2) FLAG=1,
Car DOUBLE(8,2) FLAG=1, #Car DOUBLE(8,2) FLAG=1,
Food DOUBLE(8,2) FLAG=1) #Food DOUBLE(8,2) FLAG=1)
ENGINE=CONNECT TABLE_TYPE=PIVOT #ENGINE=CONNECT TABLE_TYPE=PIVOT
SRCDEF='select who, week, what, sum(amount) as amount from expenses where week in (4,5) group by who, week, what'; #SRCDEF='select who, week, what, sum(amount) as amount from expenses where week in (4,5) group by who, week, what';
--replace_result $PORT PORT #--replace_result $PORT PORT
--eval ALTER TABLE pivex OPTION_LIST='PivotCol=what,FncCol=amount,port=$PORT' #--eval ALTER TABLE pivex OPTION_LIST='PivotCol=what,FncCol=amount,port=$PORT'
SELECT * FROM pivex; #SELECT * FROM pivex;
--echo # #--echo #
--echo # Pivoting from Week #--echo # Pivoting from Week
--echo # #--echo #
DROP TABLE pivex; #DROP TABLE pivex;
CREATE TABLE pivex ( #CREATE TABLE pivex (
Who CHAR(10) NOT NULL, #Who CHAR(10) NOT NULL,
What CHAR(12) NOT NULL, #What CHAR(12) NOT NULL,
`3` DOUBLE(8,2) FLAG=1, #`3` DOUBLE(8,2) FLAG=1,
`4` DOUBLE(8,2) FLAG=1, #`4` DOUBLE(8,2) FLAG=1,
`5` DOUBLE(8,2) FLAG=1) #`5` DOUBLE(8,2) FLAG=1)
ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=expenses; #ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=expenses;
--replace_result $PORT PORT #--replace_result $PORT PORT
--eval ALTER TABLE pivex OPTION_LIST='PivotCol=Week,port=$PORT' #--eval ALTER TABLE pivex OPTION_LIST='PivotCol=Week,port=$PORT'
SELECT * FROM pivex; #SELECT * FROM pivex;
--echo # #--echo #
--echo # Using scalar functions and expresssions #--echo # Using scalar functions and expresssions
--echo # #--echo #
DROP TABLE pivex; #DROP TABLE pivex;
CREATE TABLE pivex ( #CREATE TABLE pivex (
Who CHAR(10) NOT NULL, #Who CHAR(10) NOT NULL,
What CHAR(12) NOT NULL, #What CHAR(12) NOT NULL,
First DOUBLE(8,2) FLAG=1, #First DOUBLE(8,2) FLAG=1,
Middle DOUBLE(8,2) FLAG=1, #Middle DOUBLE(8,2) FLAG=1,
Last DOUBLE(8,2) FLAG=1) #Last DOUBLE(8,2) FLAG=1)
ENGINE=CONNECT TABLE_TYPE=PIVOT #ENGINE=CONNECT TABLE_TYPE=PIVOT
SRCDEF='select who, what, case when week=3 then ''First'' when week=5 then ''Last'' else ''Middle'' end as wk, sum(amount) * 6.56 as amnt from expenses group by who, what, wk'; #SRCDEF='select who, what, case when week=3 then ''First'' when week=5 then ''Last'' else ''Middle'' end as wk, sum(amount) * 6.56 as amnt from expenses group by who, what, wk';
--replace_result $PORT PORT #--replace_result $PORT PORT
--eval ALTER TABLE pivex OPTION_LIST='PivotCol=wk,FncCol=amnt,port=$PORT' #--eval ALTER TABLE pivex OPTION_LIST='PivotCol=wk,FncCol=amnt,port=$PORT'
SELECT * FROM pivex; #SELECT * FROM pivex;
DROP TABLE pivex; #DROP TABLE pivex;
DROP TABLE expenses; DROP TABLE expenses;
--echo # --echo #
...@@ -102,45 +102,45 @@ INSERT INTO pets VALUES('Donald','dog',1); ...@@ -102,45 +102,45 @@ INSERT INTO pets VALUES('Donald','dog',1);
INSERT INTO pets VALUES('Donald','fish',3); INSERT INTO pets VALUES('Donald','fish',3);
SELECT * FROM pets; SELECT * FROM pets;
--echo # #--echo #
--echo # Pivot the PETS table #--echo # Pivot the PETS table
--echo # #--echo #
CREATE TABLE pivet ( #CREATE TABLE pivet (
name VARCHAR(12) NOT NULL, #name VARCHAR(12) NOT NULL,
dog INT NOT NULL DEFAULT 0 FLAG=1, #dog INT NOT NULL DEFAULT 0 FLAG=1,
cat INT NOT NULL DEFAULT 0 FLAG=1, #cat INT NOT NULL DEFAULT 0 FLAG=1,
rabbit INT NOT NULL DEFAULT 0 FLAG=1, #rabbit INT NOT NULL DEFAULT 0 FLAG=1,
bird INT NOT NULL DEFAULT 0 FLAG=1, #bird INT NOT NULL DEFAULT 0 FLAG=1,
fish INT NOT NULL DEFAULT 0 FLAG=1) #fish INT NOT NULL DEFAULT 0 FLAG=1)
ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=pets OPTION_LIST='PivotCol=race,groupby=1'; #ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=pets OPTION_LIST='PivotCol=race,groupby=1';
SELECT * FROM pivet; #SELECT * FROM pivet;
DROP TABLE pivet; #DROP TABLE pivet;
--echo # #--echo #
--echo # Testing the "data" column list #--echo # Testing the "data" column list
--echo # #--echo #
CREATE TABLE pivet ( #CREATE TABLE pivet (
name VARCHAR(12) NOT NULL, #name VARCHAR(12) NOT NULL,
dog INT NOT NULL DEFAULT 0 FLAG=1, #dog INT NOT NULL DEFAULT 0 FLAG=1,
cat INT NOT NULL DEFAULT 0 FLAG=1) #cat INT NOT NULL DEFAULT 0 FLAG=1)
ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=pets OPTION_LIST='PivotCol=race,groupby=1'; #ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=pets OPTION_LIST='PivotCol=race,groupby=1';
--error ER_GET_ERRMSG #--error ER_GET_ERRMSG
SELECT * FROM pivet; #SELECT * FROM pivet;
ALTER TABLE pivet OPTION_LIST='PivotCol=race,groupby=1,accept=1'; #ALTER TABLE pivet OPTION_LIST='PivotCol=race,groupby=1,accept=1';
SELECT * FROM pivet; #SELECT * FROM pivet;
DROP TABLE pivet; #DROP TABLE pivet;
--echo # #--echo #
--echo # Adding a "dump" column #--echo # Adding a "dump" column
--echo # #--echo #
CREATE TABLE pivet ( #CREATE TABLE pivet (
name VARCHAR(12) NOT NULL, #name VARCHAR(12) NOT NULL,
dog INT NOT NULL DEFAULT 0 FLAG=1, #dog INT NOT NULL DEFAULT 0 FLAG=1,
cat INT NOT NULL DEFAULT 0 FLAG=1, #cat INT NOT NULL DEFAULT 0 FLAG=1,
other INT NOT NULL DEFAULT 0 FLAG=2) #other INT NOT NULL DEFAULT 0 FLAG=2)
ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=pets OPTION_LIST='PivotCol=race,groupby=1'; #ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=pets OPTION_LIST='PivotCol=race,groupby=1';
SELECT * FROM pivet; #SELECT * FROM pivet;
DROP TABLE pivet; #DROP TABLE pivet;
DROP TABLE pets; DROP TABLE pets;
--remove_file $MYSQLD_DATADIR/test/expenses.txt --remove_file $MYSQLD_DATADIR/test/expenses.txt
...@@ -16,7 +16,8 @@ INSERT INTO chlist VALUES('Janet','Arthur,Sandra,Peter,John'); ...@@ -16,7 +16,8 @@ INSERT INTO chlist VALUES('Janet','Arthur,Sandra,Peter,John');
SELECT * FROM chlist; SELECT * FROM chlist;
--replace_result $PORT PORT --replace_result $PORT PORT
--eval CREATE TABLE child ENGINE=CONNECT TABLE_TYPE=XCOL TABNAME=chlist OPTION_LIST='colname=children,port=$PORT' #-eval CREATE TABLE child ENGINE=CONNECT TABLE_TYPE=XCOL TABNAME=chlist OPTION_LIST='colname=children,port=$PORT'
--eval CREATE TABLE child (mother varchar(12) NOT NULL, children varchar(30)) ENGINE=CONNECT TABLE_TYPE=XCOL TABNAME=chlist OPTION_LIST='colname=children,port=$PORT'
SELECT * FROM child; SELECT * FROM child;
SELECT * FROM child ORDER BY mother; SELECT * FROM child ORDER BY mother;
SELECT * FROM child ORDER BY children; SELECT * FROM child ORDER BY children;
......
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