Commit d2b6d80b authored by Olivier Bertrand's avatar Olivier Bertrand

- A quick and dirty fix for erased or not erased files when executing an

  Alter table on an auto-generated CONNECT table.

modified:
  storage/connect/ha_connect.cc
parent ebcf6ad9
...@@ -3193,6 +3193,10 @@ int ha_connect::delete_or_rename_table(const char *name, const char *to) ...@@ -3193,6 +3193,10 @@ int ha_connect::delete_or_rename_table(const char *name, const char *to)
TABLE_SHARE *share; TABLE_SHARE *share;
THD *thd= current_thd; THD *thd= current_thd;
if (to)
if (sscanf(to, fmt, db, tabname) != 2 || *tabname == '#')
goto fin;
if (sscanf(name, fmt, db, tabname) != 2 || *tabname == '#') if (sscanf(name, fmt, db, tabname) != 2 || *tabname == '#')
goto fin; goto fin;
...@@ -3932,19 +3936,24 @@ int ha_connect::create(const char *name, TABLE *table_arg, ...@@ -3932,19 +3936,24 @@ int ha_connect::create(const char *name, TABLE *table_arg,
char buf[256], fn[_MAX_PATH], dbpath[128]; char buf[256], fn[_MAX_PATH], dbpath[128];
int h; int h;
strcat(strcat(strcpy(buf, GetTableName()), "."), options->type); strcpy(buf, GetTableName());
sprintf(g->Message, "No file name. Table will use %s", buf);
push_warning(table->in_use,
MYSQL_ERROR::WARN_LEVEL_WARN, 0, g->Message);
strcat(strcat(strcpy(dbpath, "./"), table->s->db.str), "/");
PlugSetPath(fn, buf, dbpath);
if ((h= ::open(fn, O_CREAT, 0666)) == -1) { if (*buf != '#') {
sprintf(g->Message, "Cannot create file %s", fn); strcat(strcat(buf, "."), options->type);
sprintf(g->Message, "No file name. Table will use %s", buf);
push_warning(table->in_use, push_warning(table->in_use,
MYSQL_ERROR::WARN_LEVEL_WARN, 0, g->Message); MYSQL_ERROR::WARN_LEVEL_WARN, 0, g->Message);
} else strcat(strcat(strcpy(dbpath, "./"), table->s->db.str), "/");
::close(h); PlugSetPath(fn, buf, dbpath);
if ((h= ::open(fn, O_CREAT, 0666)) == -1) {
sprintf(g->Message, "Cannot create file %s", fn);
push_warning(table->in_use,
MYSQL_ERROR::WARN_LEVEL_WARN, 0, g->Message);
} else
::close(h);
} // endif buf
} else { } else {
// Check whether indexes were specified // Check whether indexes were specified
......
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