diff options
Diffstat (limited to 'kexi/3rdparty/kexisql/src/where.c')
-rw-r--r-- | kexi/3rdparty/kexisql/src/where.c | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/kexi/3rdparty/kexisql/src/where.c b/kexi/3rdparty/kexisql/src/where.c index 714972f8..2b94ad3c 100644 --- a/kexi/3rdparty/kexisql/src/where.c +++ b/kexi/3rdparty/kexisql/src/where.c @@ -29,14 +29,14 @@ struct ExprInfo { ** p->pLeft is not the column of any table */ short int idxRight; /* p->pRight is a column in this table number. -1 if ** p->pRight is not the column of any table */ - unsigned prereqLeft; /* Bitmask of tables referenced by p->pLeft */ - unsigned prereqRight; /* Bitmask of tables referenced by p->pRight */ - unsigned prereqAll; /* Bitmask of tables referenced by p */ + unsigned prereqLeft; /* Bittqmask of tables referenced by p->pLeft */ + unsigned prereqRight; /* Bittqmask of tables referenced by p->pRight */ + unsigned prereqAll; /* Bittqmask of tables referenced by p */ }; /* ** An instance of the following structure keeps track of a mapping -** between VDBE cursor numbers and bitmasks. The VDBE cursor numbers +** between VDBE cursor numbers and bittqmasks. The VDBE cursor numbers ** are small integers contained in SrcList_item.iCursor and Expr.iTable ** fields. For any given WHERE clause, we want to track which cursors ** are being used, so we assign a single bit in a 32-bit word to track @@ -81,12 +81,12 @@ static int exprSplit(int nSlot, ExprInfo *aSlot, Expr *pExpr){ } /* -** Initialize an expression mask set +** Initialize an expression tqmask set */ #define initMaskSet(P) memset(P, 0, sizeof(*P)) /* -** Return the bitmask for the given cursor. Assign a new bitmask +** Return the bittqmask for the given cursor. Assign a new bittqmask ** if this is the first time the cursor has been seen. */ static int getMask(ExprMaskSet *pMaskSet, int iCursor){ @@ -103,13 +103,13 @@ static int getMask(ExprMaskSet *pMaskSet, int iCursor){ } /* -** Destroy an expression mask set +** Destroy an expression tqmask set */ #define freeMaskSet(P) /* NO-OP */ /* ** This routine walks (recursively) an expression tree and generates -** a bitmask indicating which tables are used in that expression +** a bittqmask indicating which tables are used in that expression ** tree. ** ** In order for this routine to work, the calling function must have @@ -120,26 +120,26 @@ static int getMask(ExprMaskSet *pMaskSet, int iCursor){ ** the VDBE cursor number of the table. */ static int exprTableUsage(ExprMaskSet *pMaskSet, Expr *p){ - unsigned int mask = 0; + unsigned int tqmask = 0; if( p==0 ) return 0; if( p->op==TK_COLUMN ){ - mask = getMask(pMaskSet, p->iTable); - if( mask==0 ) mask = -1; - return mask; + tqmask = getMask(pMaskSet, p->iTable); + if( tqmask==0 ) tqmask = -1; + return tqmask; } if( p->pRight ){ - mask = exprTableUsage(pMaskSet, p->pRight); + tqmask = exprTableUsage(pMaskSet, p->pRight); } if( p->pLeft ){ - mask |= exprTableUsage(pMaskSet, p->pLeft); + tqmask |= exprTableUsage(pMaskSet, p->pLeft); } if( p->pList ){ int i; for(i=0; i<p->pList->nExpr; i++){ - mask |= exprTableUsage(pMaskSet, p->pList->a[i].pExpr); + tqmask |= exprTableUsage(pMaskSet, p->pList->a[i].pExpr); } } - return mask; + return tqmask; } /* @@ -302,7 +302,7 @@ static void disableTerm(WhereLevel *pLevel, Expr **ppExpr){ /* ** Generate the beginning of the loop used for WHERE clause processing. -** The return value is a pointer to an (opaque) structure that contains +** The return value is a pointer to an (opaque) structure that tqcontains ** information needed to terminate the loop. Later, the calling routine ** should invoke sqliteWhereEnd() with the return value of this function ** in order to complete the WHERE clause processing. @@ -391,7 +391,7 @@ WhereInfo *sqliteWhereBegin( int nExpr; /* Number of subexpressions in the WHERE clause */ int loopMask; /* One bit set for each outer loop */ int haveKey; /* True if KEY is on the stack */ - ExprMaskSet maskSet; /* The expression mask set */ + ExprMaskSet tqmaskSet; /* The expression tqmask set */ int iDirectEq[32]; /* Term of the form ROWID==X for the N-th table */ int iDirectLt[32]; /* Term of the form ROWID<X or ROWID<=X */ int iDirectGt[32]; /* Term of the form ROWID>X or ROWID>=X */ @@ -407,7 +407,7 @@ WhereInfo *sqliteWhereBegin( ** array fills up, the last entry might point to an expression which ** contains additional unfactored AND operators. */ - initMaskSet(&maskSet); + initMaskSet(&tqmaskSet); memset(aExpr, 0, sizeof(aExpr)); nExpr = exprSplit(ARRAYSIZE(aExpr), aExpr, pWhere); if( nExpr==ARRAYSIZE(aExpr) ){ @@ -440,24 +440,24 @@ WhereInfo *sqliteWhereBegin( /* Analyze all of the subexpressions. */ for(i=0; i<nExpr; i++){ - exprAnalyze(&maskSet, &aExpr[i]); + exprAnalyze(&tqmaskSet, &aExpr[i]); /* If we are executing a trigger body, remove all references to - ** new.* and old.* tables from the prerequisite masks. + ** new.* and old.* tables from the prerequisite tqmasks. */ if( pParse->trigStack ){ int x; if( (x = pParse->trigStack->newIdx) >= 0 ){ - int mask = ~getMask(&maskSet, x); - aExpr[i].prereqRight &= mask; - aExpr[i].prereqLeft &= mask; - aExpr[i].prereqAll &= mask; + int tqmask = ~getMask(&tqmaskSet, x); + aExpr[i].prereqRight &= tqmask; + aExpr[i].prereqLeft &= tqmask; + aExpr[i].prereqAll &= tqmask; } if( (x = pParse->trigStack->oldIdx) >= 0 ){ - int mask = ~getMask(&maskSet, x); - aExpr[i].prereqRight &= mask; - aExpr[i].prereqLeft &= mask; - aExpr[i].prereqAll &= mask; + int tqmask = ~getMask(&tqmaskSet, x); + aExpr[i].prereqRight &= tqmask; + aExpr[i].prereqLeft &= tqmask; + aExpr[i].prereqAll &= tqmask; } } } @@ -476,13 +476,13 @@ WhereInfo *sqliteWhereBegin( ** ** Actually, if there are more than 32 tables in the join, only the ** first 32 tables are candidates for indices. This is (again) due - ** to the limit of 32 bits in an integer bitmask. + ** to the limit of 32 bits in an integer bittqmask. */ loopMask = 0; for(i=0; i<pTabList->nSrc && i<ARRAYSIZE(iDirectEq); i++){ int j; int iCur = pTabList->a[i].iCursor; /* The cursor for this table */ - int mask = getMask(&maskSet, iCur); /* Cursor mask for this table */ + int tqmask = getMask(&tqmaskSet, iCur); /* Cursor tqmask for this table */ Table *pTab = pTabList->a[i].pTab; Index *pIdx; Index *pBestIdx = 0; @@ -524,7 +524,7 @@ WhereInfo *sqliteWhereBegin( } } if( iDirectEq[i]>=0 ){ - loopMask |= mask; + loopMask |= tqmask; pWInfo->a[i].pIdx = 0; continue; } @@ -651,7 +651,7 @@ WhereInfo *sqliteWhereBegin( pWInfo->a[i].pIdx = pBestIdx; pWInfo->a[i].score = bestScore; pWInfo->a[i].bRev = 0; - loopMask |= mask; + loopMask |= tqmask; if( pBestIdx ){ pWInfo->a[i].iCur = pParse->nTab++; pWInfo->peakNTab = pParse->nTab; @@ -1132,7 +1132,7 @@ WhereInfo *sqliteWhereBegin( pLevel->p1 = pLevel->iCur; pLevel->p2 = start; } - loopMask |= getMask(&maskSet, iCur); + loopMask |= getMask(&tqmaskSet, iCur); /* Insert code to test every subexpression that can be completely ** computed using the current set of tables. @@ -1179,7 +1179,7 @@ WhereInfo *sqliteWhereBegin( if( pushKey && !haveKey ){ sqliteVdbeAddOp(v, OP_Recno, pTabList->a[0].iCursor, 0); } - freeMaskSet(&maskSet); + freeMaskSet(&tqmaskSet); return pWInfo; } |