Commit 8c9ce173 authored by Olivier Bertrand's avatar Olivier Bertrand

- Code cleaning.

modified:
  storage/connect/connect.cc
  storage/connect/tabutil.h

- Fix closing invalid tdbp in External_lock.
modified:
  storage/connect/ha_connect.cc

- Fix closing null Tdbp
modified:
  storage/connect/tabpivot.cpp*

- Fix regression error in table type TBL no more accepting missing
  columns in sub-tables even when Accept was set to TRUE.
modified:
  storage/connect/tabtbl.cpp
parent 44cb1ce8
......@@ -657,11 +657,6 @@ int CntIndexInit(PGLOBAL g, PTDB ptdb, int id)
cdp= tdbp->Key(k)->GetCdp();
valp= AllocateValue(g, cdp->GetType(), cdp->GetLength());
tdbp->To_Link[k]= new(g) CONSTANT(valp);
//if (kdp->Klen && tdbp->To_Link[k]->GetResultType() == TYPE_STRING)
// ((XCOLBLK*)tdbp->To_Link[k])->SetLength(kdp->Klen);
//((PCOL)tdbp->To_Link[k])->InitValue(g);
} // endfor k
// Make the index on xdp
......
......@@ -3014,8 +3014,10 @@ int ha_connect::external_lock(THD *thd, int lock_type)
// This can NOT be called without open called first, but
// the table can have been closed since then
} else if (!tdbp || xp->CheckQuery(valid_query_id) || xmod != newmode) {
if (tdbp)
CloseTable(g);
// If this is called by a later query, the table may have
// been already closed and the tdbp is not valid anymore.
if (tdbp && xp->last_query_id == valid_query_id)
rc= CloseTable(g);
xmod= newmode;
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -876,7 +876,9 @@ int TDBPIVOT::DeleteDB(PGLOBAL g, int irc)
/***********************************************************************/
void TDBPIVOT::CloseDB(PGLOBAL g)
{
if (Tdbp)
Tdbp->CloseDB(g);
} // end of CloseDB
#if 0
......
File mode changed from 100644 to 100755
......@@ -214,8 +214,7 @@ PCOL TDBTBL::InsertSpecialColumn(PGLOBAL g, PCOL scp)
/***********************************************************************/
bool TDBTBL::InitTableList(PGLOBAL g)
{
char *colname;
int n, colpos;
int n;
PTABLE tp, tabp;
PTDB tdbp;
PCOL colp;
......@@ -242,23 +241,9 @@ bool TDBTBL::InitTableList(PGLOBAL g)
// Real initialization will be done later.
for (PCOL cp = Columns; cp; cp = cp->GetNext())
if (!cp->IsSpecial()) {
colname = cp->GetName();
colpos = ((PPRXCOL)cp)->Colnum;
// We try first to get the column by name
if (!(colp = tdbp->ColDB(g, colname, 0)) && colpos)
// When unsuccessful, if a column number was specified
// try to get the column by its position in the table
colp = tdbp->ColDB(g, NULL, colpos);
if (!colp) {
if (!Accept) {
sprintf(g->Message, MSG(NO_MATCHING_COL),
colname, tdbp->GetName());
return TRUE; // Error return
} // endif !Accept
} else // this is needed by some tables (which?)
if (((PPRXCOL)cp)->Init(g) && !Accept)
return TRUE;
else // this is needed by some tables (which?)
colp->SetColUse(cp->GetColUse());
} // endif !special
......@@ -428,7 +413,7 @@ bool TDBTBL::OpenDB(PGLOBAL g)
for (PCOL cp = Columns; cp; cp = cp->GetNext())
if (cp->GetAmType() == TYPE_AM_TABID)
cp->COLBLK::Reset();
else if (((PPRXCOL)cp)->Init(g))
else if (((PPRXCOL)cp)->Init(g) && !Accept)
return TRUE;
if (trace)
......@@ -482,7 +467,7 @@ int TDBTBL::ReadDB(PGLOBAL g)
for (PCOL cp = Columns; cp; cp = cp->GetNext())
if (cp->GetAmType() == TYPE_AM_TABID)
cp->COLBLK::Reset();
else if (((PPRXCOL)cp)->Init(g))
else if (((PPRXCOL)cp)->Init(g) && !Accept)
return RC_FX;
if (trace)
......
......@@ -14,28 +14,12 @@ typedef class XXLCOL *PXXLCOL;
typedef class PRXCOL *PPRXCOL;
typedef class TBCDEF *PTBCDEF;
typedef class TDBTBC *PTDBTBC;
typedef class XTDBASE *PTDBX;
typedef class XCOLBLK *PCOLX;
TABLE_SHARE *GetTableShare(PGLOBAL g, THD *thd, const char *db,
const char *name, bool& mysql);
PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db,
const char *name, bool info);
/***********************************************************************/
/* This class is used to access protected members of TDBASE. */
/***********************************************************************/
class XTDBASE : public TDBASE {
friend class TDBXCL;
}; // end of class XCOLBLK
/***********************************************************************/
/* This class is used to access protected members of COLBLK. */
/***********************************************************************/
class XCOLBLK : public COLBLK {
friend class TDBXCL;
}; // end of class XCOLBLK
/* -------------------------- PROXY classes -------------------------- */
/***********************************************************************/
......
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