Commit fff28085 authored by Olivier Bertrand's avatar Olivier Bertrand

- A specified table type not supported is now flagged as an error

  instead of being replaced by the default type DOS.

modified:
  mysql-test/suite/connect/r/general.result
  mysql-test/suite/connect/t/general.test
  storage/connect/ha_connect.cc
parent 2c9d5aae
......@@ -2,12 +2,17 @@
# Testing features not specific to any TABLE_TYPE
#
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=NON_EXISTING;
ERROR HY000: Unsupported table type NON_EXISTING
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=FIX;
Warnings:
Warning 1105 No table_type. Was set to DOS
Warning 1105 No file name. Table will use t1.DOS
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `table_type`=DOS
Warning 1105 No file name. Table will use t1.FIX
INSERT INTO t1 VALUES (10);
SELECT * FROM t1;
a
10
ALTER TABLE t1 TABLE_TYPE=NON_EXISTING;
ERROR HY000: Unsupported table type NON_EXISTING
SELECT * FROM t1;
a
10
DROP TABLE t1;
--echo #
--echo # Testing features not specific to any TABLE_TYPE
--echo #
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=NON_EXISTING;
SHOW CREATE TABLE t1;
DROP TABLE t1;
#CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='t1.txt';
#INSERT INTO t1 VALUES (10);
#SELECT * FROM t1;
#--error ER_GET_ERRMSG
#ALTER TABLE t1 TABLE_TYPE=NON_EXISTING;
#SELECT * FROM t1;
#DROP TABLE t1;
--echo #
--echo # Testing features not specific to any TABLE_TYPE
--echo #
--error ER_UNKNOWN_ERROR
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=NON_EXISTING;
#SHOW CREATE TABLE t1;
#DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=FIX;
INSERT INTO t1 VALUES (10);
SELECT * FROM t1;
#--error ER_GET_ERRMSG
--error ER_UNKNOWN_ERROR
ALTER TABLE t1 TABLE_TYPE=NON_EXISTING;
SELECT * FROM t1;
DROP TABLE t1;
......@@ -3538,7 +3538,7 @@ bool ha_connect::pre_create(THD *thd, HA_CREATE_INFO *create_info,
db= thd->db; // Default value
// Check table type
if (ttp == TAB_UNDEF || ttp == TAB_NIY) {
if (ttp == TAB_UNDEF) {
strcpy(g->Message, "No table_type. Was set to DOS");
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0, g->Message);
ttp= TAB_DOS;
......@@ -3546,7 +3546,11 @@ bool ha_connect::pre_create(THD *thd, HA_CREATE_INFO *create_info,
name= thd->make_lex_string(NULL, "table_type", 10, true);
val= thd->make_lex_string(NULL, typn, strlen(typn), true);
pov= new(mem) engine_option_value(*name, *val, false, start, &end);
} // endif ttp
} else if (ttp == TAB_NIY) {
sprintf(g->Message, "Unsupported table type %s", typn);
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
return true;
} // endif ttp
if (!tab && !(fnc & (FNC_TABLE | FNC_COL)))
tab= (char*)create_info->alias;
......
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