diff options
author | Olivier Bertrand <bertrandop@gmail.com> | 2015-05-30 10:59:34 +0200 |
---|---|---|
committer | Olivier Bertrand <bertrandop@gmail.com> | 2015-05-30 10:59:34 +0200 |
commit | 514a7d8462aa4aa0a2acac54355b1d0cfb35695f (patch) | |
tree | 84ae797a06a8e9fd5d8bf5e22ce2f2d43cbe793f /storage/connect/xindex.cpp | |
parent | b6a56370d6e833f8033169ebb4e91cdce4d911aa (diff) | |
download | mariadb-git-514a7d8462aa4aa0a2acac54355b1d0cfb35695f.tar.gz |
Add unicode ODBC types to the types recognized by CONNECT.
Was added in function TranslateSQLType.
modified: storage/connect/ha_connect.cc
modified: storage/connect/odbconn.cpp
modified: storage/connect/value.h
Add some trace in particular in indexing routines.
modified: storage/connect/block.h
modified: storage/connect/ha_connect.cc
modified: storage/connect/plugutil.c
modified: storage/connect/xindex.cpp
modified: storage/connect/xindex.h
Diffstat (limited to 'storage/connect/xindex.cpp')
-rwxr-xr-x | storage/connect/xindex.cpp | 62 |
1 files changed, 49 insertions, 13 deletions
diff --git a/storage/connect/xindex.cpp b/storage/connect/xindex.cpp index 85b3fc9751c..a2d75cec8ab 100755 --- a/storage/connect/xindex.cpp +++ b/storage/connect/xindex.cpp @@ -340,6 +340,9 @@ bool XINDEX::Make(PGLOBAL g, PIXDEF sxp) } // endif n + if (trace) + htrc("XINDEX Make: n=%d\n", n); + // File position must be stored Record.Size = n * sizeof(int); @@ -477,6 +480,9 @@ bool XINDEX::Make(PGLOBAL g, PIXDEF sxp) } else To_Rec[nkey] = Tdbp->GetRecpos(); + if (trace > 1) + htrc("Make: To_Rec[%d]=%d\n", nkey, To_Rec[nkey]); + /*******************************************************************/ /* Get the keys and place them in the key blocks. */ /*******************************************************************/ @@ -1759,6 +1765,9 @@ int XINDEX::Fetch(PGLOBAL g) if (Num_K == 0) return -1; // means end of file + if (trace > 1) + htrc("XINDEX Fetch: Op=%d\n", Op); + /*********************************************************************/ /* Table read through a sorted index. */ /*********************************************************************/ @@ -1776,9 +1785,6 @@ int XINDEX::Fetch(PGLOBAL g) break; case OP_SAME: // Read next same // Logically the key values should be the same as before - if (trace > 1) - htrc("looking for next same value\n"); - if (NextVal(true)) { Op = OP_EQ; return -2; // no more equal values @@ -1824,7 +1830,7 @@ int XINDEX::Fetch(PGLOBAL g) Nth++; if (trace > 1) - htrc("Fetch: Looking for new value\n"); + htrc("Fetch: Looking for new value Nth=%d\n", Nth); Cur_K = FastFind(); @@ -1896,6 +1902,10 @@ int XINDEX::FastFind(void) sup = To_KeyCol->Ndf; } // endif Nblk + if (trace > 2) + htrc("XINDEX FastFind: Nblk=%d Op=%d inf=%d sup=%d\n", + Nblk, Op, inf, sup); + for (k = 0, kcp = To_KeyCol; kcp; kcp = kcp->Next) { while (sup - inf > 1) { i = (inf + sup) >> 1; @@ -1970,6 +1980,9 @@ int XINDEX::FastFind(void) curk = (kcp->Kof) ? kcp->Kof[kcp->Val_K] : kcp->Val_K; } // endfor kcp + if (trace > 2) + htrc("XINDEX FastFind: curk=%d\n", curk); + return curk; } // end of FastFind @@ -2043,8 +2056,7 @@ int XINDXS::GroupSize(void) #if defined(_DEBUG) assert(To_KeyCol->Val_K >= 0 && To_KeyCol->Val_K < Ndif); #endif // _DEBUG - return (Pof) ? Pof[To_KeyCol->Val_K + 1] - Pof[To_KeyCol->Val_K] - : 1; + return (Pof) ? Pof[To_KeyCol->Val_K + 1] - Pof[To_KeyCol->Val_K] : 1; } // end of GroupSize /***********************************************************************/ @@ -2106,6 +2118,9 @@ int XINDXS::Fetch(PGLOBAL g) if (Num_K == 0) return -1; // means end of file + if (trace > 1) + htrc("XINDXS Fetch: Op=%d\n", Op); + /*********************************************************************/ /* Table read through a sorted index. */ /*********************************************************************/ @@ -2120,9 +2135,6 @@ int XINDXS::Fetch(PGLOBAL g) Op = OP_NEXT; break; case OP_SAME: // Read next same - if (trace > 1) - htrc("looking for next same value\n"); - if (!Mul || NextVal(true)) { Op = OP_EQ; return -2; // No more equal values @@ -2160,7 +2172,7 @@ int XINDXS::Fetch(PGLOBAL g) Nth++; if (trace > 1) - htrc("Fetch: Looking for new value\n"); + htrc("Fetch: Looking for new value Nth=%d\n", Nth); Cur_K = FastFind(); @@ -2192,7 +2204,7 @@ int XINDXS::Fetch(PGLOBAL g) /***********************************************************************/ int XINDXS::FastFind(void) { - register int sup, inf, i= 0, n = 2; + register int sup, inf, i= 0, n = 2; register PXCOL kcp = To_KeyCol; if (Nblk && Op == OP_EQ) { @@ -2215,7 +2227,6 @@ int XINDXS::FastFind(void) if (inf < 0) return Num_K; -// i = inf; inf *= Sblk; if ((sup = inf + Sblk) > Ndif) @@ -2227,6 +2238,10 @@ int XINDXS::FastFind(void) sup = Ndif; } // endif Nblk + if (trace > 2) + htrc("XINDXS FastFind: Nblk=%d Op=%d inf=%d sup=%d\n", + Nblk, Op, inf, sup); + while (sup - inf > 1) { i = (inf + sup) >> 1; @@ -2249,6 +2264,9 @@ int XINDXS::FastFind(void) n = 0; } // endif sup + if (trace > 2) + htrc("XINDXS FastFind: n=%d i=%d\n", n, i); + // Loop on kcp because of dynamic indexing for (; kcp; kcp = kcp->Next) kcp->Val_K = i; // Used by FillValue @@ -2330,6 +2348,10 @@ bool XFILE::Open(PGLOBAL g, char *filename, int id, MODE mode) } // endif NewOff.Low = (int)ftell(Xfile); + + if (trace) + htrc("XFILE Open: NewOff.Low=%d\n", NewOff.Low); + } else if (mode == MODE_WRITE) { if (id >= 0) { // New not sep index file. Write the header. @@ -2337,6 +2359,10 @@ bool XFILE::Open(PGLOBAL g, char *filename, int id, MODE mode) Write(g, noff, sizeof(IOFF), MAX_INDX, rc); fseek(Xfile, 0, SEEK_END); NewOff.Low = (int)ftell(Xfile); + + if (trace) + htrc("XFILE Open: NewOff.Low=%d\n", NewOff.Low); + } // endif id } else if (mode == MODE_READ && id >= 0) { @@ -2346,6 +2372,9 @@ bool XFILE::Open(PGLOBAL g, char *filename, int id, MODE mode) return true; } // endif MAX_INDX + if (trace) + htrc("XFILE Open: noff[%d].Low=%d\n", id, noff[id].Low); + // Position the cursor at the offset of this index if (fseek(Xfile, noff[id].Low, SEEK_SET)) { sprintf(g->Message, MSG(FUNC_ERRNO), errno, "Xseek"); @@ -3158,12 +3187,18 @@ bool KXYCOL::InitFind(PGLOBAL g, PXOB xp) xp->Reset(); xp->Eval(g); Valp->SetValue_pval(xp->GetValue(), false); -// Valp->SetValue_pval(xp->GetValue(), !Prefix); } // endif Type + if (trace > 1) { + char buf[32]; + + htrc("KCOL InitFind: value=%s\n", Valp->GetCharString(buf)); + } // endif trace + return false; } // end of InitFind +#if 0 /***********************************************************************/ /* InitBinFind: initialize Value to the value pointed by vp. */ /***********************************************************************/ @@ -3171,6 +3206,7 @@ void KXYCOL::InitBinFind(void *vp) { Valp->SetBinValue(vp); } // end of InitBinFind +#endif // 0 /***********************************************************************/ /* KXYCOL FillValue: called by COLBLK::Eval when a column value is */ |