Go to the source code of this file.
Classes | |
struct | WhereTerm |
struct | WhereClause |
struct | ExprMaskSet |
Defines | |
#define | BMS (sizeof(Bitmask)*8) |
#define | WHERETRACE(X) |
#define | TERM_DYNAMIC 0x01 |
#define | TERM_VIRTUAL 0x02 |
#define | TERM_CODED 0x04 |
#define | TERM_COPIED 0x08 |
#define | TERM_OR_OK 0x10 |
#define | WO_IN 1 |
#define | WO_EQ 2 |
#define | WO_LT (WO_EQ<<(TK_LT-TK_EQ)) |
#define | WO_LE (WO_EQ<<(TK_LE-TK_EQ)) |
#define | WO_GT (WO_EQ<<(TK_GT-TK_EQ)) |
#define | WO_GE (WO_EQ<<(TK_GE-TK_EQ)) |
#define | WO_MATCH 64 |
#define | WO_ISNULL 128 |
#define | WHERE_ROWID_EQ 0x000100 |
#define | WHERE_ROWID_RANGE 0x000200 |
#define | WHERE_COLUMN_EQ 0x001000 |
#define | WHERE_COLUMN_RANGE 0x002000 |
#define | WHERE_COLUMN_IN 0x004000 |
#define | WHERE_TOP_LIMIT 0x010000 |
#define | WHERE_BTM_LIMIT 0x020000 |
#define | WHERE_IDX_ONLY 0x080000 |
#define | WHERE_ORDERBY 0x100000 |
#define | WHERE_REVERSE 0x200000 |
#define | WHERE_UNIQUE 0x400000 |
#define | WHERE_VIRTUALTABLE 0x800000 |
#define | initMaskSet(P) memset(P, 0, sizeof(*P)) |
#define | SWAP(TYPE, A, B) {TYPE t=A; A=B; B=t;} |
#define | TRACE_IDX_INPUTS(A) |
#define | TRACE_IDX_OUTPUTS(A) |
Typedefs | |
typedef struct WhereClause | WhereClause |
typedef struct ExprMaskSet | ExprMaskSet |
typedef struct WhereTerm | WhereTerm |
Functions | |
static void | whereClauseInit (WhereClause *pWC, Parse *pParse, ExprMaskSet *pMaskSet) |
static void | whereClauseClear (WhereClause *pWC) |
static int | whereClauseInsert (WhereClause *pWC, Expr *p, int flags) |
static void | whereSplit (WhereClause *pWC, Expr *pExpr, int op) |
static Bitmask | getMask (ExprMaskSet *pMaskSet, int iCursor) |
static void | createMask (ExprMaskSet *pMaskSet, int iCursor) |
static Bitmask | exprListTableUsage (ExprMaskSet *, ExprList *) |
static Bitmask | exprSelectTableUsage (ExprMaskSet *, Select *) |
static Bitmask | exprTableUsage (ExprMaskSet *pMaskSet, Expr *p) |
static int | allowedOp (int op) |
static void | exprCommute (Parse *pParse, Expr *pExpr) |
static int | operatorMask (int op) |
static WhereTerm * | findTerm (WhereClause *pWC, int iCur, int iColumn, Bitmask notReady, u16 op, Index *pIdx) |
static void | exprAnalyze (SrcList *, WhereClause *, int) |
static void | exprAnalyzeAll (SrcList *pTabList, WhereClause *pWC) |
static int | isLikeOrGlob (Parse *pParse, Expr *pExpr, int *pnPattern, int *pisComplete, int *pnoCase) |
static int | isMatchOfColumn (Expr *pExpr) |
static void | transferJoinMarkings (Expr *pDerived, Expr *pBase) |
static int | orTermIsOptCandidate (WhereTerm *pOrTerm, int iCursor, int iColumn) |
static int | orTermHasOkDuplicate (WhereClause *pOr, WhereTerm *pOrTerm) |
static int | referencesOtherTables (ExprList *pList, ExprMaskSet *pMaskSet, int iFirst, int iBase) |
static int | isSortingIndex (Parse *pParse, ExprMaskSet *pMaskSet, Index *pIdx, int base, ExprList *pOrderBy, int nEqCol, int *pbRev) |
static int | sortableByRowid (int base, ExprList *pOrderBy, ExprMaskSet *pMaskSet, int *pbRev) |
static double | estLog (double N) |
static double | bestVirtualIndex (Parse *pParse, WhereClause *pWC, struct SrcList_item *pSrc, Bitmask notReady, ExprList *pOrderBy, int orderByUsable, sqlite3_index_info **ppIdxInfo) |
static double | bestIndex (Parse *pParse, WhereClause *pWC, struct SrcList_item *pSrc, Bitmask notReady, ExprList *pOrderBy, Index **ppIndex, int *pFlags, int *pnEq) |
static void | disableTerm (WhereLevel *pLevel, WhereTerm *pTerm) |
static void | codeApplyAffinity (Parse *pParse, int base, int n, Index *pIdx) |
static int | codeEqualityTerm (Parse *pParse, WhereTerm *pTerm, WhereLevel *pLevel, int iTarget) |
static int | codeAllEqualityTerms (Parse *pParse, WhereLevel *pLevel, WhereClause *pWC, Bitmask notReady, int nExtraReg) |
static void | whereInfoFree (sqlite3 *db, WhereInfo *pWInfo) |
WhereInfo * | sqlite3WhereBegin (Parse *pParse, SrcList *pTabList, Expr *pWhere, ExprList **ppOrderBy, u8 wflags) |
void | sqlite3WhereEnd (WhereInfo *pWInfo) |
#define BMS (sizeof(Bitmask)*8) |
Definition at line 26 of file where.c.
Referenced by bestIndex(), and sqlite3WhereBegin().
#define initMaskSet | ( | P | ) | memset(P, 0, sizeof(*P)) |
Definition at line 288 of file where.c.
Referenced by sqlite3WhereBegin().
#define TERM_CODED 0x04 |
Definition at line 97 of file where.c.
Referenced by codeAllEqualityTerms(), disableTerm(), and sqlite3WhereBegin().
#define TERM_COPIED 0x08 |
Definition at line 98 of file where.c.
Referenced by exprAnalyze(), and orTermHasOkDuplicate().
#define TERM_DYNAMIC 0x01 |
Definition at line 95 of file where.c.
Referenced by exprAnalyze(), whereClauseClear(), and whereClauseInsert().
#define TERM_OR_OK 0x10 |
Definition at line 99 of file where.c.
Referenced by exprAnalyze(), and orTermHasOkDuplicate().
#define TERM_VIRTUAL 0x02 |
Definition at line 96 of file where.c.
Referenced by exprAnalyze(), orTermHasOkDuplicate(), and sqlite3WhereBegin().
#define TRACE_IDX_INPUTS | ( | A | ) |
Definition at line 1234 of file where.c.
Referenced by bestVirtualIndex().
#define TRACE_IDX_OUTPUTS | ( | A | ) |
Definition at line 1235 of file where.c.
Referenced by bestVirtualIndex().
#define WHERE_BTM_LIMIT 0x020000 |
Definition at line 177 of file where.c.
Referenced by bestIndex(), and sqlite3WhereBegin().
#define WHERE_COLUMN_EQ 0x001000 |
Definition at line 173 of file where.c.
Referenced by bestIndex(), and sqlite3WhereBegin().
#define WHERE_COLUMN_IN 0x004000 |
Definition at line 175 of file where.c.
Referenced by bestIndex().
#define WHERE_COLUMN_RANGE 0x002000 |
Definition at line 174 of file where.c.
Referenced by bestIndex(), and sqlite3WhereBegin().
#define WHERE_IDX_ONLY 0x080000 |
Definition at line 178 of file where.c.
Referenced by bestIndex(), sqlite3WhereBegin(), and sqlite3WhereEnd().
#define WHERE_ORDERBY 0x100000 |
Definition at line 179 of file where.c.
Referenced by bestIndex(), and sqlite3WhereBegin().
#define WHERE_REVERSE 0x200000 |
Definition at line 180 of file where.c.
Referenced by bestIndex(), and sqlite3WhereBegin().
#define WHERE_ROWID_EQ 0x000100 |
Definition at line 171 of file where.c.
Referenced by bestIndex(), and sqlite3WhereBegin().
#define WHERE_ROWID_RANGE 0x000200 |
Definition at line 172 of file where.c.
Referenced by bestIndex(), and sqlite3WhereBegin().
#define WHERE_TOP_LIMIT 0x010000 |
Definition at line 176 of file where.c.
Referenced by bestIndex(), and sqlite3WhereBegin().
#define WHERE_UNIQUE 0x400000 |
Definition at line 181 of file where.c.
Referenced by bestIndex(), and sqlite3WhereBegin().
#define WHERE_VIRTUALTABLE 0x800000 |
Definition at line 182 of file where.c.
Referenced by sqlite3WhereBegin().
#define WHERETRACE | ( | X | ) |
Definition at line 37 of file where.c.
Referenced by bestIndex(), bestVirtualIndex(), and sqlite3WhereBegin().
#define WO_EQ 2 |
Definition at line 152 of file where.c.
Referenced by bestIndex(), bestVirtualIndex(), exprAnalyze(), operatorMask(), orTermIsOptCandidate(), and sqlite3WhereBegin().
#define WO_GE (WO_EQ<<(TK_GE-TK_EQ)) |
Definition at line 156 of file where.c.
Referenced by bestIndex(), bestVirtualIndex(), operatorMask(), and sqlite3WhereBegin().
#define WO_GT (WO_EQ<<(TK_GT-TK_EQ)) |
Definition at line 155 of file where.c.
Referenced by bestIndex(), bestVirtualIndex(), operatorMask(), and sqlite3WhereBegin().
#define WO_IN 1 |
Definition at line 151 of file where.c.
Referenced by bestIndex(), bestVirtualIndex(), codeAllEqualityTerms(), operatorMask(), and sqlite3WhereBegin().
#define WO_ISNULL 128 |
Definition at line 158 of file where.c.
Referenced by bestIndex(), bestVirtualIndex(), codeAllEqualityTerms(), findTerm(), and operatorMask().
#define WO_LE (WO_EQ<<(TK_LE-TK_EQ)) |
Definition at line 154 of file where.c.
Referenced by bestIndex(), bestVirtualIndex(), operatorMask(), and sqlite3WhereBegin().
#define WO_LT (WO_EQ<<(TK_LT-TK_EQ)) |
Definition at line 153 of file where.c.
Referenced by bestIndex(), bestVirtualIndex(), operatorMask(), and sqlite3WhereBegin().
#define WO_MATCH 64 |
Definition at line 157 of file where.c.
Referenced by bestVirtualIndex(), and exprAnalyze().
typedef struct ExprMaskSet ExprMaskSet |
typedef struct WhereClause WhereClause |
static int allowedOp | ( | int | op | ) | [static] |
Definition at line 374 of file where.c.
References TK_EQ, TK_GE, TK_GT, TK_IN, TK_ISNULL, TK_LE, and TK_LT.
Referenced by exprAnalyze(), exprCommute(), and operatorMask().
static double bestIndex | ( | Parse * | pParse, | |
WhereClause * | pWC, | |||
struct SrcList_item * | pSrc, | |||
Bitmask | notReady, | |||
ExprList * | pOrderBy, | |||
Index ** | ppIndex, | |||
int * | pFlags, | |||
int * | pnEq | |||
) | [static] |
Definition at line 1487 of file where.c.
References Index::aiColumn, Index::aiRowEst, ALWAYS, BMS, WhereTerm::eOperator, estLog(), findTerm(), isSortingIndex(), JT_LEFT, Index::nColumn, ExprList::nExpr, OE_None, Index::onError, WhereTerm::pExpr, Expr::pList, WhereClause::pMaskSet, Index::pNext, Expr::pSelect, sortableByRowid(), SQLITE_BIG_DBL, WHERE_BTM_LIMIT, WHERE_COLUMN_EQ, WHERE_COLUMN_IN, WHERE_COLUMN_RANGE, WHERE_IDX_ONLY, WHERE_ORDERBY, WHERE_REVERSE, WHERE_ROWID_EQ, WHERE_ROWID_RANGE, WHERE_TOP_LIMIT, WHERE_UNIQUE, WHERETRACE, WO_EQ, WO_GE, WO_GT, WO_IN, WO_ISNULL, WO_LE, WO_LT, and Index::zName.
Referenced by CPosModuleStatAo::ChooseBestPositionerL(), and sqlite3WhereBegin().
static double bestVirtualIndex | ( | Parse * | pParse, | |
WhereClause * | pWC, | |||
struct SrcList_item * | pSrc, | |||
Bitmask | notReady, | |||
ExprList * | pOrderBy, | |||
int | orderByUsable, | |||
sqlite3_index_info ** | ppIdxInfo | |||
) | [static] |
Definition at line 1255 of file where.c.
References ExprList::a, WhereClause::a, sqlite3_index_info::aConstraint, sqlite3_index_info::aConstraintUsage, sqlite3_index_info::aOrderBy, Table::azModuleArg, Parse::db, WhereTerm::eOperator, sqlite3_index_info::estimatedCost, Expr::iColumn, sqlite3_index_info::idxNum, sqlite3_index_info::idxStr, Expr::iTable, WhereTerm::leftColumn, WhereTerm::leftCursor, sqlite3::mallocFailed, sqlite3_index_info::nConstraint, sqlite3_index_info::needToFreeIdxStr, ExprList::nExpr, sqlite3_index_info::nOrderBy, Expr::op, sqlite3_index_info::orderByConsumed, ExprList::ExprList_item::pExpr, sqlite3_vtab::pModule, WhereTerm::prereqRight, Table::pVtab, ExprList::ExprList_item::sortOrder, sqlite3_free(), sqlite3DbFree(), sqlite3DbMallocZero(), sqlite3ErrorMsg(), sqlite3ErrStr(), sqlite3SafetyOff, sqlite3SafetyOn, SQLITE_BIG_DBL, SQLITE_INDEX_CONSTRAINT_EQ, SQLITE_INDEX_CONSTRAINT_GE, SQLITE_INDEX_CONSTRAINT_GT, SQLITE_INDEX_CONSTRAINT_LE, SQLITE_INDEX_CONSTRAINT_LT, SQLITE_INDEX_CONSTRAINT_MATCH, SQLITE_NOMEM, SQLITE_OK, testcase, TK_COLUMN, TRACE_IDX_INPUTS, TRACE_IDX_OUTPUTS, sqlite3_index_info::sqlite3_index_constraint::usable, WHERETRACE, WO_EQ, WO_GE, WO_GT, WO_IN, WO_ISNULL, WO_LE, WO_LT, WO_MATCH, sqlite3_module::xBestIndex, sqlite3_vtab::zErrMsg, and Table::zName.
Referenced by sqlite3WhereBegin().
static int codeAllEqualityTerms | ( | Parse * | pParse, | |
WhereLevel * | pLevel, | |||
WhereClause * | pWC, | |||
Bitmask | notReady, | |||
int | nExtraReg | |||
) | [static] |
Definition at line 1872 of file where.c.
References Index::aiColumn, WhereLevel::brk, codeEqualityTerm(), WhereTerm::eOperator, findTerm(), WhereTerm::flags, WhereLevel::flags, WhereLevel::iMem, WhereLevel::iTabCur, Index::nColumn, WhereLevel::nEq, NEVER, Parse::nMem, OP_IsNull, OP_SCopy, WhereLevel::pIdx, Parse::pVdbe, sqlite3VdbeAddOp2(), TERM_CODED, testcase, WO_IN, and WO_ISNULL.
Referenced by sqlite3WhereBegin().
Definition at line 1774 of file where.c.
References OP_Affinity, Parse::pVdbe, sqlite3ExprCacheAffinityChange(), sqlite3IndexAffinityStr(), and sqlite3VdbeAddOp2().
Referenced by sqlite3WhereBegin().
static int codeEqualityTerm | ( | Parse * | pParse, | |
WhereTerm * | pTerm, | |||
WhereLevel * | pLevel, | |||
int | iTarget | |||
) | [static] |
Definition at line 1796 of file where.c.
References WhereLevel::aInLoop, Parse::db, disableTerm(), IN_INDEX_ROWID, Expr::iTable, Token::n, WhereLevel::nIn, WhereLevel::nxt, Expr::op, OP_Column, OP_IsNull, OP_Null, OP_Rewind, OP_Rowid, WhereTerm::pExpr, Expr::pRight, Parse::pVdbe, Expr::span, sqlite3DbReallocOrFree(), sqlite3ExprCodeTarget(), sqlite3FindInIndex(), sqlite3VdbeAddOp1(), sqlite3VdbeAddOp2(), sqlite3VdbeAddOp3(), sqlite3VdbeMakeLabel(), TK_EQ, TK_IN, TK_ISNULL, VdbeComment, and Token::z.
Referenced by codeAllEqualityTerms(), and sqlite3WhereBegin().
static void createMask | ( | ExprMaskSet * | pMaskSet, | |
int | iCursor | |||
) | [static] |
Definition at line 312 of file where.c.
References ArraySize, ExprMaskSet::ix, and ExprMaskSet::n.
Referenced by sqlite3WhereBegin().
static void disableTerm | ( | WhereLevel * | pLevel, | |
WhereTerm * | pTerm | |||
) | [static] |
Definition at line 1755 of file where.c.
References WhereClause::a, ALWAYS, EP_FromJoin, ExprHasProperty, WhereTerm::flags, WhereLevel::iLeftJoin, WhereTerm::iParent, WhereTerm::nChild, WhereTerm::pExpr, WhereTerm::pWC, and TERM_CODED.
Referenced by codeEqualityTerm(), and sqlite3WhereBegin().
static double estLog | ( | double | N | ) | [static] |
Definition at line 1184 of file where.c.
Referenced by bestIndex().
static void exprAnalyze | ( | SrcList * | pSrc, | |
WhereClause * | pWC, | |||
int | idxTerm | |||
) | [static] |
Definition at line 719 of file where.c.
References ExprList::a, WhereClause::a, allowedOp(), Parse::db, db, Token::dyn, WhereTerm::eOperator, EP_Dequoted, EP_FromJoin, exprAnalyzeAll(), exprCommute(), ExprHasProperty, exprListTableUsage(), exprSelectTableUsage(), exprTableUsage(), Expr::flags, WhereTerm::flags, getMask(), Expr::iColumn, WhereTerm::iParent, Expr::iRightJoinTable, isLikeOrGlob(), isMatchOfColumn(), Expr::iTable, WhereTerm::leftColumn, WhereTerm::leftCursor, sqlite3::mallocFailed, Token::n, WhereTerm::nChild, ExprList::nExpr, WhereClause::nTerm, Expr::op, operatorMask(), orTermHasOkDuplicate(), orTermIsOptCandidate(), ExprList::ExprList_item::pExpr, WhereTerm::pExpr, Expr::pLeft, Expr::pList, WhereClause::pMaskSet, WhereClause::pParse, WhereTerm::prereqAll, WhereTerm::prereqRight, Expr::pRight, Expr::pSelect, sqlite3Expr(), sqlite3ExprDelete(), sqlite3ExprDup(), sqlite3ExprListAppend(), sqlite3ExprListDelete(), sqlite3PExpr(), sqlite3TokenCopy(), sqlite3UpperToLower, TERM_COPIED, TERM_DYNAMIC, TERM_OR_OK, TERM_VIRTUAL, TK_BETWEEN, TK_COLUMN, TK_GE, TK_IN, TK_ISNULL, TK_LE, TK_LT, TK_MATCH, TK_OR, TK_STRING, Expr::token, transferJoinMarkings(), whereClauseClear(), whereClauseInit(), whereClauseInsert(), whereSplit(), WO_EQ, WO_MATCH, and Token::z.
Referenced by exprAnalyzeAll().
static void exprAnalyzeAll | ( | SrcList * | pTabList, | |
WhereClause * | pWC | |||
) | [static] |
Definition at line 504 of file where.c.
References exprAnalyze(), and WhereClause::nTerm.
Referenced by exprAnalyze(), and sqlite3WhereBegin().
Definition at line 399 of file where.c.
References allowedOp(), EP_ExpCollate, Expr::flags, Expr::op, Expr::pColl, Expr::pLeft, Expr::pRight, sqlite3ExprCollSeq(), SWAP, TK_EQ, TK_GE, TK_GT, TK_IN, TK_LE, and TK_LT.
Referenced by exprAnalyze().
static Bitmask exprListTableUsage | ( | ExprMaskSet * | pMaskSet, | |
ExprList * | pList | |||
) | [static] |
Definition at line 346 of file where.c.
References ExprList::a, exprTableUsage(), ExprList::nExpr, and ExprList::ExprList_item::pExpr.
Referenced by exprAnalyze(), exprSelectTableUsage(), and exprTableUsage().
static Bitmask exprSelectTableUsage | ( | ExprMaskSet * | pMaskSet, | |
Select * | pS | |||
) | [static] |
Definition at line 356 of file where.c.
References exprListTableUsage(), exprTableUsage(), Select::pEList, Select::pGroupBy, Select::pHaving, Select::pOrderBy, Select::pPrior, and Select::pWhere.
Referenced by exprAnalyze(), and exprTableUsage().
static Bitmask exprTableUsage | ( | ExprMaskSet * | pMaskSet, | |
Expr * | p | |||
) | [static] |
Definition at line 333 of file where.c.
References exprListTableUsage(), exprSelectTableUsage(), getMask(), Expr::iTable, Expr::op, Expr::pLeft, Expr::pList, Expr::pRight, Expr::pSelect, and TK_COLUMN.
Referenced by exprAnalyze(), exprListTableUsage(), exprSelectTableUsage(), and referencesOtherTables().
static WhereTerm* findTerm | ( | WhereClause * | pWC, | |
int | iCur, | |||
int | iColumn, | |||
Bitmask | notReady, | |||
u16 | op, | |||
Index * | pIdx | |||
) | [static] |
Definition at line 448 of file where.c.
References WhereClause::a, Table::aCol, Column::affinity, Index::aiColumn, Index::azColl, Parse::db, WhereTerm::eOperator, WhereTerm::leftColumn, WhereTerm::leftCursor, Index::nColumn, NEVER, WhereClause::nTerm, sqlite3::pDfltColl, WhereTerm::pExpr, Expr::pLeft, WhereClause::pParse, WhereTerm::prereqRight, Expr::pRight, Index::pTable, sqlite3BinaryCompareCollSeq(), sqlite3IndexAffinityOk(), sqlite3StrICmp(), WO_ISNULL, and CollSeq::zName.
Referenced by bestIndex(), codeAllEqualityTerms(), and sqlite3WhereBegin().
static Bitmask getMask | ( | ExprMaskSet * | pMaskSet, | |
int | iCursor | |||
) | [static] |
Definition at line 294 of file where.c.
References ExprMaskSet::ix, and ExprMaskSet::n.
Referenced by exprAnalyze(), exprTableUsage(), referencesOtherTables(), and sqlite3WhereBegin().
static int isLikeOrGlob | ( | Parse * | pParse, | |
Expr * | pExpr, | |||
int * | pnPattern, | |||
int * | pisComplete, | |||
int * | pnoCase | |||
) | [static] |
Definition at line 523 of file where.c.
References ExprList::a, Parse::db, db, Expr::iColumn, Expr::op, sqlite3::pDfltColl, ExprList::ExprList_item::pExpr, Expr::pList, sqlite3DequoteExpr(), sqlite3ExprCollSeq(), sqlite3IsLikeFunction(), SQLITE_COLL_BINARY, SQLITE_COLL_NOCASE, TK_COLUMN, TK_REGISTER, TK_STRING, Expr::token, CollSeq::type, and Token::z.
Referenced by exprAnalyze().
static int isMatchOfColumn | ( | Expr * | pExpr | ) | [static] |
Definition at line 588 of file where.c.
References ExprList::a, Token::n, ExprList::nExpr, Expr::op, ExprList::ExprList_item::pExpr, Expr::pList, sqlite3StrNICmp(), TK_COLUMN, TK_FUNCTION, Expr::token, and Token::z.
Referenced by exprAnalyze().
static int isSortingIndex | ( | Parse * | pParse, | |
ExprMaskSet * | pMaskSet, | |||
Index * | pIdx, | |||
int | base, | |||
ExprList * | pOrderBy, | |||
int | nEqCol, | |||
int * | pbRev | |||
) | [static] |
Definition at line 1036 of file where.c.
References ExprList::a, Index::aiColumn, Index::aSortOrder, Index::azColl, Parse::db, db, Expr::iColumn, Table::iPKey, Expr::iTable, Index::nColumn, ExprList::nExpr, OE_None, Index::onError, Expr::op, sqlite3::pDfltColl, Index::pTable, referencesOtherTables(), sqlite3ExprCollSeq(), sqlite3StrICmp(), TK_COLUMN, and CollSeq::zName.
Referenced by bestIndex().
static int operatorMask | ( | int | op | ) | [static] |
static int orTermHasOkDuplicate | ( | WhereClause * | pOr, | |
WhereTerm * | pOrTerm | |||
) | [static] |
Definition at line 689 of file where.c.
References WhereClause::a, WhereTerm::flags, WhereTerm::iParent, TERM_COPIED, TERM_OR_OK, and TERM_VIRTUAL.
Referenced by exprAnalyze().
static int orTermIsOptCandidate | ( | WhereTerm * | pOrTerm, | |
int | iCursor, | |||
int | iColumn | |||
) | [static] |
Definition at line 645 of file where.c.
References WhereTerm::eOperator, WhereTerm::leftColumn, WhereTerm::leftCursor, WhereTerm::pExpr, Expr::pLeft, Expr::pRight, sqlite3ExprAffinity(), and WO_EQ.
Referenced by exprAnalyze().
static int referencesOtherTables | ( | ExprList * | pList, | |
ExprMaskSet * | pMaskSet, | |||
int | iFirst, | |||
int | iBase | |||
) | [static] |
Definition at line 1001 of file where.c.
References ExprList::a, exprTableUsage(), getMask(), and ExprList::ExprList_item::pExpr.
Referenced by isSortingIndex(), and sortableByRowid().
static int sortableByRowid | ( | int | base, | |
ExprList * | pOrderBy, | |||
ExprMaskSet * | pMaskSet, | |||
int * | pbRev | |||
) | [static] |
Definition at line 1158 of file where.c.
References ExprList::a, Expr::iColumn, Expr::iTable, ExprList::nExpr, Expr::op, ExprList::ExprList_item::pExpr, referencesOtherTables(), ExprList::ExprList_item::sortOrder, and TK_COLUMN.
Referenced by bestIndex().
WhereInfo* sqlite3WhereBegin | ( | Parse * | pParse, | |
SrcList * | pTabList, | |||
Expr * | pWhere, | |||
ExprList ** | ppOrderBy, | |||
u8 | wflags | |||
) |
Definition at line 2037 of file where.c.
References ExprList::a, WhereClause::a, WhereInfo::a, SrcList::a, sqlite3_index_info::aConstraint, sqlite3_index_info::aConstraintUsage, Index::aiColumn, WhereLevel::aInLoop, Index::aSortOrder, bestIndex(), bestVirtualIndex(), BMS, WhereLevel::brk, codeAllEqualityTerms(), codeApplyAffinity(), codeEqualityTerm(), WhereLevel::cont, createMask(), Parse::db, db, Parse::disableColCache, disableTerm(), WhereTerm::eOperator, EP_FromJoin, Parse::explain, exprAnalyzeAll(), ExprHasProperty, findTerm(), WhereTerm::flags, WhereLevel::flags, getMask(), WhereInfo::iBreak, Expr::iColumn, WhereInfo::iContinue, SrcList::SrcList_item::iCursor, sqlite3_index_info::idxNum, sqlite3_index_info::idxStr, WhereLevel::iFrom, WhereLevel::iIdxCur, WhereLevel::iLeftJoin, WhereLevel::iMem, initMaskSet, IsVirtual, WhereLevel::iTabCur, WhereInfo::iTop, JT_CROSS, JT_LEFT, WhereTerm::leftCursor, sqlite3::mallocFailed, Table::nCol, Index::nColumn, sqlite3_index_info::nConstraint, sqlite3_index_info::needToFreeIdxStr, WhereLevel::nEq, ExprList::nExpr, WhereLevel::nIn, WhereInfo::nLevel, Parse::nMem, SrcList::nSrc, Parse::nTab, WhereClause::nTerm, WhereLevel::nxt, WhereInfo::okOnePass, Expr::op, WhereLevel::op, OP_Column, OP_Explain, OP_ForceInt, OP_Ge, OP_Gt, OP_IdxGE, OP_IdxLT, OP_IdxRowid, OP_Integer, OP_IsNull, OP_Last, OP_Le, OP_Lt, OP_MoveGe, OP_MoveGt, OP_MoveLe, OP_MoveLt, OP_MustBeInt, OP_Next, OP_Noop, OP_NotExists, OP_Null, OP_OpenRead, OP_OpenWrite, OP_Prev, OP_Rewind, OP_Rowid, OP_SetNumColumns, OP_VFilter, OP_VNext, OP_VOpen, sqlite3_index_info::orderByConsumed, WhereLevel::p1, WhereLevel::p2, P4_DYNAMIC, P4_INT32, P4_KEYINFO_HANDOFF, P4_MPRINTF, P4_STATIC, P4_VTAB, WhereLevel::p5, WhereLevel::pBestIdx, ExprList::ExprList_item::pExpr, WhereTerm::pExpr, WhereLevel::pIdx, WhereLevel::pIdxInfo, SrcList::SrcList_item::pIndex, WhereInfo::pParse, WhereTerm::prereqAll, Expr::pRight, Index::pSchema, Table::pSchema, Table::pSelect, WhereInfo::pTabList, Parse::pVdbe, Table::pVtab, sqlite3CodeVerifySchema(), sqlite3DbMallocZero(), sqlite3ErrorMsg(), sqlite3ExprClearColumnCache(), sqlite3ExprCode(), sqlite3ExprCodeConstants(), sqlite3ExprIfFalse(), sqlite3ExprIsConstantNotJoin(), sqlite3GetTempRange(), sqlite3GetTempReg(), sqlite3IndexKeyinfo(), sqlite3MAppendf(), sqlite3MPrintf(), sqlite3OpenTable(), sqlite3ReleaseTempRange(), sqlite3ReleaseTempReg(), sqlite3SchemaToIndex(), sqlite3TableLock(), sqlite3VdbeAddOp2(), sqlite3VdbeAddOp3(), sqlite3VdbeAddOp4(), sqlite3VdbeChangeP2(), sqlite3VdbeChangeP5(), sqlite3VdbeCurrentAddr(), sqlite3VdbeMakeLabel(), SQLITE_AFF_NUMERIC, SQLITE_BIG_DBL, SQLITE_INT_TO_PTR, SQLITE_JUMPIFNULL, SQLITE_SO_ASC, SQLITE_STMTSTATUS_FULLSCAN_STEP, SWAP, Table::tabFlags, TERM_CODED, TERM_VIRTUAL, testcase, TF_Ephemeral, TK_AND, TK_GT, TK_LE, TK_LT, Index::tnum, Table::tnum, WhereLevel::top, VdbeComment, WHERE_BTM_LIMIT, WHERE_COLUMN_EQ, WHERE_COLUMN_RANGE, WHERE_IDX_ONLY, WHERE_ONEPASS_DESIRED, WHERE_ORDERBY, WHERE_ORDERBY_MIN, WHERE_REVERSE, WHERE_ROWID_EQ, WHERE_ROWID_RANGE, WHERE_TOP_LIMIT, WHERE_UNIQUE, WHERE_VIRTUALTABLE, whereClauseClear(), whereClauseInit(), whereInfoFree(), whereSplit(), WHERETRACE, WO_EQ, WO_GE, WO_GT, WO_IN, WO_LE, WO_LT, SrcList::SrcList_item::zAlias, Table::zName, and Index::zName.
Referenced by sqlite3DeleteFrom(), sqlite3Select(), and sqlite3Update().
void sqlite3WhereEnd | ( | WhereInfo * | pWInfo | ) |
Definition at line 2836 of file where.c.
References SrcList::a, WhereInfo::a, Index::aiColumn, WhereLevel::aInLoop, WhereLevel::brk, WhereLevel::cont, Parse::db, db, WhereLevel::flags, WhereInfo::iBreak, SrcList::SrcList_item::iCursor, WhereLevel::iFrom, WhereLevel::iIdxCur, WhereLevel::iLeftJoin, WhereLevel::iTabCur, WhereInfo::iTop, Index::nColumn, WhereLevel::nIn, SrcList::nSrc, WhereLevel::nxt, WhereInfo::okOnePass, WhereLevel::op, OP_Close, OP_Column, OP_Goto, OP_IdxRowid, OP_IfPos, OP_Next, OP_Noop, OP_NullRow, OP_Rowid, VdbeOp::opcode, VdbeOp::p1, WhereLevel::p1, VdbeOp::p2, WhereLevel::p2, WhereLevel::p5, WhereLevel::pIdx, WhereInfo::pParse, Table::pSelect, SrcList::SrcList_item::pTab, WhereInfo::pTabList, Parse::pVdbe, sqlite3DbFree(), sqlite3ExprClearColumnCache(), sqlite3VdbeAddOp1(), sqlite3VdbeAddOp2(), sqlite3VdbeChangeP5(), sqlite3VdbeCurrentAddr(), sqlite3VdbeGetOp(), sqlite3VdbeJumpHere(), sqlite3VdbeResolveLabel(), Table::tabFlags, TF_Ephemeral, WhereLevel::top, WHERE_IDX_ONLY, and whereInfoFree().
Referenced by sqlite3DeleteFrom(), sqlite3Select(), and sqlite3Update().
Definition at line 615 of file where.c.
References EP_FromJoin, Expr::flags, and Expr::iRightJoinTable.
Referenced by exprAnalyze().
static void whereClauseClear | ( | WhereClause * | pWC | ) | [static] |
Definition at line 203 of file where.c.
References WhereClause::a, WhereClause::aStatic, Parse::db, db, WhereTerm::flags, WhereClause::nTerm, WhereTerm::pExpr, WhereClause::pParse, sqlite3DbFree(), sqlite3ExprDelete(), and TERM_DYNAMIC.
Referenced by exprAnalyze(), and sqlite3WhereBegin().
static void whereClauseInit | ( | WhereClause * | pWC, | |
Parse * | pParse, | |||
ExprMaskSet * | pMaskSet | |||
) | [static] |
Definition at line 187 of file where.c.
References WhereClause::a, ArraySize, WhereClause::aStatic, WhereClause::nSlot, WhereClause::nTerm, WhereClause::pMaskSet, and WhereClause::pParse.
Referenced by exprAnalyze(), and sqlite3WhereBegin().
static int whereClauseInsert | ( | WhereClause * | pWC, | |
Expr * | p, | |||
int | flags | |||
) | [static] |
Definition at line 229 of file where.c.
References WhereClause::a, WhereClause::aStatic, Parse::db, db, WhereTerm::flags, WhereTerm::iParent, WhereClause::nSlot, WhereClause::nTerm, WhereTerm::pExpr, WhereClause::pParse, WhereTerm::pWC, sqlite3DbFree(), sqlite3DbMallocRaw(), sqlite3ExprDelete(), and TERM_DYNAMIC.
Referenced by exprAnalyze(), and whereSplit().
Definition at line 1934 of file where.c.
References WhereInfo::a, sqlite3_index_info::needToFreeIdxStr, WhereInfo::nLevel, WhereLevel::pIdxInfo, and sqlite3DbFree().
Referenced by sqlite3WhereBegin(), and sqlite3WhereEnd().
static void whereSplit | ( | WhereClause * | pWC, | |
Expr * | pExpr, | |||
int | op | |||
) | [static] |
Definition at line 275 of file where.c.
References Expr::op, Expr::pLeft, Expr::pRight, and whereClauseInsert().
Referenced by exprAnalyze(), and sqlite3WhereBegin().
ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:50:03 2011 by Doxygen 1.6.1