Go to the source code of this file.
Functions | |
static void | clearSelect (sqlite3 *db, Select *p) |
void | sqlite3SelectDestInit (SelectDest *pDest, int eDest, int iParm) |
Select * | sqlite3SelectNew (Parse *pParse, ExprList *pEList, SrcList *pSrc, Expr *pWhere, ExprList *pGroupBy, Expr *pHaving, ExprList *pOrderBy, int isDistinct, Expr *pLimit, Expr *pOffset) |
void | sqlite3SelectDelete (sqlite3 *db, Select *p) |
int | sqlite3JoinType (Parse *pParse, Token *pA, Token *pB, Token *pC) |
static int | columnIndex (Table *pTab, const char *zCol) |
static void | setToken (Token *p, const char *z) |
static void | setQuotedToken (Parse *pParse, Token *p, const char *z) |
Expr * | sqlite3CreateIdExpr (Parse *pParse, const char *zName) |
static void | addWhereTerm (Parse *pParse, const char *zCol, const Table *pTab1, const char *zAlias1, const Table *pTab2, const char *zAlias2, int iRightJoinTable, Expr **ppExpr, int isOuterJoin) |
static void | setJoinExpr (Expr *p, int iTable) |
static int | sqliteProcessJoin (Parse *pParse, Select *p) |
static void | pushOntoSorter (Parse *pParse, ExprList *pOrderBy, Select *pSelect, int regData) |
static void | codeOffset (Vdbe *v, Select *p, int iContinue) |
static void | codeDistinct (Parse *pParse, int iTab, int addrRepeat, int N, int iMem) |
static int | checkForMultiColumnSelectError (Parse *pParse, SelectDest *pDest, int nExpr) |
static void | selectInnerLoop (Parse *pParse, Select *p, ExprList *pEList, int srcTab, int nColumn, ExprList *pOrderBy, int distinct, SelectDest *pDest, int iContinue, int iBreak) |
static KeyInfo * | keyInfoFromExprList (Parse *pParse, ExprList *pList) |
static void | generateSortTail (Parse *pParse, Select *p, Vdbe *v, int nColumn, SelectDest *pDest) |
static const char * | columnType (NameContext *pNC, Expr *pExpr, const char **pzOriginDb, const char **pzOriginTab, const char **pzOriginCol) |
static void | generateColumnTypes (Parse *pParse, SrcList *pTabList, ExprList *pEList) |
static void | generateColumnNames (Parse *pParse, SrcList *pTabList, ExprList *pEList) |
static const char * | selectOpName (int id) |
static int | selectColumnsFromExprList (Parse *pParse, ExprList *pEList, int *pnCol, Column **paCol) |
static void | selectAddColumnTypeAndCollation (Parse *pParse, int nCol, Column *aCol, Select *pSelect) |
Table * | sqlite3ResultSetOfSelect (Parse *pParse, Select *pSelect) |
Vdbe * | sqlite3GetVdbe (Parse *pParse) |
static void | computeLimitRegisters (Parse *pParse, Select *p, int iBreak) |
static CollSeq * | multiSelectCollSeq (Parse *pParse, Select *p, int iCol) |
static int | multiSelectOrderBy (Parse *pParse, Select *p, SelectDest *pDest) |
static int | multiSelect (Parse *pParse, Select *p, SelectDest *pDest) |
static int | generateOutputSubroutine (Parse *pParse, Select *p, SelectDest *pIn, SelectDest *pDest, int regReturn, int regPrev, KeyInfo *pKeyInfo, int p4type, int iBreak) |
static void | substExprList (sqlite3 *, ExprList *, int, ExprList *) |
static void | substSelect (sqlite3 *, Select *, int, ExprList *) |
static void | substExpr (sqlite3 *db, Expr *pExpr, int iTable, ExprList *pEList) |
static int | flattenSubquery (Parse *pParse, Select *p, int iFrom, int isAgg, int subqueryIsAgg) |
static int | minMaxQuery (Parse *pParse, Select *p) |
int | sqlite3IndexedByLookup (Parse *pParse, struct SrcList_item *pFrom) |
static int | selectExpander (Walker *pWalker, Select *p) |
static int | exprWalkNoop (Walker *pWalker, Expr *pExpr) |
static void | sqlite3SelectExpand (Parse *pParse, Select *pSelect) |
static int | selectAddSubqueryTypeInfo (Walker *pWalker, Select *p) |
static void | sqlite3SelectAddTypeInfo (Parse *pParse, Select *pSelect) |
void | sqlite3SelectPrep (Parse *pParse, Select *p, NameContext *pOuterNC) |
static void | resetAccumulator (Parse *pParse, AggInfo *pAggInfo) |
static void | finalizeAggFunctions (Parse *pParse, AggInfo *pAggInfo) |
static void | updateAccumulator (Parse *pParse, AggInfo *pAggInfo) |
int | sqlite3Select (Parse *pParse, Select *p, SelectDest *pDest) |
static void addWhereTerm | ( | Parse * | pParse, | |
const char * | zCol, | |||
const Table * | pTab1, | |||
const char * | zAlias1, | |||
const Table * | pTab2, | |||
const char * | zAlias2, | |||
int | iRightJoinTable, | |||
Expr ** | ppExpr, | |||
int | isOuterJoin | |||
) | [static] |
Definition at line 247 of file select.c.
References Parse::db, EP_FromJoin, ExprSetProperty, Expr::iRightJoinTable, sqlite3CreateIdExpr(), sqlite3ExprAnd(), sqlite3PExpr(), TK_DOT, TK_EQ, and Table::zName.
Referenced by sqliteProcessJoin().
static int checkForMultiColumnSelectError | ( | Parse * | pParse, | |
SelectDest * | pDest, | |||
int | nExpr | |||
) | [static] |
Definition at line 501 of file select.c.
References SelectDest::eDest, sqlite3ErrorMsg(), SRT_Mem, and SRT_Set.
Referenced by selectInnerLoop(), and sqlite3Select().
Definition at line 24 of file select.c.
References Select::pEList, Select::pGroupBy, Select::pHaving, Select::pLimit, Select::pOffset, Select::pOrderBy, Select::pPrior, Select::pSrc, Select::pWhere, sqlite3ExprDelete(), sqlite3ExprListDelete(), sqlite3SelectDelete(), and sqlite3SrcListDelete().
Referenced by sqlite3SelectDelete(), and sqlite3SelectNew().
static void codeDistinct | ( | Parse * | pParse, | |
int | iTab, | |||
int | addrRepeat, | |||
int | N, | |||
int | iMem | |||
) | [static] |
Definition at line 477 of file select.c.
References OP_Found, OP_IdxInsert, OP_MakeRecord, Parse::pVdbe, sqlite3GetTempReg(), sqlite3ReleaseTempReg(), sqlite3VdbeAddOp2(), and sqlite3VdbeAddOp3().
Referenced by selectInnerLoop(), and updateAccumulator().
Definition at line 453 of file select.c.
References Select::iOffset, OP_AddImm, OP_Goto, OP_IfNeg, sqlite3VdbeAddOp1(), sqlite3VdbeAddOp2(), sqlite3VdbeJumpHere(), and VdbeComment.
Referenced by generateOutputSubroutine(), generateSortTail(), and selectInnerLoop().
static int columnIndex | ( | Table * | pTab, | |
const char * | zCol | |||
) | [static] |
Definition at line 181 of file select.c.
References Table::aCol, Table::nCol, sqlite3StrICmp(), and Column::zName.
Referenced by selectExpander(), and sqliteProcessJoin().
static const char* columnType | ( | NameContext * | pNC, | |
Expr * | pExpr, | |||
const char ** | pzOriginDb, | |||
const char ** | pzOriginTab, | |||
const char ** | pzOriginCol | |||
) | [static] |
Definition at line 893 of file select.c.
References ExprList::a, SrcList::a, Table::aCol, sqlite3::aDb, Parse::db, Expr::iColumn, SrcList::SrcList_item::iCursor, Table::iPKey, Expr::iTable, SrcList::nSrc, Expr::op, Select::pEList, ExprList::ExprList_item::pExpr, NameContext::pNext, NameContext::pParse, Table::pSchema, Expr::pSelect, SrcList::SrcList_item::pSelect, Select::pSrc, NameContext::pSrcList, SrcList::SrcList_item::pTab, sqlite3SchemaToIndex(), TK_AGG_COLUMN, TK_COLUMN, TK_SELECT, Db::zName, Table::zName, Column::zName, and Column::zType.
Referenced by generateColumnTypes(), and selectAddColumnTypeAndCollation().
Definition at line 1335 of file select.c.
References Select::iLimit, Select::iOffset, Parse::nMem, OP_Add, OP_IfPos, OP_IfZero, OP_Integer, OP_MustBeInt, Select::pLimit, Select::pOffset, sqlite3ExprCode(), sqlite3GetVdbe(), sqlite3VdbeAddOp1(), sqlite3VdbeAddOp2(), sqlite3VdbeAddOp3(), sqlite3VdbeJumpHere(), and VdbeComment.
Referenced by multiSelect(), multiSelectOrderBy(), and sqlite3Select().
Definition at line 3224 of file select.c.
References WRC_Continue.
Referenced by sqlite3SelectAddTypeInfo(), and sqlite3SelectExpand().
Definition at line 3376 of file select.c.
References AggInfo::aFunc, ExprList::nExpr, OP_AggFinal, P4_FUNCDEF, Parse::pVdbe, and sqlite3VdbeAddOp4().
Referenced by sqlite3Select().
static int flattenSubquery | ( | Parse * | pParse, | |
Select * | p, | |||
int | iFrom, | |||
int | isAgg, | |||
int | subqueryIsAgg | |||
) | [static] |
Definition at line 2554 of file select.c.
References ExprList::a, SrcList::a, Parse::db, db, ExprList::ExprList_item::iCol, SrcList::SrcList_item::iCursor, SrcList::SrcList_item::jointype, JT_OUTER, sqlite3::mallocFailed, Token::n, ExprList::nExpr, Table::nRef, SrcList::nSrc, Select::op, Select::pEList, ExprList::ExprList_item::pExpr, Select::pGroupBy, Select::pHaving, Select::pLimit, Table::pNextZombie, Select::pOffset, Select::pOrderBy, Select::pPrior, Select::pRightmost, Select::pSrc, Select::pWhere, Parse::pZombieTab, Select::selFlags, SF_Aggregate, SF_Distinct, Expr::span, sqlite3AuthCheck(), sqlite3DbFree(), sqlite3DbStrNDup(), sqlite3ExprAnd(), sqlite3ExprDup(), sqlite3ExprListDup(), sqlite3SelectDelete(), sqlite3SelectDup(), sqlite3SrcListAppend(), sqlite3SrcListEnlarge(), SQLITE_SELECT, substExpr(), substExprList(), TK_ALL, Token::z, Parse::zAuthContext, and ExprList::ExprList_item::zName.
Referenced by sqlite3Select().
Definition at line 1052 of file select.c.
References SrcList::a, ExprList::a, Table::aCol, COLNAME_NAME, Parse::colNamesSet, Parse::db, db, Parse::explain, sqlite3::flags, generateColumnTypes(), Expr::iColumn, SrcList::SrcList_item::iCursor, Table::iPKey, Expr::iTable, sqlite3::mallocFailed, Token::n, ExprList::nExpr, SrcList::nSrc, Expr::op, ExprList::ExprList_item::pExpr, SrcList::SrcList_item::pTab, Parse::pVdbe, Expr::span, sqlite3DbStrNDup(), sqlite3MPrintf(), sqlite3VdbeSetColName(), sqlite3VdbeSetNumCols(), SQLITE_DYNAMIC, SQLITE_FullColNames, SQLITE_ShortColNames, SQLITE_TRANSIENT, TK_AGG_COLUMN, TK_COLUMN, Token::z, SrcList::SrcList_item::zAlias, Table::zName, Column::zName, and ExprList::ExprList_item::zName.
Referenced by multiSelect(), multiSelectOrderBy(), and sqlite3Select().
Definition at line 1012 of file select.c.
References ExprList::a, COLNAME_COLUMN, COLNAME_DATABASE, COLNAME_DECLTYPE, COLNAME_TABLE, columnType(), ExprList::nExpr, ExprList::ExprList_item::pExpr, NameContext::pParse, NameContext::pSrcList, Parse::pVdbe, sqlite3VdbeSetColName(), and SQLITE_TRANSIENT.
Referenced by generateColumnNames().
static int generateOutputSubroutine | ( | Parse * | pParse, | |
Select * | p, | |||
SelectDest * | pIn, | |||
SelectDest * | pDest, | |||
int | regReturn, | |||
int | regPrev, | |||
KeyInfo * | pKeyInfo, | |||
int | p4type, | |||
int | iBreak | |||
) | [static] |
Definition at line 1789 of file select.c.
References ExprList::a, SelectDest::affinity, Select::affinity, codeOffset(), Parse::db, SelectDest::eDest, Select::iLimit, SelectDest::iMem, SelectDest::iParm, sqlite3::mallocFailed, SelectDest::nMem, OP_AddImm, OP_Compare, OP_IdxInsert, OP_IfNot, OP_IfZero, OP_Insert, OP_Integer, OP_Jump, OP_MakeRecord, OP_NewRowid, OP_ResultRow, OP_Return, OP_Yield, OPFLAG_APPEND, Select::pEList, ExprList::ExprList_item::pExpr, Parse::pVdbe, sqlite3CompareAffinity(), sqlite3ExprCacheAffinityChange(), sqlite3ExprCodeCopy(), sqlite3ExprCodeMove(), sqlite3GetTempRange(), sqlite3GetTempReg(), sqlite3ReleaseTempReg(), sqlite3VdbeAddOp1(), sqlite3VdbeAddOp2(), sqlite3VdbeAddOp3(), sqlite3VdbeAddOp4(), sqlite3VdbeChangeP5(), sqlite3VdbeCurrentAddr(), sqlite3VdbeJumpHere(), sqlite3VdbeMakeLabel(), sqlite3VdbeResolveLabel(), SRT_Coroutine, SRT_EphemTab, SRT_Exists, SRT_Mem, SRT_Output, SRT_Set, and SRT_Table.
Referenced by multiSelectOrderBy().
static void generateSortTail | ( | Parse * | pParse, | |
Select * | p, | |||
Vdbe * | v, | |||
int | nColumn, | |||
SelectDest * | pDest | |||
) | [static] |
Definition at line 781 of file select.c.
References Select::affinity, codeOffset(), SelectDest::eDest, ExprList::iECursor, Select::iLimit, SelectDest::iMem, SelectDest::iParm, ExprList::nExpr, Parse::nTab, OP_Close, OP_Column, OP_IdxInsert, OP_Insert, OP_Integer, OP_MakeRecord, OP_NewRowid, OP_Next, OP_OpenPseudo, OP_ResultRow, OP_SetNumColumns, OP_Sort, OP_Yield, OPFLAG_APPEND, Select::pOrderBy, sqlite3ExprCacheAffinityChange(), sqlite3ExprCodeMove(), sqlite3GetTempReg(), sqlite3ReleaseTempReg(), sqlite3VdbeAddOp1(), sqlite3VdbeAddOp2(), sqlite3VdbeAddOp3(), sqlite3VdbeAddOp4(), sqlite3VdbeChangeP5(), sqlite3VdbeMakeLabel(), sqlite3VdbeResolveLabel(), SRT_Coroutine, SRT_EphemTab, SRT_Mem, SRT_Output, SRT_Set, and SRT_Table.
Referenced by sqlite3Select().
Definition at line 748 of file select.c.
References ExprList::a, KeyInfo::aColl, KeyInfo::aSortOrder, Parse::db, db, ENC, KeyInfo::enc, ExprList::nExpr, KeyInfo::nField, sqlite3::pDfltColl, sqlite3DbMallocZero(), and sqlite3ExprCollSeq().
Referenced by resetAccumulator(), and sqlite3Select().
Definition at line 2924 of file select.c.
References ExprList::a, Token::n, ExprList::nExpr, Expr::op, Select::pEList, ExprList::ExprList_item::pExpr, Expr::pList, sqlite3StrNICmp(), TK_AGG_COLUMN, TK_AGG_FUNCTION, Expr::token, WHERE_ORDERBY_MAX, WHERE_ORDERBY_MIN, WHERE_ORDERBY_NORMAL, and Token::z.
Referenced by sqlite3Select().
static int multiSelect | ( | Parse * | pParse, | |
Select * | p, | |||
SelectDest * | pDest | |||
) | [static] |
Definition at line 1443 of file select.c.
References KeyInfo::aColl, Select::addrOpenEphm, computeLimitRegisters(), Parse::db, db, SelectDest::eDest, ENC, KeyInfo::enc, generateColumnNames(), Select::iLimit, SelectDest::iMem, Select::iOffset, SelectDest::iParm, multiSelectCollSeq(), multiSelectOrderBy(), ExprList::nExpr, KeyInfo::nField, SelectDest::nMem, Parse::nTab, Select::op, OP_Close, OP_IfZero, OP_Next, OP_NotFound, OP_OpenEphemeral, OP_Rewind, OP_RowKey, P4_KEYINFO, sqlite3::pDfltColl, Select::pEList, Select::pLimit, Select::pOffset, Select::pOrderBy, Select::pPrior, Select::pRightmost, selectInnerLoop(), selectOpName(), Select::selFlags, SF_UsesEphemeral, sqlite3DbFree(), sqlite3DbMallocZero(), sqlite3ErrorMsg(), sqlite3ExprDelete(), sqlite3ExprListDelete(), sqlite3GetTempReg(), sqlite3GetVdbe(), sqlite3ReleaseTempReg(), sqlite3Select(), sqlite3SelectDelete(), sqlite3SelectDestInit(), sqlite3VdbeAddOp1(), sqlite3VdbeAddOp2(), sqlite3VdbeAddOp3(), sqlite3VdbeChangeP2(), sqlite3VdbeChangeP4(), sqlite3VdbeCurrentAddr(), sqlite3VdbeJumpHere(), sqlite3VdbeMakeLabel(), sqlite3VdbeResolveLabel(), SQLITE_NOMEM, SQLITE_OK, SRT_EphemTab, SRT_Except, SRT_Output, SRT_Table, SRT_Union, TK_ALL, TK_EXCEPT, TK_INTERSECT, TK_UNION, and VdbeComment.
Referenced by sqlite3Select().
Definition at line 1389 of file select.c.
References ExprList::a, Select::pEList, ExprList::ExprList_item::pExpr, Select::pPrior, and sqlite3ExprCollSeq().
Referenced by multiSelect(), and multiSelectOrderBy().
static int multiSelectOrderBy | ( | Parse * | pParse, | |
Select * | p, | |||
SelectDest * | pDest | |||
) | [static] |
Definition at line 2017 of file select.c.
References ExprList::a, KeyInfo::aColl, KeyInfo::aSortOrder, computeLimitRegisters(), Parse::db, db, SelectDest::eDest, ENC, KeyInfo::enc, EP_ExpCollate, EP_IntValue, Expr::flags, generateColumnNames(), generateOutputSubroutine(), ExprList::ExprList_item::iCol, Select::iLimit, SelectDest::iMem, Select::iOffset, Expr::iTable, sqlite3::mallocFailed, multiSelectCollSeq(), ExprList::nExpr, KeyInfo::nField, Parse::nMem, Select::op, OP_Compare, OP_Copy, OP_Gosub, OP_Goto, OP_If, OP_Integer, OP_Jump, OP_Permutation, OP_Yield, P4_INTARRAY, P4_KEYINFO_HANDOFF, P4_KEYINFO_STATIC, Expr::pColl, Select::pEList, ExprList::ExprList_item::pExpr, Select::pLimit, Select::pOffset, Select::pOrderBy, Select::pPrior, Select::pRightmost, Parse::pVdbe, ExprList::ExprList_item::sortOrder, sqlite3DbMallocRaw(), sqlite3DbMallocZero(), sqlite3ExprDelete(), sqlite3ExprListAppend(), sqlite3ExprListDup(), sqlite3GetTempRange(), sqlite3PExpr(), sqlite3ReleaseTempRange(), sqlite3ResolveOrderGroupBy(), sqlite3Select(), sqlite3SelectDelete(), sqlite3SelectDestInit(), sqlite3VdbeAddOp0(), sqlite3VdbeAddOp1(), sqlite3VdbeAddOp2(), sqlite3VdbeAddOp3(), sqlite3VdbeAddOp4(), sqlite3VdbeCurrentAddr(), sqlite3VdbeJumpHere(), sqlite3VdbeMakeLabel(), sqlite3VdbeResolveLabel(), SQLITE_NOMEM, SQLITE_OK, SRT_Coroutine, SRT_Output, TK_ALL, TK_EXCEPT, TK_INTEGER, TK_INTERSECT, TK_UNION, and VdbeNoopComment.
Referenced by multiSelect().
static void pushOntoSorter | ( | Parse * | pParse, | |
ExprList * | pOrderBy, | |||
Select * | pSelect, | |||
int | regData | |||
) | [static] |
Definition at line 414 of file select.c.
References ExprList::iECursor, Select::iLimit, Select::iOffset, ExprList::nExpr, OP_AddImm, OP_Delete, OP_Goto, OP_IdxInsert, OP_IfZero, OP_Last, OP_MakeRecord, OP_Sequence, Parse::pVdbe, sqlite3ExprCodeExprList(), sqlite3ExprCodeMove(), sqlite3GetTempRange(), sqlite3GetTempReg(), sqlite3ReleaseTempRange(), sqlite3ReleaseTempReg(), sqlite3VdbeAddOp0(), sqlite3VdbeAddOp1(), sqlite3VdbeAddOp2(), sqlite3VdbeAddOp3(), and sqlite3VdbeJumpHere().
Referenced by selectInnerLoop().
Definition at line 3345 of file select.c.
References AggInfo::aCol, AggInfo::aFunc, AggInfo::AggInfo_col::iMem, keyInfoFromExprList(), AggInfo::nColumn, ExprList::nExpr, AggInfo::nFunc, OP_Null, OP_OpenEphemeral, P4_KEYINFO_HANDOFF, Expr::pList, Parse::pVdbe, sqlite3ErrorMsg(), sqlite3VdbeAddOp2(), and sqlite3VdbeAddOp4().
Referenced by sqlite3Select().
static void selectAddColumnTypeAndCollation | ( | Parse * | pParse, | |
int | nCol, | |||
Column * | aCol, | |||
Select * | pSelect | |||
) | [static] |
Definition at line 1234 of file select.c.
References ExprList::a, Column::affinity, columnType(), Parse::db, db, sqlite3::mallocFailed, ExprList::nExpr, Select::pEList, Select::pSrc, NameContext::pSrcList, Select::selFlags, SF_Resolved, sqlite3DbStrDup(), sqlite3ExprAffinity(), sqlite3ExprCollSeq(), Column::zColl, CollSeq::zName, and Column::zType.
Referenced by selectAddSubqueryTypeInfo(), and sqlite3ResultSetOfSelect().
Definition at line 3264 of file select.c.
References SrcList::a, Table::aCol, Table::nCol, Walker::pParse, Select::pPrior, Select::pSrc, selectAddColumnTypeAndCollation(), Select::selFlags, SF_HasTypeInfo, SF_Resolved, Table::tabFlags, TF_Ephemeral, and WRC_Continue.
Referenced by sqlite3SelectAddTypeInfo().
static int selectColumnsFromExprList | ( | Parse * | pParse, | |
ExprList * | pEList, | |||
int * | pnCol, | |||
Column ** | paCol | |||
) | [static] |
Definition at line 1147 of file select.c.
References ExprList::a, Table::aCol, Parse::db, db, Expr::iColumn, Table::iPKey, sqlite3::mallocFailed, ExprList::nExpr, Expr::op, ExprList::ExprList_item::pExpr, Expr::pRight, Expr::pTab, Expr::span, sqlite3DbFree(), sqlite3DbMallocZero(), sqlite3DbStrDup(), sqlite3Dequote(), sqlite3MPrintf(), sqlite3StrICmp(), SQLITE_NOMEM, SQLITE_OK, TK_COLUMN, TK_DOT, Expr::token, Token::z, Column::zName, and ExprList::ExprList_item::zName.
Referenced by selectExpander(), and sqlite3ResultSetOfSelect().
Definition at line 2991 of file select.c.
References ExprList::a, SrcList::a, Table::aCol, sqlite3::aLimit, columnIndex(), Table::db, Parse::db, db, Token::dyn, sqlite3::flags, IsHiddenColumn, IsVirtual, JT_NATURAL, sqlite3::mallocFailed, Token::n, Table::nCol, ExprList::nExpr, Table::nRef, SrcList::nSrc, Expr::op, Select::pEList, ExprList::ExprList_item::pExpr, Expr::pLeft, Walker::pParse, Select::pPrior, Expr::pRight, Table::pSelect, Select::pSrc, selectColumnsFromExprList(), Select::selFlags, setQuotedToken(), setToken(), SF_Expanded, Expr::span, sqlite3DbFree(), sqlite3DbMallocZero(), sqlite3ErrorMsg(), sqlite3ExprListAppend(), sqlite3ExprListDelete(), sqlite3IdListIndex(), sqlite3IndexedByLookup(), sqlite3LocateTable(), sqlite3MPrintf(), sqlite3NameFromToken(), sqlite3PExpr(), sqlite3SelectDup(), sqlite3SrcListAssignCursors(), sqlite3StrICmp(), sqlite3ViewGetColumnNames(), sqlite3WalkSelect(), SQLITE_FullColNames, SQLITE_LIMIT_COLUMN, SQLITE_ShortColNames, sqliteProcessJoin(), TF_Ephemeral, TK_ALL, TK_DOT, TK_ID, Expr::token, WRC_Abort, WRC_Continue, WRC_Prune, Token::z, Column::zName, ExprList::ExprList_item::zName, and Table::zName.
Referenced by sqlite3SelectExpand().
static void selectInnerLoop | ( | Parse * | pParse, | |
Select * | p, | |||
ExprList * | pEList, | |||
int | srcTab, | |||
int | nColumn, | |||
ExprList * | pOrderBy, | |||
int | distinct, | |||
SelectDest * | pDest, | |||
int | iContinue, | |||
int | iBreak | |||
) | [static] |
Definition at line 525 of file select.c.
References ExprList::a, SelectDest::affinity, Select::affinity, checkForMultiColumnSelectError(), codeDistinct(), codeOffset(), SelectDest::eDest, Select::iLimit, SelectDest::iMem, SelectDest::iParm, ExprList::nExpr, SelectDest::nMem, Parse::nMem, OP_AddImm, OP_Column, OP_IdxDelete, OP_IdxInsert, OP_IfZero, OP_Insert, OP_Integer, OP_MakeRecord, OP_NewRowid, OP_ResultRow, OP_Yield, OPFLAG_APPEND, ExprList::ExprList_item::pExpr, pushOntoSorter(), Parse::pVdbe, sqlite3CompareAffinity(), sqlite3ExprCacheAffinityChange(), sqlite3ExprCodeExprList(), sqlite3ExprCodeMove(), sqlite3GetTempReg(), sqlite3ReleaseTempReg(), sqlite3VdbeAddOp1(), sqlite3VdbeAddOp2(), sqlite3VdbeAddOp3(), sqlite3VdbeAddOp4(), sqlite3VdbeChangeP5(), SRT_Coroutine, SRT_Discard, SRT_EphemTab, SRT_Except, SRT_Exists, SRT_Mem, SRT_Output, SRT_Set, SRT_Table, and SRT_Union.
Referenced by multiSelect(), and sqlite3Select().
static const char* selectOpName | ( | int | id | ) | [static] |
Definition at line 1122 of file select.c.
References TK_ALL, TK_EXCEPT, and TK_INTERSECT.
Referenced by multiSelect().
static void setJoinExpr | ( | Expr * | p, | |
int | iTable | |||
) | [static] |
Definition at line 308 of file select.c.
References EP_FromJoin, ExprSetProperty, Expr::iRightJoinTable, Expr::pLeft, and Expr::pRight.
Referenced by sqliteProcessJoin().
Definition at line 204 of file select.c.
References Parse::db, Token::dyn, Token::n, sqlite3MPrintf(), and Token::z.
Referenced by selectExpander().
static void setToken | ( | Token * | p, | |
const char * | z | |||
) | [static] |
Definition at line 192 of file select.c.
References Token::dyn, Token::n, and Token::z.
Referenced by selectExpander(), and sqlite3CreateIdExpr().
Definition at line 237 of file select.c.
References setToken(), sqlite3PExpr(), and TK_ID.
Referenced by addWhereTerm(), and updateVirtualTable().
Definition at line 1303 of file select.c.
References Parse::db, OP_Trace, Parse::pVdbe, sqlite3VdbeAddOp0(), and sqlite3VdbeCreate().
Referenced by analyzeOneTable(), codeAttach(), codeTableLocks(), computeLimitRegisters(), destroyRootPage(), flagPragma(), loadAnalysis(), multiSelect(), openStatTable(), reloadTableSchema(), returnSingleInt(), sqlite3AlterBeginAddColumn(), sqlite3AlterRenameTable(), sqlite3BeginTransaction(), sqlite3BeginWriteOperation(), sqlite3CodeSubselect(), sqlite3CodeVerifySchema(), sqlite3CommitTransaction(), sqlite3CompleteInsertion(), sqlite3CreateIndex(), sqlite3DeleteFrom(), sqlite3DropIndex(), sqlite3DropTable(), sqlite3DropTriggerPtr(), sqlite3EndTable(), sqlite3ExprCodeExprList(), sqlite3FindInIndex(), sqlite3FinishCoding(), sqlite3FinishTrigger(), sqlite3GenerateConstraintChecks(), sqlite3Insert(), sqlite3MinimumFileFormat(), sqlite3OpenMasterTable(), sqlite3OpenTable(), sqlite3OpenTableAndIndices(), sqlite3Pragma(), sqlite3RefillIndex(), sqlite3RollbackTransaction(), sqlite3Select(), sqlite3StartTable(), sqlite3Update(), sqlite3Vacuum(), sqlite3VtabFinishParse(), and xferOptimization().
int sqlite3IndexedByLookup | ( | Parse * | pParse, | |
struct SrcList_item * | pFrom | |||
) |
Definition at line 2949 of file select.c.
References Table::pIndex, Index::pNext, sqlite3ErrorMsg(), sqlite3StrICmp(), SQLITE_ERROR, SQLITE_OK, and Index::zName.
Referenced by selectExpander(), and sqlite3SrcListLookup().
Definition at line 124 of file select.c.
References JT_CROSS, JT_ERROR, JT_INNER, JT_LEFT, JT_NATURAL, JT_OUTER, JT_RIGHT, Token::n, sqlite3ErrorMsg(), sqlite3StrNICmp(), and Token::z.
Referenced by yy_reduce().
Definition at line 1270 of file select.c.
References Table::aCol, Table::db, Parse::db, db, sqlite3::flags, Table::iPKey, sqlite3::mallocFailed, Table::nCol, Parse::nErr, Table::nRef, Select::pEList, Select::pPrior, selectAddColumnTypeAndCollation(), selectColumnsFromExprList(), sqlite3DbMallocZero(), sqlite3DeleteTable(), sqlite3SelectPrep(), SQLITE_FullColNames, SQLITE_ShortColNames, and Table::zName.
Referenced by sqlite3EndTable(), and sqlite3ViewGetColumnNames().
int sqlite3Select | ( | Parse * | pParse, | |
Select * | p, | |||
SelectDest * | pDest | |||
) |
Definition at line 3498 of file select.c.
References ExprList::a, SrcList::a, AggInfo::aCol, Select::addrOpenEphm, AggInfo::aFunc, sqlite3::aLimit, checkForMultiColumnSelectError(), computeLimitRegisters(), Parse::db, db, AggInfo::directMode, SelectDest::eDest, finalizeAggFunctions(), flattenSubquery(), generateColumnNames(), generateSortTail(), WhereInfo::iBreak, WhereInfo::iContinue, ExprList::iECursor, IgnorableOrderby, SelectDest::iParm, AggInfo::AggInfo_col::iSorterColumn, keyInfoFromExprList(), sqlite3::mallocFailed, minMaxQuery(), multiSelect(), AggInfo::nAccumulator, AggInfo::nColumn, Parse::nErr, ExprList::nExpr, AggInfo::nFunc, Parse::nHeight, Parse::nMem, AggInfo::nSortingColumn, SrcList::nSrc, Parse::nTab, Expr::op, OP_Column, OP_Compare, OP_Gosub, OP_Goto, OP_IdxInsert, OP_IfPos, OP_Integer, OP_Jump, OP_MakeRecord, OP_Next, OP_OpenEphemeral, OP_Return, OP_SCopy, OP_Sequence, OP_Sort, P4_KEYINFO, P4_KEYINFO_HANDOFF, NameContext::pAggInfo, Select::pEList, ExprList::ExprList_item::pExpr, AggInfo::AggInfo_func::pExpr, AggInfo::pGroupBy, Select::pGroupBy, Select::pHaving, Expr::pList, Select::pNext, Select::pOrderBy, NameContext::pParse, Select::pPrior, Select::pRightmost, SrcList::SrcList_item::pSelect, Select::pSrc, NameContext::pSrcList, Select::pWhere, resetAccumulator(), selectInnerLoop(), Select::selFlags, SF_Aggregate, SF_Distinct, AggInfo::sortingIdx, ExprList::ExprList_item::sortOrder, sqlite3AuthCheck(), sqlite3DbFree(), sqlite3ErrorMsg(), sqlite3ExprAnalyzeAggList(), sqlite3ExprAnalyzeAggregates(), sqlite3ExprCode(), sqlite3ExprCodeExprList(), sqlite3ExprCodeGetColumn(), sqlite3ExprCodeMove(), sqlite3ExprIfFalse(), sqlite3ExprListDelete(), sqlite3ExprListDup(), sqlite3GetTempRange(), sqlite3GetTempReg(), sqlite3GetVdbe(), sqlite3ReleaseTempRange(), sqlite3ReleaseTempReg(), sqlite3Select(), sqlite3SelectDestInit(), sqlite3SelectExprHeight, sqlite3SelectPrep(), sqlite3VdbeAddOp1(), sqlite3VdbeAddOp2(), sqlite3VdbeAddOp3(), sqlite3VdbeAddOp4(), sqlite3VdbeChangeToNoop(), sqlite3VdbeCurrentAddr(), sqlite3VdbeJumpHere(), sqlite3VdbeMakeLabel(), sqlite3VdbeResolveLabel(), sqlite3WhereBegin(), sqlite3WhereEnd(), SQLITE_JUMPIFNULL, SQLITE_LIMIT_COMPOUND_SELECT, SQLITE_OK, SQLITE_SELECT, SRT_Discard, SRT_EphemTab, SRT_Except, SRT_Exists, SRT_Output, SRT_Union, TK_COLUMN, updateAccumulator(), AggInfo::useSortingIdx, VdbeComment, and WHERE_ORDERBY_MIN.
Referenced by codeTriggerProgram(), multiSelect(), multiSelectOrderBy(), sqlite3CodeSubselect(), sqlite3EndTable(), sqlite3Insert(), sqlite3MaterializeView(), sqlite3Select(), updateVirtualTable(), and yy_reduce().
Definition at line 3298 of file select.c.
References exprWalkNoop(), Walker::pParse, selectAddSubqueryTypeInfo(), sqlite3WalkSelect(), Walker::xExprCallback, and Walker::xSelectCallback.
Referenced by sqlite3SelectPrep().
Definition at line 100 of file select.c.
References clearSelect(), and sqlite3DbFree().
Referenced by clearSelect(), codeTriggerProgram(), flattenSubquery(), multiSelect(), multiSelectOrderBy(), sqlite3CreateView(), sqlite3DeleteTable(), sqlite3DeleteTriggerStep(), sqlite3ExprClear(), sqlite3Insert(), sqlite3MaterializeView(), sqlite3SrcListAppendFromTerm(), sqlite3SrcListDelete(), sqlite3TriggerInsertStep(), sqlite3TriggerSelectStep(), sqlite3ViewGetColumnNames(), sqlitePersistTriggerStep(), updateVirtualTable(), yy_destructor(), and yy_reduce().
void sqlite3SelectDestInit | ( | SelectDest * | pDest, | |
int | eDest, | |||
int | iParm | |||
) |
Definition at line 39 of file select.c.
References SelectDest::affinity, SelectDest::eDest, SelectDest::iMem, SelectDest::iParm, and SelectDest::nMem.
Referenced by codeTriggerProgram(), multiSelect(), multiSelectOrderBy(), sqlite3CodeSubselect(), sqlite3EndTable(), sqlite3Insert(), sqlite3MaterializeView(), sqlite3Select(), and updateVirtualTable().
Definition at line 3241 of file select.c.
References exprWalkNoop(), Walker::pParse, selectExpander(), sqlite3WalkSelect(), Walker::xExprCallback, and Walker::xSelectCallback.
Referenced by sqlite3SelectPrep().
Select* sqlite3SelectNew | ( | Parse * | pParse, | |
ExprList * | pEList, | |||
SrcList * | pSrc, | |||
Expr * | pWhere, | |||
ExprList * | pGroupBy, | |||
Expr * | pHaving, | |||
ExprList * | pOrderBy, | |||
int | isDistinct, | |||
Expr * | pLimit, | |||
Expr * | pOffset | |||
) |
Definition at line 52 of file select.c.
References Select::addrOpenEphm, clearSelect(), Parse::db, db, sqlite3::mallocFailed, Select::op, Select::pEList, Select::pGroupBy, Select::pHaving, Select::pLimit, Select::pOffset, Select::pOrderBy, Select::pSrc, Select::pWhere, Select::selFlags, SF_Distinct, sqlite3DbFree(), sqlite3DbMallocZero(), sqlite3Expr(), sqlite3ExprListAppend(), TK_ALL, and TK_SELECT.
Referenced by sqlite3MaterializeView(), updateVirtualTable(), and yy_reduce().
void sqlite3SelectPrep | ( | Parse * | pParse, | |
Select * | p, | |||
NameContext * | pOuterNC | |||
) |
Definition at line 3321 of file select.c.
References Parse::db, db, sqlite3::mallocFailed, Parse::nErr, Select::selFlags, SF_HasTypeInfo, sqlite3ResolveSelectNames(), sqlite3SelectAddTypeInfo(), and sqlite3SelectExpand().
Referenced by resolveSelectStep(), sqlite3ResultSetOfSelect(), and sqlite3Select().
Definition at line 331 of file select.c.
References IdList::a, SrcList::a, Table::aCol, addWhereTerm(), columnIndex(), Parse::db, JT_NATURAL, JT_OUTER, Table::nCol, IdList::nId, SrcList::nSrc, Select::pSrc, SrcList::SrcList_item::pTab, Select::pWhere, setJoinExpr(), sqlite3ErrorMsg(), sqlite3ExprAnd(), IdList::IdList_item::zName, and Column::zName.
Referenced by selectExpander().
Definition at line 2377 of file select.c.
References ExprList::a, Expr::flags, Expr::iAgg, Expr::iColumn, Expr::iTable, ExprList::nExpr, Expr::op, ExprList::ExprList_item::pExpr, Expr::pLeft, Expr::pList, Expr::pRight, Expr::pSelect, Expr::pTab, Expr::span, sqlite3ExprDup(), sqlite3ExprListDup(), sqlite3SelectDup(), sqlite3TokenCopy(), substExprList(), substSelect(), TK_COLUMN, TK_NULL, and Expr::token.
Referenced by flattenSubquery(), substExprList(), and substSelect().
static void substExprList | ( | sqlite3 * | db, | |
ExprList * | pList, | |||
int | iTable, | |||
ExprList * | pEList | |||
) | [static] |
Definition at line 2416 of file select.c.
References ExprList::a, ExprList::nExpr, ExprList::ExprList_item::pExpr, and substExpr().
Referenced by flattenSubquery(), substExpr(), and substSelect().
Definition at line 2428 of file select.c.
References SrcList::a, SrcList::nSrc, Select::pEList, Select::pGroupBy, Select::pHaving, Select::pOrderBy, Select::pPrior, Select::pSrc, Select::pWhere, substExpr(), and substExprList().
Referenced by substExpr().
Definition at line 3391 of file select.c.
References ExprList::a, AggInfo::aCol, AggInfo::aFunc, codeDistinct(), Parse::db, AggInfo::directMode, ExprList::nExpr, OP_AggStep, OP_CollSeq, P4_COLLSEQ, P4_FUNCDEF, sqlite3::pDfltColl, Parse::pVdbe, sqlite3ExprCacheAffinityChange(), sqlite3ExprCode(), sqlite3ExprCodeExprList(), sqlite3ExprCollSeq(), sqlite3GetTempRange(), sqlite3ReleaseTempRange(), sqlite3VdbeAddOp4(), sqlite3VdbeChangeP5(), sqlite3VdbeMakeLabel(), sqlite3VdbeResolveLabel(), and SQLITE_FUNC_NEEDCOLL.
Referenced by sqlite3Select().
ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:50:01 2011 by Doxygen 1.6.1