Commit fb91774e authored by Olivier Bertrand's avatar Olivier Bertrand

These changed were made after pulling 10.2.30 from origin

---------------------------------------------------------
- Temporarily fix MDEV-13782 by commenting out LIKE_FUNC in CondFilter
  modified:   storage/connect/ha_connect.cc

- Remove use of hack tables
  modified:   storage/connect/connect.cc
  modified:   storage/connect/connect.h
  modified:   storage/connect/ha_connect.cc
  modified:   storage/connect/xtable.h
parent b4bfa12b
...@@ -566,7 +566,7 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort) ...@@ -566,7 +566,7 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort)
rc = tdbp->DeleteDB(g, RC_EF); // Specific A.M. delete routine rc = tdbp->DeleteDB(g, RC_EF); // Specific A.M. delete routine
} else if (tdbp->GetMode() == MODE_UPDATE && tdbp->IsIndexed()) } else if (tdbp->GetMode() == MODE_UPDATE && tdbp->IsIndexed())
rc = ((PTDBDOX)tdbp)->Txfp->UpdateSortedRows(g); rc = ((PTDBDOS)tdbp)->GetTxfp()->UpdateSortedRows(g);
switch (rc) { switch (rc) {
case RC_FX: case RC_FX:
...@@ -593,7 +593,7 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort) ...@@ -593,7 +593,7 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort)
if (!tdbp->IsRemote()) { if (!tdbp->IsRemote()) {
// Make all the eventual indexes // Make all the eventual indexes
PTDBDOX tbxp = (PTDBDOX)tdbp; PTDBDOS tbxp = (PTDBDOS)tdbp;
tbxp->ResetKindex(g, NULL); tbxp->ResetKindex(g, NULL);
tbxp->SetKey_Col(NULL); tbxp->SetKey_Col(NULL);
rc = tbxp->ResetTableOpt(g, true, tbxp->GetDef()->Indexable() == 1); rc = tbxp->ResetTableOpt(g, true, tbxp->GetDef()->Indexable() == 1);
...@@ -622,8 +622,8 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort) ...@@ -622,8 +622,8 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort)
int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted) int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted)
{ {
PIXDEF xdp; PIXDEF xdp;
PTDBDOX tdbp; PTDBDOS tdbp;
DOXDEF *dfp; DOSDEF *dfp;
if (!ptdb) if (!ptdb)
return -1; return -1;
...@@ -633,9 +633,9 @@ int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted) ...@@ -633,9 +633,9 @@ int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted)
} else if (ptdb->GetDef()->Indexable() == 3) { } else if (ptdb->GetDef()->Indexable() == 3) {
return 1; return 1;
} else } else
tdbp= (PTDBDOX)ptdb; tdbp= (PTDBDOS)ptdb;
dfp= (DOXDEF*)tdbp->To_Def; dfp= (DOSDEF*)tdbp->GetDef();
//if (!(k= colp->GetKey())) //if (!(k= colp->GetKey()))
// if (colp->GetOpt() >= 2) { // if (colp->GetOpt() >= 2) {
...@@ -645,16 +645,16 @@ int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted) ...@@ -645,16 +645,16 @@ int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted)
// This is a pseudo indexed sorted block optimized column // This is a pseudo indexed sorted block optimized column
// return 0; // return 0;
if (tdbp->To_Kindex) if (tdbp->GetKindex())
if (((XXBASE*)tdbp->To_Kindex)->GetID() == id) { if (((XXBASE*)tdbp->GetKindex())->GetID() == id) {
tdbp->To_Kindex->Reset(); // Same index tdbp->GetKindex()->Reset(); // Same index
return (tdbp->To_Kindex->IsMul()) ? 2 : 1; return (tdbp->GetKindex()->IsMul()) ? 2 : 1;
} else { } else {
tdbp->To_Kindex->Close(); tdbp->GetKindex()->Close();
tdbp->To_Kindex= NULL; tdbp->SetKindex(NULL);
} // endif colp } // endif colp
for (xdp= dfp->To_Indx; xdp; xdp= xdp->GetNext()) for (xdp= dfp->GetIndx(); xdp; xdp= xdp->GetNext())
if (xdp->GetID() == id) if (xdp->GetID() == id)
break; break;
...@@ -676,7 +676,7 @@ int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted) ...@@ -676,7 +676,7 @@ int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted)
if (tdbp->InitialyzeIndex(g, xdp, sorted)) if (tdbp->InitialyzeIndex(g, xdp, sorted))
return 0; return 0;
return (tdbp->To_Kindex->IsMul()) ? 2 : 1; return (tdbp->GetKindex()->IsMul()) ? 2 : 1;
} // end of CntIndexInit } // end of CntIndexInit
#if defined(WORDS_BIGENDIAN) #if defined(WORDS_BIGENDIAN)
...@@ -710,7 +710,7 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op, ...@@ -710,7 +710,7 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op,
int n, x; int n, x;
RCODE rc; RCODE rc;
XXBASE *xbp; XXBASE *xbp;
PTDBDOX tdbp; PTDBDOS tdbp;
if (!ptdb) if (!ptdb)
return RC_FX; return RC_FX;
...@@ -736,12 +736,12 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op, ...@@ -736,12 +736,12 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op,
goto rnd; goto rnd;
} else } else
tdbp= (PTDBDOX)ptdb; tdbp= (PTDBDOS)ptdb;
// Set reference values and index operator // Set reference values and index operator
if (!tdbp->To_Link || !tdbp->To_Kindex) { if (!tdbp->GetLink() || !tdbp->GetKindex()) {
// if (!tdbp->To_Xdp) { // if (!tdbp->To_Xdp) {
sprintf(g->Message, "Index not initialized for table %s", tdbp->Name); sprintf(g->Message, "Index not initialized for table %s", tdbp->GetName());
return RC_FX; return RC_FX;
#if 0 #if 0
} // endif !To_Xdp } // endif !To_Xdp
...@@ -754,7 +754,7 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op, ...@@ -754,7 +754,7 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op,
#endif // 0 #endif // 0
} // endif !To_Kindex } // endif !To_Kindex
xbp= (XXBASE*)tdbp->To_Kindex; xbp= (XXBASE*)tdbp->GetKindex();
if (kr) { if (kr) {
char *kp= (char*)kr->key; char *kp= (char*)kr->key;
...@@ -764,13 +764,13 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op, ...@@ -764,13 +764,13 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op,
PVAL valp; PVAL valp;
PCOL colp; PCOL colp;
for (n= 0; n < tdbp->Knum; n++) { for (n= 0; n < tdbp->GetKnum(); n++) {
colp= (PCOL)tdbp->To_Key_Col[n]; colp= (PCOL)tdbp->Key(n);
if (colp->GetColUse(U_NULLS)) if (colp->GetColUse(U_NULLS))
kp++; // Skip null byte kp++; // Skip null byte
valp= tdbp->To_Link[n]->GetValue(); valp= tdbp->Link(n)->GetValue();
if (!valp->IsTypeNum()) { if (!valp->IsTypeNum()) {
if (colp->GetColUse(U_VAR)) { if (colp->GetColUse(U_VAR)) {
...@@ -840,7 +840,7 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len, ...@@ -840,7 +840,7 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len,
bool b, rcb; bool b, rcb;
PVAL valp; PVAL valp;
PCOL colp; PCOL colp;
PTDBDOX tdbp; PTDBDOS tdbp;
XXBASE *xbp; XXBASE *xbp;
if (!ptdb) if (!ptdb)
...@@ -865,35 +865,35 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len, ...@@ -865,35 +865,35 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len,
return k[1] - k[0] + 1; return k[1] - k[0] + 1;
} else } else
tdbp= (PTDBDOX)ptdb; tdbp= (PTDBDOS)ptdb;
if (!tdbp->To_Kindex || !tdbp->To_Link) { if (!tdbp->GetKindex() || !tdbp->GetLink()) {
if (!tdbp->To_Xdp) { if (!tdbp->GetXdp()) {
sprintf(g->Message, "Index not initialized for table %s", tdbp->Name); sprintf(g->Message, "Index not initialized for table %s", tdbp->GetName());
DBUG_PRINT("Range", ("%s", g->Message)); DBUG_PRINT("Range", ("%s", g->Message));
return -1; return -1;
} else // Dynamic index } else // Dynamic index
return tdbp->To_Xdp->GetMaxSame(); // TODO a better estimate return tdbp->GetXdp()->GetMaxSame(); // TODO a better estimate
} else } else
xbp= (XXBASE*)tdbp->To_Kindex; xbp= (XXBASE*)tdbp->GetKindex();
for (b= false, i= 0; i < 2; i++) { for (b= false, i= 0; i < 2; i++) {
p= kp= key[i]; p= kp= key[i];
if (kp) { if (kp) {
for (n= 0; n < tdbp->Knum; n++) { for (n= 0; n < tdbp->GetKnum(); n++) {
if (kmap[i] & (key_part_map)(1 << n)) { if (kmap[i] & (key_part_map)(1 << n)) {
if (b == true) if (b == true)
// Cannot do indexing with missing intermediate key // Cannot do indexing with missing intermediate key
return -1; return -1;
colp= (PCOL)tdbp->To_Key_Col[n]; colp= (PCOL)tdbp->Key(n);
if (colp->GetColUse(U_NULLS)) if (colp->GetColUse(U_NULLS))
p++; // Skip null byte ??? p++; // Skip null byte ???
valp= tdbp->To_Link[n]->GetValue(); valp= tdbp->Link(n)->GetValue();
if (!valp->IsTypeNum()) { if (!valp->IsTypeNum()) {
if (colp->GetColUse(U_VAR)) { if (colp->GetColUse(U_VAR)) {
......
...@@ -46,6 +46,7 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len, ...@@ -46,6 +46,7 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len,
bool *incl, key_part_map *kmap); bool *incl, key_part_map *kmap);
PGLOBAL CntExit(PGLOBAL g); PGLOBAL CntExit(PGLOBAL g);
#if 0
/***********************************************************************/ /***********************************************************************/
/* Definition of classes XKPDEF, DOXDEF, TDBDOX */ /* Definition of classes XKPDEF, DOXDEF, TDBDOX */
/* These classes purpose is chiefly to access protected items! */ /* These classes purpose is chiefly to access protected items! */
...@@ -76,3 +77,4 @@ class XKPDEF: public KPARTDEF { ...@@ -76,3 +77,4 @@ class XKPDEF: public KPARTDEF {
public: public:
XKPDEF(const char *name, int n) : KPARTDEF((PSZ)name, n) {} XKPDEF(const char *name, int n) : KPARTDEF((PSZ)name, n) {}
}; // end of class XKPDEF }; // end of class XKPDEF
#endif // 0
...@@ -2966,12 +2966,10 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond) ...@@ -2966,12 +2966,10 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond)
case Item_func::LE_FUNC: vop= OP_LE; break; case Item_func::LE_FUNC: vop= OP_LE; break;
case Item_func::GE_FUNC: vop= OP_GE; break; case Item_func::GE_FUNC: vop= OP_GE; break;
case Item_func::GT_FUNC: vop= OP_GT; break; case Item_func::GT_FUNC: vop= OP_GT; break;
#if 0 //case Item_func::LIKE_FUNC:
case Item_func::LIKE_FUNC: // vop = OP_LIKE;
vop= OP_LIKE; // neg= ((Item_func_like*)condf)->negated;
neg= ((Item_func_like*)condf)->negated; // break;
break;
#endif // 0
case Item_func::ISNOTNULL_FUNC: case Item_func::ISNOTNULL_FUNC:
neg= true; neg= true;
// fall through // fall through
...@@ -3789,9 +3787,9 @@ int ha_connect::index_init(uint idx, bool sorted) ...@@ -3789,9 +3787,9 @@ int ha_connect::index_init(uint idx, bool sorted)
active_index= MAX_KEY; active_index= MAX_KEY;
rc= HA_ERR_INTERNAL_ERROR; rc= HA_ERR_INTERNAL_ERROR;
} else if (tdbp->GetKindex()) { } else if (tdbp->GetKindex()) {
if (((PTDBDOX)tdbp)->To_Kindex->GetNum_K()) { if (((PTDBDOS)tdbp)->GetKindex()->GetNum_K()) {
if (tdbp->GetFtype() != RECFM_NAF) if (tdbp->GetFtype() != RECFM_NAF)
((PTDBDOX)tdbp)->GetTxfp()->ResetBuffer(g); ((PTDBDOS)tdbp)->GetTxfp()->ResetBuffer(g);
active_index= idx; active_index= idx;
// } else { // Void table // } else { // Void table
......
...@@ -173,9 +173,12 @@ class DllExport TDBASE : public TDB { ...@@ -173,9 +173,12 @@ class DllExport TDBASE : public TDB {
inline void SetKindex(PKXBASE kxp) {To_Kindex = kxp;} inline void SetKindex(PKXBASE kxp) {To_Kindex = kxp;}
// Properties // Properties
virtual PKXBASE GetKindex(void) {return To_Kindex;} PKXBASE GetKindex(void) {return To_Kindex;}
PXOB *GetLink(void) {return To_Link;}
PIXDEF GetXdp(void) {return To_Xdp;}
void ResetKindex(PGLOBAL g, PKXBASE kxp); void ResetKindex(PGLOBAL g, PKXBASE kxp);
PCOL Key(int i) {return (To_Key_Col) ? To_Key_Col[i] : NULL;} PCOL Key(int i) {return (To_Key_Col) ? To_Key_Col[i] : NULL;}
PXOB Link(int i) { return (To_Link) ? To_Link[i] : NULL; }
// Methods // Methods
virtual bool IsUsingTemp(PGLOBAL) {return false;} virtual bool IsUsingTemp(PGLOBAL) {return false;}
......
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