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) ...@@ -657,11 +657,6 @@ int CntIndexInit(PGLOBAL g, PTDB ptdb, int id)
cdp= tdbp->Key(k)->GetCdp(); cdp= tdbp->Key(k)->GetCdp();
valp= AllocateValue(g, cdp->GetType(), cdp->GetLength()); valp= AllocateValue(g, cdp->GetType(), cdp->GetLength());
tdbp->To_Link[k]= new(g) CONSTANT(valp); 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 } // endfor k
// Make the index on xdp // Make the index on xdp
......
...@@ -3014,8 +3014,10 @@ int ha_connect::external_lock(THD *thd, int lock_type) ...@@ -3014,8 +3014,10 @@ int ha_connect::external_lock(THD *thd, int lock_type)
// This can NOT be called without open called first, but // This can NOT be called without open called first, but
// the table can have been closed since then // the table can have been closed since then
} else if (!tdbp || xp->CheckQuery(valid_query_id) || xmod != newmode) { } else if (!tdbp || xp->CheckQuery(valid_query_id) || xmod != newmode) {
if (tdbp) // If this is called by a later query, the table may have
CloseTable(g); // been already closed and the tdbp is not valid anymore.
if (tdbp && xp->last_query_id == valid_query_id)
rc= CloseTable(g);
xmod= newmode; 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) ...@@ -876,7 +876,9 @@ int TDBPIVOT::DeleteDB(PGLOBAL g, int irc)
/***********************************************************************/ /***********************************************************************/
void TDBPIVOT::CloseDB(PGLOBAL g) void TDBPIVOT::CloseDB(PGLOBAL g)
{ {
Tdbp->CloseDB(g); if (Tdbp)
Tdbp->CloseDB(g);
} // end of CloseDB } // end of CloseDB
#if 0 #if 0
......
File mode changed from 100644 to 100755
...@@ -214,8 +214,7 @@ PCOL TDBTBL::InsertSpecialColumn(PGLOBAL g, PCOL scp) ...@@ -214,8 +214,7 @@ PCOL TDBTBL::InsertSpecialColumn(PGLOBAL g, PCOL scp)
/***********************************************************************/ /***********************************************************************/
bool TDBTBL::InitTableList(PGLOBAL g) bool TDBTBL::InitTableList(PGLOBAL g)
{ {
char *colname; int n;
int n, colpos;
PTABLE tp, tabp; PTABLE tp, tabp;
PTDB tdbp; PTDB tdbp;
PCOL colp; PCOL colp;
...@@ -242,23 +241,9 @@ bool TDBTBL::InitTableList(PGLOBAL g) ...@@ -242,23 +241,9 @@ bool TDBTBL::InitTableList(PGLOBAL g)
// Real initialization will be done later. // Real initialization will be done later.
for (PCOL cp = Columns; cp; cp = cp->GetNext()) for (PCOL cp = Columns; cp; cp = cp->GetNext())
if (!cp->IsSpecial()) { if (!cp->IsSpecial()) {
colname = cp->GetName(); if (((PPRXCOL)cp)->Init(g) && !Accept)
colpos = ((PPRXCOL)cp)->Colnum; return TRUE;
else // this is needed by some tables (which?)
// 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?)
colp->SetColUse(cp->GetColUse()); colp->SetColUse(cp->GetColUse());
} // endif !special } // endif !special
...@@ -428,7 +413,7 @@ bool TDBTBL::OpenDB(PGLOBAL g) ...@@ -428,7 +413,7 @@ bool TDBTBL::OpenDB(PGLOBAL g)
for (PCOL cp = Columns; cp; cp = cp->GetNext()) for (PCOL cp = Columns; cp; cp = cp->GetNext())
if (cp->GetAmType() == TYPE_AM_TABID) if (cp->GetAmType() == TYPE_AM_TABID)
cp->COLBLK::Reset(); cp->COLBLK::Reset();
else if (((PPRXCOL)cp)->Init(g)) else if (((PPRXCOL)cp)->Init(g) && !Accept)
return TRUE; return TRUE;
if (trace) if (trace)
...@@ -482,7 +467,7 @@ int TDBTBL::ReadDB(PGLOBAL g) ...@@ -482,7 +467,7 @@ int TDBTBL::ReadDB(PGLOBAL g)
for (PCOL cp = Columns; cp; cp = cp->GetNext()) for (PCOL cp = Columns; cp; cp = cp->GetNext())
if (cp->GetAmType() == TYPE_AM_TABID) if (cp->GetAmType() == TYPE_AM_TABID)
cp->COLBLK::Reset(); cp->COLBLK::Reset();
else if (((PPRXCOL)cp)->Init(g)) else if (((PPRXCOL)cp)->Init(g) && !Accept)
return RC_FX; return RC_FX;
if (trace) if (trace)
......
...@@ -14,28 +14,12 @@ typedef class XXLCOL *PXXLCOL; ...@@ -14,28 +14,12 @@ typedef class XXLCOL *PXXLCOL;
typedef class PRXCOL *PPRXCOL; typedef class PRXCOL *PPRXCOL;
typedef class TBCDEF *PTBCDEF; typedef class TBCDEF *PTBCDEF;
typedef class TDBTBC *PTDBTBC; typedef class TDBTBC *PTDBTBC;
typedef class XTDBASE *PTDBX;
typedef class XCOLBLK *PCOLX;
TABLE_SHARE *GetTableShare(PGLOBAL g, THD *thd, const char *db, TABLE_SHARE *GetTableShare(PGLOBAL g, THD *thd, const char *db,
const char *name, bool& mysql); const char *name, bool& mysql);
PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db, PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db,
const char *name, bool info); 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 -------------------------- */ /* -------------------------- 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