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