summaryrefslogtreecommitdiff
path: root/storage/connect/connect.cc
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2014-04-30 10:48:29 +0200
committerOlivier Bertrand <bertrandop@gmail.com>2014-04-30 10:48:29 +0200
commite7c7256d1d67125921d9f688a382aef873f5b9ce (patch)
tree06a78782e6deea301516dc6df03a3a686b191130 /storage/connect/connect.cc
parent883c37a827ede4379d25896e482e0fe5292330a3 (diff)
downloadmariadb-git-e7c7256d1d67125921d9f688a382aef873f5b9ce.tar.gz
- Implementation of adding selected columns to dynamic indexes.
modified: storage/connect/connect.cc storage/connect/ha_connect.cc storage/connect/ha_connect.h storage/connect/tabdos.cpp storage/connect/tabdos.h storage/connect/tabvct.cpp storage/connect/tabvct.h storage/connect/xindex.cpp storage/connect/xindex.h
Diffstat (limited to 'storage/connect/connect.cc')
-rw-r--r--storage/connect/connect.cc71
1 files changed, 9 insertions, 62 deletions
diff --git a/storage/connect/connect.cc b/storage/connect/connect.cc
index f7bba541dfa..daff6ffdc68 100644
--- a/storage/connect/connect.cc
+++ b/storage/connect/connect.cc
@@ -604,15 +604,8 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp)
/***********************************************************************/
int CntIndexInit(PGLOBAL g, PTDB ptdb, int id)
{
- int k;
- PCOL colp;
- PVAL valp;
- PKXBASE xp;
- PXLOAD pxp;
PIXDEF xdp;
- XKPDEF *kdp;
PTDBDOX tdbp;
- PCOLDEF cdp;
DOXDEF *dfp;
if (!ptdb)
@@ -651,64 +644,20 @@ int CntIndexInit(PGLOBAL g, PTDB ptdb, int id)
return 0;
} // endif xdp
+#if 0
if (xdp->IsDynamic()) {
// This is a dynamically created index (KINDEX)
- // It cannot be created now, before cond_push is executed
+ // It should not be created now, if called by index range
tdbp->SetXdp(xdp);
return (xdp->IsUnique()) ? 1 : 2;
} // endif dynamic
+#endif // 0
// Static indexes must be initialized now for records_in_range
- // Allocate the key columns definition block
- tdbp->Knum= xdp->GetNparts();
- tdbp->To_Key_Col= (PCOL*)PlugSubAlloc(g, NULL, tdbp->Knum * sizeof(PCOL));
-
- // Get the key column description list
- for (k= 0, kdp= (XKPDEF*)xdp->GetToKeyParts(); kdp; kdp= (XKPDEF*)kdp->Next)
- if (!(colp= tdbp->ColDB(g, kdp->Name, 0)) || colp->InitValue(g)) {
- sprintf(g->Message, "Wrong column %s", kdp->Name);
- return 0;
- } else
- tdbp->To_Key_Col[k++]= colp;
-
-#if defined(_DEBUG)
- if (k != tdbp->Knum) {
- sprintf(g->Message, "Key part number mismatch for %s",
- xdp->GetName());
- return 0;
- } // endif k
-#endif // _DEBUG
-
- // Allocate the pseudo constants that will contain the key values
- tdbp->To_Link= (PXOB*)PlugSubAlloc(g, NULL, tdbp->Knum * sizeof(PXOB));
-
- for (k= 0, kdp= (XKPDEF*)xdp->GetToKeyParts();
- kdp; k++, kdp= (XKPDEF*)kdp->Next) {
- cdp= tdbp->Key(k)->GetCdp();
- valp= AllocateValue(g, cdp->GetType(), cdp->GetLength());
- tdbp->To_Link[k]= new(g) CONSTANT(valp);
- } // endfor k
-
- // Make the index on xdp
- if (!xdp->IsAuto()) {
- if (dfp->Huge)
- pxp= new(g) XHUGE;
- else
- pxp= new(g) XFILE;
-
- if (tdbp->Knum == 1) // Single index
- xp= new(g) XINDXS(tdbp, xdp, pxp, tdbp->To_Key_Col, tdbp->To_Link);
- else // Multi-Column index
- xp= new(g) XINDEX(tdbp, xdp, pxp, tdbp->To_Key_Col, tdbp->To_Link);
-
- } else // Column contains same values as ROWID
- xp= new(g) XXROW(tdbp);
-
- if (xp->Init(g))
+ if (tdbp->InitialyzeIndex(g, xdp))
return 0;
- tdbp->To_Kindex= xp;
- return (xp->IsMul()) ? 2 : 1;
+ return (tdbp->To_Kindex->IsMul()) ? 2 : 1;
} // end of CntIndexInit
/***********************************************************************/
@@ -746,20 +695,18 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op,
// Set reference values and index operator
if (!tdbp->To_Link || !tdbp->To_Kindex) {
- if (!tdbp->To_Xdp) {
+// if (!tdbp->To_Xdp) {
sprintf(g->Message, "Index not initialized for table %s", tdbp->Name);
return RC_FX;
+#if 0
} // endif !To_Xdp
-
// Now it's time to make the dynamic index
- tdbp->SetFilter(tdbp->To_Def->GetHandler()->CheckFilter(g));
-
- if (tdbp->MakeDynamicIndex(g)) {
+ if (tdbp->InitialyzeIndex(g, NULL)) {
sprintf(g->Message, "Fail to make dynamic index %s",
tdbp->To_Xdp->GetName());
return RC_FX;
} // endif MakeDynamicIndex
-
+#endif // 0
} // endif !To_Kindex
xbp= (XXBASE*)tdbp->To_Kindex;