summaryrefslogtreecommitdiffstats
path: root/kexi/3rdparty/kexisql3/src/where.c
diff options
context:
space:
mode:
Diffstat (limited to 'kexi/3rdparty/kexisql3/src/where.c')
-rw-r--r--kexi/3rdparty/kexisql3/src/where.c114
1 files changed, 57 insertions, 57 deletions
diff --git a/kexi/3rdparty/kexisql3/src/where.c b/kexi/3rdparty/kexisql3/src/where.c
index 54c8402f..5ab2e4e6 100644
--- a/kexi/3rdparty/kexisql3/src/where.c
+++ b/kexi/3rdparty/kexisql3/src/where.c
@@ -21,9 +21,9 @@
#include "sqliteInt.h"
/*
-** The number of bits in a Bittqmask. "BMS" means "BitMask Size".
+** The number of bits in a Bitmask. "BMS" means "BitMask Size".
*/
-#define BMS (sizeof(Bittqmask)*8)
+#define BMS (sizeof(Bitmask)*8)
/*
** Determine the number of elements in an array.
@@ -61,20 +61,20 @@ typedef struct WhereClause WhereClause;
** where X is a column name and <op> is one of certain operators,
** then WhereTerm.leftCursor and WhereTerm.leftColumn record the
** cursor number and column number for X. WhereTerm.operator records
-** the <op> using a bittqmask encoding defined by WO_xxx below. The
-** use of a bittqmask encoding for the operator allows us to search
+** the <op> using a bitmask encoding defined by WO_xxx below. The
+** use of a bitmask encoding for the operator allows us to search
** quickly for terms that match any of several different operators.
**
** prereqRight and prereqAll record sets of cursor numbers,
** but they do so indirectly. A single ExprMaskSet structure translates
** cursor number into bits and the translated bit is stored in the prereq
** fields. The translation is used in order to maximize the number of
-** bits that will fit in a Bittqmask. The VDBE cursor numbers might be
+** bits that will fit in a Bitmask. The VDBE cursor numbers might be
** spread out over the non-negative integers. For example, the cursor
** numbers might be 3, 8, 9, 10, 20, 23, 41, and 45. The ExprMaskSet
** translates these sparse cursor numbers into consecutive integers
** beginning with 0 in order to make the best possible use of the available
-** bits in the Bittqmask. So, in the example above, the cursor numbers
+** bits in the Bitmask. So, in the example above, the cursor numbers
** would be mapped into integers 0 through 7.
*/
typedef struct WhereTerm WhereTerm;
@@ -87,8 +87,8 @@ struct WhereTerm {
u8 flags; /* Bit flags. See below */
u8 nChild; /* Number of tqchildren that must disable us */
WhereClause *pWC; /* The clause this term is part of */
- Bittqmask prereqRight; /* Bittqmask of tables used by pRight */
- Bittqmask prereqAll; /* Bittqmask of tables referenced by p */
+ Bitmask prereqRight; /* Bitmask of tables used by pRight */
+ Bitmask prereqAll; /* Bitmask of tables referenced by p */
};
/*
@@ -124,8 +124,8 @@ struct WhereClause {
** from the sparse cursor numbers into consecutive integers beginning
** with 0.
**
-** If ExprMaskSet.ix[A]==B it means that The A-th bit of a Bittqmask
-** corresponds VDBE cursor number B. The A-th bit of a bittqmask is 1<<A.
+** If ExprMaskSet.ix[A]==B it means that The A-th bit of a Bitmask
+** corresponds VDBE cursor number B. The A-th bit of a bitmask is 1<<A.
**
** For example, if the WHERE clause expression used these VDBE
** cursors: 4, 5, 8, 29, 57, 73. Then the ExprMaskSet structure
@@ -141,7 +141,7 @@ struct WhereClause {
typedef struct ExprMaskSet ExprMaskSet;
struct ExprMaskSet {
int n; /* Number of assigned cursor values */
- int ix[sizeof(Bittqmask)*8]; /* Cursor assigned to each bit */
+ int ix[sizeof(Bitmask)*8]; /* Cursor assigned to each bit */
};
@@ -258,26 +258,26 @@ static void whereSplit(WhereClause *pWC, Expr *pExpr, int op){
}
/*
-** Initialize an expression tqmask set
+** Initialize an expression mask set
*/
#define initMaskSet(P) memset(P, 0, sizeof(*P))
/*
-** Return the bittqmask for the given cursor number. Return 0 if
+** Return the bitmask for the given cursor number. Return 0 if
** iCursor is not in the set.
*/
-static Bittqmask getMask(ExprMaskSet *pMaskSet, int iCursor){
+static Bitmask getMask(ExprMaskSet *pMaskSet, int iCursor){
int i;
for(i=0; i<pMaskSet->n; i++){
if( pMaskSet->ix[i]==iCursor ){
- return ((Bittqmask)1)<<i;
+ return ((Bitmask)1)<<i;
}
}
return 0;
}
/*
-** Create a new tqmask for cursor iCursor.
+** Create a new mask for cursor iCursor.
**
** There is one cursor per table in the FROM clause. The number of
** tables in the FROM clause is limited by a test early in the
@@ -291,7 +291,7 @@ static void createMask(ExprMaskSet *pMaskSet, int iCursor){
/*
** This routine walks (recursively) an expression tree and generates
-** a bittqmask indicating which tables are used in that expression
+** a bitmask indicating which tables are used in that expression
** tree.
**
** In order for this routine to work, the calling function must have
@@ -300,46 +300,46 @@ static void createMask(ExprMaskSet *pMaskSet, int iCursor){
** The sqlite3ExprResolveNames() routines looks for column names and
** sets their opcodes to TK_COLUMN and their Expr.iTable fields to
** the VDBE cursor number of the table. This routine just has to
-** translate the cursor numbers into bittqmask values and OR all
+** translate the cursor numbers into bitmask values and OR all
** the bitmasks together.
*/
-static Bittqmask exprListTableUsage(ExprMaskSet*, ExprList*);
-static Bittqmask exprSelectTableUsage(ExprMaskSet*, Select*);
-static Bittqmask exprTableUsage(ExprMaskSet *pMaskSet, Expr *p){
- Bittqmask tqmask = 0;
+static Bitmask exprListTableUsage(ExprMaskSet*, ExprList*);
+static Bitmask exprSelectTableUsage(ExprMaskSet*, Select*);
+static Bitmask exprTableUsage(ExprMaskSet *pMaskSet, Expr *p){
+ Bitmask mask = 0;
if( p==0 ) return 0;
if( p->op==TK_COLUMN ){
- tqmask = getMask(pMaskSet, p->iTable);
- return tqmask;
+ mask = getMask(pMaskSet, p->iTable);
+ return mask;
}
- tqmask = exprTableUsage(pMaskSet, p->pRight);
- tqmask |= exprTableUsage(pMaskSet, p->pLeft);
- tqmask |= exprListTableUsage(pMaskSet, p->pList);
- tqmask |= exprSelectTableUsage(pMaskSet, p->pSelect);
- return tqmask;
+ mask = exprTableUsage(pMaskSet, p->pRight);
+ mask |= exprTableUsage(pMaskSet, p->pLeft);
+ mask |= exprListTableUsage(pMaskSet, p->pList);
+ mask |= exprSelectTableUsage(pMaskSet, p->pSelect);
+ return mask;
}
-static Bittqmask exprListTableUsage(ExprMaskSet *pMaskSet, ExprList *pList){
+static Bitmask exprListTableUsage(ExprMaskSet *pMaskSet, ExprList *pList){
int i;
- Bittqmask tqmask = 0;
+ Bitmask mask = 0;
if( pList ){
for(i=0; i<pList->nExpr; i++){
- tqmask |= exprTableUsage(pMaskSet, pList->a[i].pExpr);
+ mask |= exprTableUsage(pMaskSet, pList->a[i].pExpr);
}
}
- return tqmask;
+ return mask;
}
-static Bittqmask exprSelectTableUsage(ExprMaskSet *pMaskSet, Select *pS){
- Bittqmask tqmask;
+static Bitmask exprSelectTableUsage(ExprMaskSet *pMaskSet, Select *pS){
+ Bitmask mask;
if( pS==0 ){
- tqmask = 0;
+ mask = 0;
}else{
- tqmask = exprListTableUsage(pMaskSet, pS->pEList);
- tqmask |= exprListTableUsage(pMaskSet, pS->pGroupBy);
- tqmask |= exprListTableUsage(pMaskSet, pS->pOrderBy);
- tqmask |= exprTableUsage(pMaskSet, pS->pWhere);
- tqmask |= exprTableUsage(pMaskSet, pS->pHaving);
+ mask = exprListTableUsage(pMaskSet, pS->pEList);
+ mask |= exprListTableUsage(pMaskSet, pS->pGroupBy);
+ mask |= exprListTableUsage(pMaskSet, pS->pOrderBy);
+ mask |= exprTableUsage(pMaskSet, pS->pWhere);
+ mask |= exprTableUsage(pMaskSet, pS->pHaving);
}
- return tqmask;
+ return mask;
}
/*
@@ -379,7 +379,7 @@ static void exprCommute(Expr *pExpr){
}
/*
-** Translate from TK_xx operator to WO_xx bittqmask.
+** Translate from TK_xx operator to WO_xx bitmask.
*/
static int operatorMask(int op){
int c;
@@ -408,7 +408,7 @@ static WhereTerm *findTerm(
WhereClause *pWC, /* The WHERE clause to be searched */
int iCur, /* Cursor number of LHS */
int iColumn, /* Column number of LHS */
- Bittqmask notReady, /* RHS must not overlap with this tqmask */
+ Bitmask notReady, /* RHS must not overlap with this mask */
u16 op, /* Mask of WO_xx values describing operator */
Index *pIdx /* Must be compatible with this index, if not NULL */
){
@@ -542,8 +542,8 @@ static void exprAnalyze(
){
WhereTerm *pTerm = &pWC->a[idxTerm];
Expr *pExpr = pTerm->pExpr;
- Bittqmask prereqLeft;
- Bittqmask prereqAll;
+ Bitmask prereqLeft;
+ Bitmask prereqAll;
int nPattern;
int isComplete;
@@ -885,7 +885,7 @@ static double bestIndex(
Parse *pParse, /* The parsing context */
WhereClause *pWC, /* The WHERE clause */
struct SrcList_item *pSrc, /* The FROM clause term to search */
- Bittqmask notReady, /* Mask of cursors that are not available */
+ Bitmask notReady, /* Mask of cursors that are not available */
ExprList *pOrderBy, /* The order by clause */
Index **ppIndex, /* Make *ppIndex point to the best index */
int *pFlags, /* Put flags describing this choice in *pFlags */
@@ -1052,13 +1052,13 @@ static double bestIndex(
** ever reading the table. If that is the case, then halve the
** cost of this index.
*/
- if( flags && pSrc->colUsed < (((Bittqmask)1)<<(BMS-1)) ){
- Bittqmask m = pSrc->colUsed;
+ if( flags && pSrc->colUsed < (((Bitmask)1)<<(BMS-1)) ){
+ Bitmask m = pSrc->colUsed;
int j;
for(j=0; j<pProbe->nColumn; j++){
int x = pProbe->aiColumn[j];
if( x<BMS-1 ){
- m &= ~(((Bittqmask)1)<<x);
+ m &= ~(((Bitmask)1)<<x);
}
}
if( m==0 ){
@@ -1223,7 +1223,7 @@ static void codeAllEqualityTerms(
Parse *pParse, /* Parsing context */
WhereLevel *pLevel, /* Which nested loop of the FROM we are coding */
WhereClause *pWC, /* The WHERE clause */
- Bittqmask notReady, /* Which parts of FROM have not yet been coded */
+ Bitmask notReady, /* Which parts of FROM have not yet been coded */
int brk /* Jump here to end the loop */
){
int nEq = pLevel->nEq; /* The number of == or IN constraints to code */
@@ -1380,9 +1380,9 @@ WhereInfo *sqlite3WhereBegin(
WhereInfo *pWInfo; /* Will become the return value of this function */
Vdbe *v = pParse->pVdbe; /* The virtual database engine */
int brk, cont = 0; /* Addresses used during code generation */
- Bittqmask notReady; /* Cursors that are not yet positioned */
+ Bitmask notReady; /* Cursors that are not yet positioned */
WhereTerm *pTerm; /* A single term in the WHERE clause */
- ExprMaskSet maskSet; /* The expression tqmask set */
+ ExprMaskSet maskSet; /* The expression mask set */
WhereClause wc; /* The WHERE clause is divided into these terms */
struct SrcList_item *pTabItem; /* A single entry from pTabList */
WhereLevel *pLevel; /* A single level in the pWInfo list */
@@ -1390,7 +1390,7 @@ WhereInfo *sqlite3WhereBegin(
int andFlags; /* AND-ed combination of all wc.a[].flags */
/* The number of tables in the FROM clause is limited by the number of
- ** bits in a Bittqmask
+ ** bits in a Bitmask
*/
if( pTabList->nSrc>BMS ){
sqlite3ErrorMsg(pParse, "at most %d tables in a join", BMS);
@@ -1450,7 +1450,7 @@ WhereInfo *sqlite3WhereBegin(
** This loop also figures out the nesting order of tables in the FROM
** clause.
*/
- notReady = ~(Bittqmask)0;
+ notReady = ~(Bitmask)0;
pTabItem = pTabList->a;
pLevel = pWInfo->a;
andFlags = ~0;
@@ -1466,7 +1466,7 @@ WhereInfo *sqlite3WhereBegin(
int bestNEq = 0; /* nEq associated with pBest */
double lowestCost = 1.0e99; /* Cost of the pBest */
int bestJ; /* The value of j */
- Bittqmask m; /* Bittqmask value for j or bestJ */
+ Bitmask m; /* Bitmask value for j or bestJ */
for(j=iFrom, pTabItem=&pTabList->a[j]; j<pTabList->nSrc; j++, pTabItem++){
m = getMask(&maskSet, pTabItem->iCursor);
@@ -1566,7 +1566,7 @@ WhereInfo *sqlite3WhereBegin(
** loop below generates code for a single nested loop of the VM
** program.
*/
- notReady = ~(Bittqmask)0;
+ notReady = ~(Bitmask)0;
for(i=0, pLevel=pWInfo->a; i<pTabList->nSrc; i++, pLevel++){
int j;
int iCur = pTabItem->iCursor; /* The VDBE cursor for the table */