Commit 964a423d authored by Olivier Bertrand's avatar Olivier Bertrand

- Fix a bug causing the index file not being made or erased on statements

  such as CREATE INDEX, DROP INDEX, ALTER TABLE... ADD INDEX etc.

modified:
  storage/connect/ha_connect.cc
parent 5746fcc9
...@@ -1377,16 +1377,11 @@ bool ha_connect::OpenTable(PGLOBAL g, bool del) ...@@ -1377,16 +1377,11 @@ bool ha_connect::OpenTable(PGLOBAL g, bool del)
istable= true; istable= true;
// strmake(tname, table_name, sizeof(tname)-1); // strmake(tname, table_name, sizeof(tname)-1);
if (xmod == MODE_ANY && stop && *tdbp->GetName() != '#') { if (xmod == MODE_ANY && *tdbp->GetName() != '#')
// We are in a create index query // We may be in a create index query
if (!((PTDBASE)tdbp)->GetDef()->Indexable()) { if (xp) // xp can be null when called from create
sprintf(g->Message, "Table %s cannot be indexed", tdbp->GetName());
rc= true;
} else if (xp) // xp can be null when called from create
xp->tabp= (PTDBDOS)tdbp; // The table on which the index is created xp->tabp= (PTDBDOS)tdbp; // The table on which the index is created
} // endif xmod
// tdbp->SetOrig((PTBX)table); // used by CheckCond // tdbp->SetOrig((PTBX)table); // used by CheckCond
} else } else
printf("OpenTable: %s\n", g->Message); printf("OpenTable: %s\n", g->Message);
...@@ -2942,8 +2937,8 @@ int ha_connect::external_lock(THD *thd, int lock_type) ...@@ -2942,8 +2937,8 @@ int ha_connect::external_lock(THD *thd, int lock_type)
if (xp->CheckQueryID()) if (xp->CheckQueryID())
rc= 2; // Logical error ??? rc= 2; // Logical error ???
else if (tdbp) { else if (tdbp) {
if (tdbp->GetMode() == MODE_ANY && *tdbp->GetName() == '#' if (tdbp->GetMode() == MODE_ANY && *tdbp->GetName() == '#' &&
&& xp->tabp) { xp->tabp && ((PTDBASE)tdbp)->GetDef()->Indexable()) {
PDOSDEF defp1= (PDOSDEF)((PTDBASE)tdbp)->GetDef(); PDOSDEF defp1= (PDOSDEF)((PTDBASE)tdbp)->GetDef();
PDOSDEF defp2= (PDOSDEF)xp->tabp->GetDef(); PDOSDEF defp2= (PDOSDEF)xp->tabp->GetDef();
PIXDEF xp1, xp2, sxp; PIXDEF xp1, xp2, sxp;
...@@ -3033,7 +3028,7 @@ int ha_connect::external_lock(THD *thd, int lock_type) ...@@ -3033,7 +3028,7 @@ int ha_connect::external_lock(THD *thd, int lock_type)
case SQLCOM_DROP_INDEX: case SQLCOM_DROP_INDEX:
case SQLCOM_CREATE_INDEX: case SQLCOM_CREATE_INDEX:
newmode= MODE_ANY; newmode= MODE_ANY;
stop= true; // stop= true;
break; break;
default: default:
printf("Unsupported sql_command=%d", thd->lex->sql_command); printf("Unsupported sql_command=%d", thd->lex->sql_command);
...@@ -3059,7 +3054,7 @@ int ha_connect::external_lock(THD *thd, int lock_type) ...@@ -3059,7 +3054,7 @@ int ha_connect::external_lock(THD *thd, int lock_type)
break; break;
case SQLCOM_DROP_INDEX: case SQLCOM_DROP_INDEX:
case SQLCOM_CREATE_INDEX: case SQLCOM_CREATE_INDEX:
stop= true; // stop= true;
case SQLCOM_DROP_TABLE: case SQLCOM_DROP_TABLE:
case SQLCOM_RENAME_TABLE: case SQLCOM_RENAME_TABLE:
case SQLCOM_ALTER_TABLE: case SQLCOM_ALTER_TABLE:
......
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