summaryrefslogtreecommitdiff
path: root/storage/connect/xindex.cpp
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2014-04-26 00:17:26 +0200
committerOlivier Bertrand <bertrandop@gmail.com>2014-04-26 00:17:26 +0200
commit0e20f02174099e0ee79fd5440c84fae9d2796b86 (patch)
treea31858b925286aa3d3927249698d6c1d2ddde158 /storage/connect/xindex.cpp
parent9d29647487e8170d018413aacc6ec580decd59b1 (diff)
downloadmariadb-git-0e20f02174099e0ee79fd5440c84fae9d2796b86.tar.gz
- Implement dynamic indexing
modified: storage/connect/connect.cc storage/connect/filter.cpp storage/connect/filter.h storage/connect/ha_connect.cc storage/connect/ha_connect.h storage/connect/tabdos.cpp storage/connect/tabdos.h storage/connect/table.cpp storage/connect/xindex.cpp storage/connect/xindex.h storage/connect/xtable.h
Diffstat (limited to 'storage/connect/xindex.cpp')
-rwxr-xr-xstorage/connect/xindex.cpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/storage/connect/xindex.cpp b/storage/connect/xindex.cpp
index 66b8abe2e9b..5039f2d7aee 100755
--- a/storage/connect/xindex.cpp
+++ b/storage/connect/xindex.cpp
@@ -112,6 +112,8 @@ INDEXDEF::INDEXDEF(char *name, bool uniq, int n)
Unique = uniq;
Invalid = false;
AutoInc = false;
+ Dynamic = false;
+ Mapped = false;
Nparts = 0;
ID = n;
//Offset = 0;
@@ -242,7 +244,8 @@ void XINDEX::Reset(void)
void XINDEX::Close(void)
{
// Close file or view of file
- X->Close();
+ if (X)
+ X->Close();
// De-allocate data
PlgDBfree(Record);
@@ -286,7 +289,7 @@ bool XINDEX::Make(PGLOBAL g, PIXDEF sxp)
int k, rc = RC_OK;
int *bof, i, j, n, ndf, nkey;
PKPDEF kdfp = Xdp->GetToKeyParts();
- bool brc = true;
+ bool brc = false;
PCOL colp;
PXCOL kp, prev = NULL, kcp = NULL;
PDBUSER dup = (PDBUSER)g->Activityp->Aptr;
@@ -378,11 +381,14 @@ bool XINDEX::Make(PGLOBAL g, PIXDEF sxp)
// Check return code and do whatever must be done according to it
switch (rc) {
case RC_OK:
- break;
- case RC_EF:
- goto end_of_file;
+ if (ApplyFilter(g, Tdbp->GetFilter()))
+ break;
+
+ // passthru
case RC_NF:
continue;
+ case RC_EF:
+ goto end_of_file;
default:
sprintf(g->Message, MSG(RC_READING), rc, Tdbp->Name);
goto err;
@@ -579,14 +585,15 @@ bool XINDEX::Make(PGLOBAL g, PIXDEF sxp)
Cur_K = Num_K;
/*********************************************************************/
- /* Save the index so it has not to be recalculated. */
+ /* Save the xindex so it has not to be recalculated. */
/*********************************************************************/
- if (!SaveIndex(g, sxp))
- brc = false;
+ if (X && SaveIndex(g, sxp))
+ brc = true;
err:
// We don't need the index anymore
- Close();
+ if (X || brc)
+ Close();
if (brc)
printf("%s\n", g->Message);