Commit 5fc2a7da authored by Olivier Bertrand's avatar Olivier Bertrand

Add a test on table types in ha_connect::create

- The plan was to provide a default type (DOS) when the table type
was unspecified, wring, or not supported.
- However, this is not possible here because create is called after
the FRM file was generated.
- Currently, this is flagged as an error and the create aborts.

Modified:
ha_connect.cc
parent 83b7fb0f
...@@ -3559,13 +3559,31 @@ int ha_connect::create(const char *name, TABLE *table_arg, ...@@ -3559,13 +3559,31 @@ int ha_connect::create(const char *name, TABLE *table_arg,
DBUG_RETURN(rc); DBUG_RETURN(rc);
} // endif g } // endif g
// Check column types // Check table type
ttp= GetTypeID(options->type); ttp= GetTypeID(options->type);
if (ttp == TAB_UNDEF || ttp == TAB_NIY) ; if (ttp == TAB_UNDEF || ttp == TAB_NIY) {
#if 0 // Does not work. It's too late, FRM is constructed yet.
THD *thd= table_arg->in_use;
ttp= TAB_DOS;
options->type= strmake_root(thd->mem_root, "DOS", strlen("DOS"));
strcpy(g->Message, "Table_type defaulted to DOS");
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0, g->Message);
#endif
if (options->type)
sprintf(g->Message, "Unsupported table type %s", options->type);
else
strcpy(g->Message, "Unspecified table type");
rc= HA_ERR_INTERNAL_ERROR;
my_printf_error(ER_UNKNOWN_ERROR, g->Message, MYF(0));
DBUG_RETURN(rc);
} // endif ttp
dbf= ttp == TAB_DBF; dbf= ttp == TAB_DBF;
// Check column types
for (field= table_arg->field; *field; field++) { for (field= table_arg->field; *field; field++) {
fp= *field; fp= *field;
......
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