Commit c4cf40c2 authored by Olivier Bertrand's avatar Olivier Bertrand

- Fix bug: Server crash when using a special column in XCOL tables

modified:
  storage/connect/mysql-test/connect/r/xcol.result
  storage/connect/mysql-test/connect/t/xcol.test
  storage/connect/tabxcl.cpp
parent 4f59b65f
# #
# Checking XCOL tables # Make the children list table
# #
CREATE TABLE chlist ( CREATE TABLE chlist (
mother char(12) NOT NULL COMMENT 'The mother of the listed children', mother char(12) NOT NULL COMMENT 'The mother of the listed children',
...@@ -20,7 +20,10 @@ Lisbeth Lucy,Charles,Diana ...@@ -20,7 +20,10 @@ 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'; #
# Checking XCOL tables
#
CREATE TABLE child ENGINE=CONNECT TABLE_TYPE=XCOL TABNAME=chlist OPTION_LIST='colname=children';
SELECT * FROM child; SELECT * FROM child;
mother children mother children
Sophia Vivian Sophia Vivian
...@@ -81,5 +84,34 @@ Corinne 0 ...@@ -81,5 +84,34 @@ Corinne 0
Janet 4 Janet 4
Lisbeth 3 Lisbeth 3
Sophia 2 Sophia 2
#
# Test using special columns
#
CREATE TABLE `child2` (
`row` int NOT NULL SPECIAL=ROWID,
`num` int NOT NULL SPECIAL=ROWNUM,
`mother` varchar(12) NOT NULL COMMENT 'The mother of the children',
`child` varchar(12) NOT NULL COMMENT 'The child name' FLAG=2
) ENGINE=CONNECT TABLE_TYPE=XCOL TABNAME=chlist `OPTION_LIST`='colname=child';
SELECT * FROM child2;
row num mother child
1 1 Sophia Vivian
2 2 Sophia Antony
3 1 Lisbeth Lucy
4 2 Lisbeth Charles
5 3 Lisbeth Diana
7 1 Claude Marc
8 1 Janet Arthur
9 2 Janet Sandra
10 3 Janet Peter
11 4 Janet John
# List only first child
SELECT mother, child FROM child2 where num = 1;
mother child
Sophia Vivian
Lisbeth Lucy
Claude Marc
Janet Arthur
DROP TABLE child; DROP TABLE child;
DROP TABLE chlist; DROP TABLE chlist;
DROP TABLE child2;
let $MYSQLD_DATADIR= `select @@datadir`;
let $PORT= `select @@port`;
--echo # --echo #
--echo # Checking XCOL tables --echo # Make the children list table
--echo # --echo #
CREATE TABLE chlist ( CREATE TABLE chlist (
mother char(12) NOT NULL COMMENT 'The mother of the listed children', mother char(12) NOT NULL COMMENT 'The mother of the listed children',
...@@ -15,8 +12,10 @@ INSERT INTO chlist VALUES('Claude','Marc'); ...@@ -15,8 +12,10 @@ INSERT INTO chlist VALUES('Claude','Marc');
INSERT INTO chlist VALUES('Janet','Arthur,Sandra,Peter,John'); INSERT INTO chlist VALUES('Janet','Arthur,Sandra,Peter,John');
SELECT * FROM chlist; SELECT * FROM chlist;
--replace_result $PORT PORT --echo #
--eval CREATE TABLE child ENGINE=CONNECT TABLE_TYPE=XCOL TABNAME=chlist OPTION_LIST='colname=children,port=$PORT' --echo # Checking XCOL tables
--echo #
CREATE TABLE child ENGINE=CONNECT TABLE_TYPE=XCOL TABNAME=chlist OPTION_LIST='colname=children';
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;
...@@ -24,5 +23,19 @@ SELECT mother FROM child; ...@@ -24,5 +23,19 @@ SELECT mother FROM child;
SELECT mother, COUNT(*) FROM child GROUP BY mother; SELECT mother, COUNT(*) FROM child GROUP BY mother;
SELECT mother, COUNT(children) FROM child GROUP BY mother; SELECT mother, COUNT(children) FROM child GROUP BY mother;
--echo #
--echo # Test using special columns
--echo #
CREATE TABLE `child2` (
`row` int NOT NULL SPECIAL=ROWID,
`num` int NOT NULL SPECIAL=ROWNUM,
`mother` varchar(12) NOT NULL COMMENT 'The mother of the children',
`child` varchar(12) NOT NULL COMMENT 'The child name' FLAG=2
) ENGINE=CONNECT TABLE_TYPE=XCOL TABNAME=chlist `OPTION_LIST`='colname=child';
SELECT * FROM child2;
--echo # List only first child
SELECT mother, child FROM child2 where num = 1;
DROP TABLE child; DROP TABLE child;
DROP TABLE chlist; DROP TABLE chlist;
DROP TABLE child2;
...@@ -182,6 +182,7 @@ bool TDBXCL::OpenDB(PGLOBAL g) ...@@ -182,6 +182,7 @@ bool TDBXCL::OpenDB(PGLOBAL g)
/* Check and initialize the subtable columns. */ /* Check and initialize the subtable columns. */
/*********************************************************************/ /*********************************************************************/
for (PCOL cp = Columns; cp; cp = cp->GetNext()) for (PCOL cp = Columns; cp; cp = cp->GetNext())
if (!cp->IsSpecial())
if (((PPRXCOL)cp)->Init(g)) if (((PPRXCOL)cp)->Init(g))
return TRUE; return TRUE;
......
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