1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

- Adding a loop test to prevent PROXY based table to loop when repointing on itself.

- Fix bug causing PROXY on non CONNECT tables to sometimes use the wrong DB.
- Making some more tests in create that were in pre_create not called anymore
  when columns are defined.
- Updating some test results to reflect new warnings.

modified:
  storage/connect/ha_connect.cc
  storage/connect/mysql-test/connect/r/tbl.result
  storage/connect/mysql-test/connect/r/upd.result
  storage/connect/tabcol.h
  storage/connect/tabmysql.cpp
  storage/connect/taboccur.cpp
  storage/connect/taboccur.h
  storage/connect/tabtbl.cpp
  storage/connect/tabtbl.h
  storage/connect/tabutil.cpp
  storage/connect/tabutil.h
  storage/connect/tabxcl.cpp
  storage/connect/tabxcl.h
This commit is contained in:
Olivier Bertrand
2013-05-02 16:33:15 +02:00
parent 3d4adc3fdf
commit f3e944099e
13 changed files with 132 additions and 490 deletions

View File

@ -245,7 +245,7 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db,
return qrp;
} // end of TabColumns
/* -------------- Implementation of the XCOL classes ---------------- */
/* -------------- Implementation of the PROXY classes ---------------- */
/***********************************************************************/
/* PRXDEF constructor. */
@ -311,11 +311,23 @@ PTDB TDBPRX::GetSubTable(PGLOBAL g, PTABLE tabp)
TABLE_SHARE *s;
PCATLG cat = To_Def->GetCat();
PHC hc = ((MYCAT*)cat)->GetHandler();
LPCSTR cdb, curdb = hc->GetDBName(NULL);
THD *thd = (hc->GetTable())->in_use;
db = (char*)tabp->GetQualifier();
name = (char*)tabp->GetName();
// Check for eventual loop
for (PTABLE tp = To_Table; tp; tp = tp->Next) {
cdb = (tp->Qualifier) ? tp->Qualifier : curdb;
if (!stricmp(name, tp->Name) && !stricmp(db, cdb)) {
sprintf(g->Message, "Table %s.%s pointing on itself", db, name);
return NULL;
} // endif
} // endfor tp
if (!(s = GetTableShare(g, thd, db, name, mysql)))
return NULL;
@ -337,9 +349,11 @@ PTDB TDBPRX::GetSubTable(PGLOBAL g, PTABLE tabp)
db, tblp->Name);
goto err;
#endif // MYSQL_SUPPORT
} else
} else {
// Sub-table is a CONNECT table
tabp->Next = To_Table; // For loop checking
tdbp = cat->GetTable(g, tabp);
} // endif mysql
hc->tshp = NULL;
@ -420,7 +434,7 @@ bool TDBPRX::OpenDB(PGLOBAL g)
} // endif Mode
if (InitTable(g))
return NULL;
return TRUE;
/*********************************************************************/
/* Check and initialize the subtable columns. */
@ -468,6 +482,14 @@ int TDBPRX::DeleteDB(PGLOBAL g, int irc)
return RC_FX;
} // end of DeleteDB
/***********************************************************************/
/* Used by the TBL tables. */
/***********************************************************************/
void TDBPRX::RemoveNext(PTABLE tp)
{
tp->Next = NULL;
} // end of RemoveNext
/* ---------------------------- PRXCOL ------------------------------- */
/***********************************************************************/