Lines Matching refs:pSrc
18705 ** be NULL. The pSrc corresponds to the FROM clause of a SELECT or
18831 SrcList *pSrc; /* The FROM clause */
18879 #define SF_UFSrcCheck 0x0800000 /* Check pSrc as required by UPDATE...FROM */
31516 SQLITE_PRIVATE void sqlite3TreeViewSrcList(TreeView *pView, const SrcList *pSrc){
31518 if( pSrc==0 ) return;
31519 for(i=0; i<pSrc->nSrc; i++){
31520 const SrcItem *pItem = &pSrc->a[i];
31553 sqlite3TreeViewItem(pView, zLine, i<pSrc->nSrc-1);
31609 if( p->pSrc && p->pSrc->nSrc ) n++;
31635 if( p->pSrc && p->pSrc->nSrc ){
31638 sqlite3TreeViewSrcList(pView, p->pSrc);
57731 SQLITE_PRIVATE void sqlite3PagerAlignReserve(Pager *pDest, Pager *pSrc){
57732 if( pDest->nReserve!=pSrc->nReserve ){
57733 pDest->nReserve = pSrc->nReserve;
70077 ** The cell pCell is currently part of page pSrc but will ultimately be part
70078 ** of pPage. (pSrc and pPage are often the same.) If pCell contains a
70082 static void ptrmapPutOvflPtr(MemPage *pPage, MemPage *pSrc, u8 *pCell,int *pRC){
70089 if( SQLITE_WITHIN(pSrc->aDataEnd, pCell, pCell+info.nLocal) ){
70090 testcase( pSrc!=pPage );
75446 const u8 *pSrc;
75467 pSrc = pX->pData;
75475 pSrc = pX->pKey;
75491 memcpy(pPayload, pSrc, nSrc);
75549 memcpy(pPayload, pSrc, n);
75552 memcpy(pPayload, pSrc, n);
75559 pSrc += n;
77929 ** pSrc into cursor pDest. If the cursors are open on intkey tables, then
77942 SQLITE_PRIVATE int sqlite3BtreeTransferRow(BtCursor *pDest, BtCursor *pSrc, i64 iKey){
77950 getCellInfo(pSrc);
77951 if( pSrc->info.nPayload<0x80 ){
77952 *(aOut++) = pSrc->info.nPayload;
77954 aOut += sqlite3PutVarint(aOut, pSrc->info.nPayload);
77957 nIn = pSrc->info.nLocal;
77958 aIn = pSrc->info.pPayload;
77959 if( aIn+nIn>pSrc->pPage->aDataEnd ){
77962 nRem = pSrc->info.nPayload;
77967 Pager *pSrcPager = pSrc->pBt->pPager;
77974 nOut = btreePayloadToLocal(pDest->pPage, pSrc->info.nPayload);
77976 if( nOut<pSrc->info.nPayload ){
77982 if( aIn+nIn+4>pSrc->pPage->aDataEnd ){
77985 ovflIn = get4byte(&pSrc->info.pPayload[nIn]);
78008 nIn = pSrc->pBt->usableSize - 4;
79775 Btree *pSrc; /* Source b-tree file */
79860 rc = sqlite3BtreeSetPageSize(p->pDest,sqlite3BtreeGetPageSize(p->pSrc),0,0);
79930 p->pSrc = findBtree(pDestDb, pSrcDb, zSrcDb);
79937 if( 0==p->pSrc || 0==p->pDest
79950 p->pSrc->nBackup++;
79979 const int nSrcPgsz = sqlite3BtreeGetPageSize(p->pSrc);
79986 ** p->pSrc may not actually be the owner. */
79987 int nSrcReserve = sqlite3BtreeGetReserveNoMutex(p->pSrc);
79993 assert( sqlite3BtreeGetReserveNoMutex(p->pSrc)>=0 );
79996 assert( iSrcPg!=PENDING_BYTE_PAGE(p->pSrc->pBt) );
80049 sqlite3Put4byte(&zOut[28], sqlite3BtreeLastPage(p->pSrc));
80081 assert( sqlite3BtreeHoldsMutex(p->pSrc) );
80082 pp = sqlite3PagerBackupPtr(sqlite3BtreePager(p->pSrc));
80101 sqlite3BtreeEnter(p->pSrc);
80108 Pager * const pSrcPager = sqlite3BtreePager(p->pSrc); /* Source pager */
80117 if( p->pDestDb && p->pSrc->pBt->inTransaction==TRANS_WRITE ){
80127 if( rc==SQLITE_OK && SQLITE_TXN_NONE==sqlite3BtreeTxnState(p->pSrc) ){
80128 rc = sqlite3BtreeBeginTrans(p->pSrc, 0, 0);
80152 pgszSrc = sqlite3BtreeGetPageSize(p->pSrc);
80162 nSrcPage = (int)sqlite3BtreeLastPage(p->pSrc);
80166 if( iSrcPg!=PENDING_BYTE_PAGE(p->pSrc->pBt) ){
80221 assert( pgszSrc==sqlite3BtreeGetPageSize(p->pSrc) );
80324 TESTONLY( rc2 = ) sqlite3BtreeCommitPhaseOne(p->pSrc, 0);
80325 TESTONLY( rc2 |= ) sqlite3BtreeCommitPhaseTwo(p->pSrc, 0);
80337 sqlite3BtreeLeave(p->pSrc);
80354 sqlite3BtreeEnter(p->pSrc);
80361 p->pSrc->nBackup--;
80364 pp = sqlite3PagerBackupPtr(sqlite3BtreePager(p->pSrc));
80384 sqlite3BtreeLeave(p->pSrc);
80442 assert( sqlite3_mutex_held(p->pSrc->pBt->mutex) );
80478 assert( sqlite3_mutex_held(p->pSrc->pBt->mutex) );
80515 b.pSrc = pFrom;
95993 VdbeCursor *pSrc; /* Cursor to read from */
96000 pSrc = p->apCsr[pOp->p2];
96002 rc = sqlite3BtreeTransferRow(pDest->uc.pCursor, pSrc->uc.pCursor, iKey);
103580 SrcList *pSrc;
103584 pSrc = p->pSrc;
103585 if( ALWAYS(pSrc) ){
103586 for(i=pSrc->nSrc, pItem=pSrc->a; i>0; i--, pItem++){
104436 ** from datasource iSrc in SrcList pSrc.
104438 SQLITE_PRIVATE Expr *sqlite3CreateColumnExpr(sqlite3 *db, SrcList *pSrc, int iSrc, int iCol){
104441 SrcItem *pItem = &pSrc->a[iSrc];
105050 nc.pSrcList = pSelect->pSrc;
105420 Select *pSub = p->pSrc->a[0].pSelect;
105421 assert( p->pSrc->nSrc==1 && p->pOrderBy );
105429 for(i=0; i<p->pSrc->nSrc; i++){
105430 SrcItem *pItem = &p->pSrc->a[i];
105458 sNC.pSrcList = p->pSrc;
105499 for(i=0; i<p->pSrc->nSrc; i++){
105500 SrcItem *pItem = &p->pSrc->a[i];
105533 Select *pSub = p->pSrc->a[0].pSelect;
107543 pNew->pSrc = sqlite3SrcListDup(db, p->pSrc, flags);
108117 ** Check pExpr to see if it is an invariant constraint on data source pSrc.
108124 ** (1) pExpr cannot refer to any table other than pSrc->iCursor.
108128 ** (3) pSrc cannot be part of the left operand for a RIGHT JOIN.
108131 ** (4) If pSrc is the right operand of a LEFT JOIN, then...
108135 ** (5) If pSrc is not the right operand of a LEFT JOIN or the left
108139 SQLITE_PRIVATE int sqlite3ExprIsTableConstraint(Expr *pExpr, const SrcItem *pSrc){
108140 if( pSrc->fg.jointype & JT_LTORJ ){
108143 if( pSrc->fg.jointype & JT_LEFT ){
108145 if( pExpr->w.iJoin!=pSrc->iCursor ) return 0; /* rule (4b) */
108149 return sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor); /* rules (1), (2) */
108397 SrcList *pSrc;
108413 pSrc = p->pSrc;
108414 assert( pSrc!=0 );
108415 if( pSrc->nSrc!=1 ) return 0; /* Single term in FROM clause */
108416 if( pSrc->a[0].pSelect ) return 0; /* FROM is not a subquery or view */
108417 pTab = pSrc->a[0].pTab;
108427 assert( pRes->iTable==pSrc->a[0].iCursor ); /* Not a correlated subquery */
108599 assert( p->pSrc!=0 ); /* Because of isCandidateForInOpt(p) */
108600 pTab = p->pSrc->a[0].pTab;
111867 SrcList *pSrc = pSelect->pSrc;
111870 if( pSrc->nSrc==0 ) return WRC_Continue;
111872 p->nExclude += pSrc->nSrc;
111880 for(i=0; i<pSrc->nSrc; i++, j++){
111881 p->aiExclude[j] = pSrc->a[i].iCursor;
111887 SrcList *pSrc = pSelect->pSrc;
111889 assert( p->nExclude>=pSrc->nSrc );
111890 p->nExclude -= pSrc->nSrc;
111908 SrcList *pSrc = p->pRef;
111909 int nSrc = pSrc ? pSrc->nSrc : 0;
111911 if( pExpr->iTable==pSrc->a[i].iCursor ){
112452 SrcList *pSrc, /* The table to rename. */
112466 assert( pSrc->nSrc==1 );
112469 pTab = sqlite3LocateTableItem(pParse, 0, &pSrc->a[0]);
112611 sqlite3SrcListDelete(db, pSrc);
112792 ** pSrc is the full-name of the table being altered.
112804 SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *pParse, SrcList *pSrc){
112816 pTab = sqlite3LocateTableItem(pParse, 0, &pSrc->a[0]);
112874 sqlite3SrcListDelete(db, pSrc);
112915 ** cmd ::= ALTER TABLE pSrc RENAME COLUMN pOld TO pNew
112919 SrcList *pSrc, /* Table being altered. pSrc->nSrc==1 */
112933 pTab = sqlite3LocateTableItem(pParse, 0, &pSrc->a[0]);
112999 sqlite3SrcListDelete(db, pSrc);
113214 if( ALWAYS(p->pSrc) ){ /* Every Select as a SrcList, even if it is empty */
113215 SrcList *pSrc = p->pSrc;
113216 for(i=0; i<pSrc->nSrc; i++){
113217 sqlite3RenameTokenRemap(pParse, 0, (void*)pSrc->a[i].zName);
113218 if( pSrc->a[i].fg.isUsing==0 ){
113219 sqlite3WalkExpr(pWalker, pSrc->a[i].u3.pOn);
113221 unmapColumnIdlistNames(pParse, pSrc->a[i].u3.pUsing);
113644 SrcList *pSrc = sqlite3TriggerStepSrc(pParse, pStep);
113645 if( pSrc ){
113647 pParse, pStep->pExprList, pSrc, 0, 0, 0, 0, 0, 0
113651 pSrc = 0;
113657 assert( pSrc==pSel->pSrc );
113659 pSel->pSrc = 0;
113675 sNC.pSrcList = pSrc;
113685 pUpsert->pUpsertSrc = pSrc;
113702 sqlite3SrcListDelete(db, pSrc);
113971 SrcList *pSrc = pSelect->pSrc;
113977 if( NEVER(pSrc==0) ){
113981 for(i=0; i<pSrc->nSrc; i++){
113982 SrcItem *pItem = &pSrc->a[i];
114446 ** ALTER TABLE pSrc DROP COLUMN pName
114448 ** statement. Argument pSrc contains the possibly qualified name of the
114451 SQLITE_PRIVATE void sqlite3AlterDropColumn(Parse *pParse, SrcList *pSrc, const Token *pName){
114463 pTab = sqlite3LocateTableItem(pParse, 0, &pSrc->a[0]);
114587 sqlite3SrcListDelete(db, pSrc);
117044 SrcList *pList = pSelect->pSrc;
117131 s.pSrc = pList;
120587 sqlite3SrcListAssignCursors(pParse, pSel->pSrc);
122227 SrcList *pSrc, /* The SrcList to be enlarged */
122228 int nExtra, /* Number of new slots to add to pSrc->a[] */
122229 int iStart /* Index in pSrc->a[] of first new slot */
122236 assert( pSrc!=0 );
122237 assert( iStart<=pSrc->nSrc );
122240 if( (u32)pSrc->nSrc+nExtra>pSrc->nAlloc ){
122242 sqlite3_int64 nAlloc = 2*(sqlite3_int64)pSrc->nSrc+nExtra;
122245 if( pSrc->nSrc+nExtra>=SQLITE_MAX_SRCLIST ){
122251 pNew = sqlite3DbRealloc(db, pSrc,
122252 sizeof(*pSrc) + (nAlloc-1)*sizeof(pSrc->a[0]) );
122257 pSrc = pNew;
122258 pSrc->nAlloc = nAlloc;
122263 for(i=pSrc->nSrc-1; i>=iStart; i--){
122264 pSrc->a[i+nExtra] = pSrc->a[i];
122266 pSrc->nSrc += nExtra;
122269 memset(&pSrc->a[iStart], 0, sizeof(pSrc->a[0])*nExtra);
122271 pSrc->a[i].iCursor = -1;
122275 return pSrc;
122368 sqlite3SrcListAssignCursors(pParse, pItem->pSelect->pSrc);
123722 ** The following fields are initialized appropriate in pSrc:
123724 ** pSrc->a[0].pTab Pointer to the Table object
123725 ** pSrc->a[0].pIndex Pointer to the INDEXED BY index, if there is one
123728 SQLITE_PRIVATE Table *sqlite3SrcListLookup(Parse *pParse, SrcList *pSrc){
123729 SrcItem *pItem = pSrc->a;
123731 assert( pItem && pSrc->nSrc>=1 );
123876 SrcList *pSrc, /* the FROM clause -- which tables to scan */
123886 SrcList *pSelectSrc = NULL; /* SELECT rowid FROM x ... (dup of pSrc) */
123915 pTab = pSrc->a[0].pTab;
123942 pSrc->a[0].pTab = 0;
123943 pSelectSrc = sqlite3SrcListDup(db, pSrc, 0);
123944 pSrc->a[0].pTab = pTab;
123945 if( pSrc->a[0].fg.isIndexedBy ){
123946 assert( pSrc->a[0].fg.isCte==0 );
123947 pSrc->a[0].u2.pIBIndex = 0;
123948 pSrc->a[0].fg.isIndexedBy = 0;
123949 sqlite3DbFree(db, pSrc->a[0].u1.zIndexedBy);
123950 }else if( pSrc->a[0].fg.isCte ){
123951 pSrc->a[0].u2.pCteUse->nUse++;
127673 SrcList *pSrc, /* The child table to be scanned */
127676 FKey *pFKey, /* The foreign key linking pSrc to pTab */
127744 pRight = exprTableColumn(db, pTab, pSrc->a[0].iCursor, -1);
127764 sNameContext.pSrcList = pSrc;
127768 /* Create VDBE to loop through the entries in pSrc that match the WHERE
127772 pWInfo = sqlite3WhereBegin(pParse, pSrc, pWhere, 0, 0, 0, 0, 0);
128142 SrcList *pSrc;
128166 pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0);
128167 if( pSrc ){
128168 SrcItem *pItem = pSrc->a;
128175 fkScanChildren(pParse, pSrc, pTab, pIdx, pFKey, aiCol, regNew, -1);
128179 fkScanChildren(pParse, pSrc, pTab, pIdx, pFKey, aiCol, regOld, 1);
128202 sqlite3SrcListDelete(db, pSrc);
131311 ** Check to see if index pSrc is compatible as a source of data
131321 static int xferCompatibleIndex(Index *pDest, Index *pSrc){
131323 assert( pDest && pSrc );
131324 assert( pDest->pTable!=pSrc->pTable );
131325 if( pDest->nKeyCol!=pSrc->nKeyCol || pDest->nColumn!=pSrc->nColumn ){
131328 if( pDest->onError!=pSrc->onError ){
131331 for(i=0; i<pSrc->nKeyCol; i++){
131332 if( pSrc->aiColumn[i]!=pDest->aiColumn[i] ){
131335 if( pSrc->aiColumn[i]==XN_EXPR ){
131336 assert( pSrc->aColExpr!=0 && pDest->aColExpr!=0 );
131337 if( sqlite3ExprCompare(0, pSrc->aColExpr->a[i].pExpr,
131342 if( pSrc->aSortOrder[i]!=pDest->aSortOrder[i] ){
131345 if( sqlite3_stricmp(pSrc->azColl[i],pDest->azColl[i])!=0 ){
131349 if( sqlite3ExprCompare(0, pSrc->pPartIdxWhere, pDest->pPartIdxWhere, -1) ){
131391 Table *pSrc; /* The table in the FROM clause of SELECT */
131393 SrcItem *pItem; /* An element of pSelect->pSrc */
131395 int iDbSrc; /* The database of pSrc */
131399 int emptySrcTest = 0; /* Address of test for empty pSrc */
131421 assert(pSelect->pSrc); /* allocated even if there is no FROM clause */
131422 if( pSelect->pSrc->nSrc!=1 ){
131425 if( pSelect->pSrc->a[0].pSelect ){
131462 pItem = pSelect->pSrc->a;
131463 pSrc = sqlite3LocateTableItem(pParse, 0, pItem);
131464 if( pSrc==0 ){
131467 if( pSrc->tnum==pDest->tnum && pSrc->pSchema==pDest->pSchema ){
131468 testcase( pSrc!=pDest ); /* Possible due to bad sqlite_schema.rootpage */
131471 if( HasRowid(pDest)!=HasRowid(pSrc) ){
131474 if( !IsOrdinaryTable(pSrc) ){
131477 if( pDest->nCol!=pSrc->nCol ){
131480 if( pDest->iPKey!=pSrc->iPKey ){
131483 if( (pDest->tabFlags & TF_Strict)!=0 && (pSrc->tabFlags & TF_Strict)==0 ){
131488 Column *pSrcCol = &pSrc->aCol[i];
131523 sqlite3ColumnExpr(pSrc, pSrcCol),
131544 Expr *pSrcExpr = sqlite3ColumnExpr(pSrc, pSrcCol);
131561 for(pSrcIdx=pSrc->pIndex; pSrcIdx; pSrcIdx=pSrcIdx->pNext){
131565 return 0; /* pDestIdx has no corresponding index in pSrc */
131567 if( pSrcIdx->tnum==pDestIdx->tnum && pSrc->pSchema==pDest->pSchema
131576 if( pDest->pCheck && sqlite3ExprListCompare(pSrc->pCheck,pDest->pCheck,-1) ){
131604 iDbSrc = sqlite3SchemaToIndex(db, pSrc->pSchema);
131641 if( HasRowid(pSrc) ){
131643 sqlite3OpenTable(pParse, iSrc, iDbSrc, pSrc, OP_OpenRead);
131688 sqlite3TableLock(pParse, iDbSrc, pSrc->tnum, 0, pSrc->zName);
131692 for(pSrcIdx=pSrc->pIndex; ALWAYS(pSrcIdx); pSrcIdx=pSrcIdx->pNext){
131728 }else if( !HasRowid(pSrc) && pDestIdx->idxType==SQLITE_IDXTYPE_PRIMARYKEY ){
138293 sqlite3SrcListDelete(db, p->pSrc);
138335 SrcList *pSrc, /* the FROM clause -- which tables to scan */
138363 if( pSrc==0 ) pSrc = sqlite3DbMallocZero(pParse->db, sizeof(*pSrc));
138364 pNew->pSrc = pSrc;
138381 assert( pNew->pSrc!=0 || pParse->nErr>0 );
138550 ** Search the tables iStart..iEnd (inclusive) in pSrc, looking for a
138560 SrcList *pSrc, /* Array of tables to search */
138561 int iStart, /* First member of pSrc->a[] to check */
138562 int iEnd, /* Last member of pSrc->a[] to check */
138564 int *piTab, /* Write index of pSrc->a[] here */
138565 int *piCol, /* Write index of pSrc->a[*piTab].pTab->aCol[] here */
138568 int i; /* For looping over tables in pSrc */
138571 assert( iEnd<pSrc->nSrc );
138576 iCol = sqlite3ColumnIndex(pSrc->a[i].pTab, zCol);
138578 && (bIgnoreHidden==0 || IsHiddenColumn(&pSrc->a[i].pTab->aCol[iCol])==0)
138581 sqlite3SrcItemColumnUsed(&pSrc->a[i], iCol);
138687 ** The terms of a FROM clause are contained in the Select.pSrc structure.
138688 ** The left most table is the first entry in Select.pSrc. The right-most
138697 SrcList *pSrc; /* All tables in the FROM clause */
138702 pSrc = p->pSrc;
138703 pLeft = &pSrc->a[0];
138705 for(i=0; i<pSrc->nSrc-1; i++, pRight++, pLeft++){
138727 if( tableAndColumnIndex(pSrc, 0, i, zName, 0, 0, 1) ){
138767 || tableAndColumnIndex(pSrc, 0, i, zName, &iLeft, &iLeftCol,
138774 pE1 = sqlite3CreateColumnExpr(db, pSrc, iLeft, iLeftCol);
138775 sqlite3SrcItemColumnUsed(&pSrc->a[iLeft], iLeftCol);
138776 if( (pSrc->a[0].fg.jointype & JT_LTORJ)!=0 ){
138792 while( tableAndColumnIndex(pSrc, iLeft+1, i, zName, &iLeft, &iLeftCol,
138794 if( pSrc->a[iLeft].fg.isUsing==0
138795 || sqlite3IdListIndex(pSrc->a[iLeft].u3.pUsing, zName)<0
138802 pE1 = sqlite3CreateColumnExpr(db, pSrc, iLeft, iLeftCol);
138803 sqlite3SrcItemColumnUsed(&pSrc->a[iLeft], iLeftCol);
138810 pE2 = sqlite3CreateColumnExpr(db, pSrc, i+1, iRightCol);
140184 sNC.pSrcList = pS->pSrc;
140230 sNC.pSrcList = pS->pSrc;
140345 pTabList = pSelect->pSrc;
140549 sNC.pSrcList = pSelect->pSrc;
140808 SrcList *pSrc = p->pSrc; /* The FROM clause of the recursive query */
140849 for(i=0; ALWAYS(i<pSrc->nSrc); i++){
140850 if( pSrc->a[i].fg.isRecursive ){
140851 iCurrent = pSrc->a[i].iCursor;
142140 SrcList *pSrc;
142150 pSrc = p->pSrc;
142151 assert( pSrc!=0 );
142152 for(i=pSrc->nSrc, pItem=pSrc->a; i>0; i--, pItem++){
142196 ** Assign new cursor numbers to each of the items in pSrc. For each
142203 ** existing cursor numbers in pSrc. aCsrMap[0] is the array size.
142205 ** If pSrc contains any sub-selects, call this routine recursively
142211 SrcList *pSrc, /* FROM clause to renumber */
142216 for(i=0, pItem=pSrc->a; i<pSrc->nSrc; i++, pItem++){
142225 srclistRenumberCursors(pParse, aCsrMap, p->pSrc, -1);
142258 ** Assign a new cursor number to each cursor in the FROM clause (Select.pSrc)
142282 srclistRenumberCursors(pParse, aCsrMap, p->pSrc, iExcept);
142467 ** The subquery is p->pSrc->a[iFrom]. isAgg is true if the outer query
142479 int iFrom, /* Index in p->pSrc->a[] of the inner subquery */
142486 SrcList *pSrc; /* The FROM clause of the outer query */
142503 pSrc = p->pSrc;
142504 assert( pSrc && iFrom>=0 && iFrom<pSrc->nSrc );
142505 pSubitem = &pSrc->a[iFrom];
142514 pSubSrc = pSub->pSrc;
142528 if( pSub->pLimit && (pSrc->nSrc>1 || isAgg) ){
142593 assert( pSub->pSrc!=0 );
142598 || pSub1->pSrc->nSrc<1 /* (17c) */
142605 if( iFrom>0 && (pSub1->pSrc->a[0].fg.jointype & JT_LTORJ)!=0 ){
142611 testcase( pSub1->pSrc->nSrc>1 );
142639 if( pSrc->nSrc>1 ){
142776 u8 ltorj = pSrc->a[iFrom].fg.jointype & JT_LTORJ;
142778 pSubSrc = pSub->pSrc; /* FROM clause of subquery */
142780 pSrc = pParent->pSrc; /* FROM clause of the outer query */
142802 pSrc = sqlite3SrcListEnlarge(pParse, pSrc, nSubSrc-1,iFrom+1);
142803 if( pSrc==0 ) break;
142804 pParent->pSrc = pSrc;
142811 SrcItem *pItem = &pSrc->a[i+iFrom];
142819 pSrc->a[iFrom].fg.jointype &= JT_LTORJ;
142820 pSrc->a[iFrom].fg.jointype |= jointype | ltorj;
142844 ** currently part of pSub->pSrc). See ticket [d11a6e908f]. */
142895 recomputeColumnsUsed(pParent, &pSrc->a[i+iFrom]);
143159 if( ALWAYS(p->pSrc!=0)
143160 && p->pSrc->nSrc>0
143161 && (p->pSrc->a[0].fg.jointype & JT_LTORJ)!=0
143296 SrcItem *pSrc /* The subquery term of the outer FROM clause */
143302 if( pSrc->fg.jointype & (JT_LTORJ|JT_RIGHT) ) return 0;
143336 nChng += pushDownWhereTerms(pParse, pSubq, pWhere->pRight, pSrc);
143354 if( sqlite3ExprIsTableConstraint(pWhere, pSrc) ){
143362 x.iTable = pSrc->iCursor;
143363 x.iNewTable = pSrc->iCursor;
143467 || p->pSrc->nSrc!=1
143468 || p->pSrc->a[0].pSelect
143474 pTab = p->pSrc->a[0].pTab;
143578 p->pSrc = pNewSrc;
143788 SrcList *pSrc = pRecTerm->pSrc;
143790 for(i=0; i<pSrc->nSrc; i++){
143791 SrcItem *pItem = &pSrc->a[i];
143988 assert( p->pSrc!=0 );
143996 pTabList = p->pSrc;
144392 pTabList = p->pSrc;
144805 if( p->pSrc->nSrc!=1 ) return 0; /* One table in FROM */
144806 pSub = p->pSrc->a[0].pSelect;
144822 pSub = p->pSrc->a[0].pSelect;
144823 p->pSrc->a[0].pSelect = 0;
144824 sqlite3SrcListDelete(db, p->pSrc);
144825 p->pSrc = sqlite3DbMallocZero(pParse->db, sizeof(*p->pSrc));
144860 ** If any term of pSrc, or any SF_NestedFrom sub-query, is not the same
144864 static int sameSrcAlias(SrcItem *p0, SrcList *pSrc){
144866 for(i=0; i<pSrc->nSrc; i++){
144867 SrcItem *p1 = &pSrc->a[i];
144874 && sameSrcAlias(p0, p1->pSelect->pSrc)
144977 ** In this case, it is an error if the target object (pSrc->a[0]) name
144978 ** or alias is duplicated within FROM clause (pSrc->a[1..n]).
144985 SrcItem *p0 = &p->pSrc->a[0];
144986 if( sameSrcAlias(p0, p->pSrc) ){
144996 ** in p->pSrc is flattened into this query and this function called
145017 pTabList = p->pSrc;
145139 pTabList = p->pSrc;
145190 pTabList = p->pSrc;
145997 if( !p->pSrc->a[0].fg.notIndexed ){
147219 SrcList *pSrc; /* SrcList to be returned */
147221 pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0);
147222 assert( pSrc==0 || pSrc->nSrc==1 );
147223 assert( zName || pSrc==0 );
147224 if( pSrc ){
147226 pSrc->a[0].zName = zName;
147228 pSrc->a[0].pSchema = pSchema;
147240 pSrc = sqlite3SrcListAppendList(pParse, pSrc, pDup);
147245 return pSrc;
147337 sSelect.pSrc = &sFrom;
147861 SrcList *pSrc, /* The virtual table to be modified */
147981 ** table in the source-list (pSrc->a[0]).
148046 SrcList *pSrc;
148062 pSrc = sqlite3SrcListDup(db, pTabList, 0);
148066 if( pSrc ){
148067 pSrc->a[0].fg.notCte = 1;
148068 pSrc->a[0].iCursor = -1;
148069 pSrc->a[0].pTab->nTabRef--;
148070 pSrc->a[0].pTab = 0;
148106 pSrc, pWhere2, pGrp, 0, pOrderBy2, SF_UFSrcCheck|SF_IncludeHidden, pLimit2
149026 SrcList *pSrc, /* The virtual table to be modified */
149044 int iCsr = pSrc->a[0].iCursor; /* Cursor used for virtual table scan */
149057 if( pSrc->nSrc>1 ){
149091 updateFromSelect(pParse, ephemTab, pPk, pList, pSrc, pWhere, 0, 0);
149100 pParse, pSrc, pWhere, 0, 0, 0, WHERE_ONEPASS_DESIRED, 0
149160 if( pSrc->nSrc==1 ){
149454 SrcList *pSrc; /* FROM clause for the UPDATE */
149495 pSrc = sqlite3SrcListDup(db, pTop->pUpsertSrc, 0);
149502 sqlite3Update(pParse, pSrc, sqlite3ExprListDup(db,pUpsert->pUpsertSet,0),
155210 SrcList *pSrc, /* the FROM clause */
155245 exprAnalyze(pSrc, pWC, idxNew);
155337 SrcList *pSrc, /* the FROM clause */
155367 sqlite3WhereExprAnalyze(pSrc, pOrWc);
155395 sqlite3WhereExprAnalyze(pSrc, pAndWC);
155448 whereCombineDisjuncts(pSrc, pWC, pOne, pTwo);
155584 exprAnalyze(pSrc, pWC, idxNew);
155636 SrcList *pSrc = pS->pSrc;
155642 if( ALWAYS(pSrc!=0) ){
155644 for(i=0; i<pSrc->nSrc; i++){
155645 mask |= exprSelectUsage(pMaskSet, pSrc->a[i].pSelect);
155646 if( pSrc->a[i].fg.isUsing==0 ){
155647 mask |= sqlite3WhereExprUsage(pMaskSet, pSrc->a[i].u3.pOn);
155649 if( pSrc->a[i].fg.isTabFunc ){
155650 mask |= sqlite3WhereExprListUsage(pMaskSet, pSrc->a[i].u1.pFuncArg);
155746 SrcList *pSrc, /* the FROM clause */
155825 if( ALWAYS(pSrc->nSrc>0) && (pSrc->a[0].fg.jointype & JT_LTORJ)!=0 ){
155849 if( exprMightBeIndexed(pSrc, prereqLeft, aiCurCol, pLeft, op) ){
155857 && exprMightBeIndexed(pSrc, pTerm->prereqRight, aiCurCol, pRight, op)
155942 exprAnalyze(pSrc, pWC, idxNew);
155955 exprAnalyzeOrTerm(pSrc, pWC, idxTerm);
156068 exprAnalyze(pSrc, pWC, idxNew1);
156076 exprAnalyze(pSrc, pWC, idxNew2);
156112 exprAnalyze(pSrc, pWC, idxNew);
156143 exprAnalyze(pSrc, pWC, idxNew);
156305 && (p->pSrc->nSrc==1 && IsVirtual(p->pSrc->a[0].pTab)) /* 3 */
156308 int iCsr = p->pSrc->a[0].iCursor;
156739 ** Move the content of pSrc into pDest
156741 static void whereOrMove(WhereOrSet *pDest, WhereOrSet *pSrc){
156742 pDest->n = pSrc->n;
156743 memcpy(pDest->a, pSrc->a, pDest->n*sizeof(pDest->a[0]));
157297 ** We know that pSrc is an operand of an outer join. Return true if
157300 ** pTerm must be EP_OuterON if pSrc is the right operand of an
157301 ** outer join. pTerm can be either EP_OuterON or EP_InnerON if pSrc
157311 const SrcItem *pSrc /* Table we are trying to access */
157313 assert( (pSrc->fg.jointype&(JT_LEFT|JT_LTORJ|JT_RIGHT))!=0 ); /* By caller */
157314 testcase( (pSrc->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT))==JT_LEFT );
157315 testcase( (pSrc->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT))==JT_LTORJ );
157319 || pTerm->pExpr->w.iJoin != pSrc->iCursor
157323 if( (pSrc->fg.jointype & (JT_LEFT|JT_RIGHT))!=0
157336 ** could be used with an index to access pSrc, assuming an appropriate
157341 const SrcItem *pSrc, /* Table we are trying to access */
157345 if( pTerm->leftCursor!=pSrc->iCursor ) return 0;
157347 assert( (pSrc->fg.jointype & JT_RIGHT)==0 );
157348 if( (pSrc->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT))!=0
157349 && !constraintCompatibleWithOuterJoin(pTerm,pSrc)
157356 aff = pSrc->pTab->aCol[pTerm->u.x.leftColumn].affinity;
157373 const SrcItem *pSrc, /* The FROM clause term to get the next index */
157388 int mxBitCol; /* Maximum column in pSrc->colUsed */
157410 pTable = pSrc->pTab;
157418 ** rows of the target table (pSrc) that can be used. */
157420 && sqlite3ExprIsTableConstraint(pExpr, pSrc)
157425 if( termCanDriveIndex(pTerm, pSrc, notReady) ){
157461 extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1));
157468 if( pSrc->colUsed & MASKBIT(BMS-1) ){
157481 if( termCanDriveIndex(pTerm, pSrc, notReady) ){
157511 if( pSrc->colUsed & MASKBIT(BMS-1) ){
157721 SrcItem *pSrc, /* The FROM clause term that is the vtab */
157739 assert( pSrc!=0 );
157740 pTab = pSrc->pTab;
157750 if( pTerm->leftCursor != pSrc->iCursor ) continue;
157763 if( (pSrc->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT))!=0
157764 && !constraintCompatibleWithOuterJoin(pTerm,pSrc)
157792 if( pExpr->op==TK_COLUMN && pExpr->iTable==pSrc->iCursor ){
157801 && pE2->iTable==pSrc->iCursor
159336 SrcItem *pSrc, /* FROM clause term being analyzed */
159337 Index *pProbe, /* An index on pSrc */
159388 pTerm = whereScanInit(&scan, pBuilder->pWC, pSrc->iCursor, saved_nEq,
159412 if( (pSrc->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT))!=0
159413 && !constraintCompatibleWithOuterJoin(pTerm,pSrc)
159526 pParse, pSrc->iCursor, pProbe, saved_nEq, pTerm
159644 assert( pSrc->pTab->szTabRow>0 );
159645 rCostIdx = pNew->nOut + 1 + (15*pProbe->szIdxRow)/pSrc->pTab->szTabRow;
159669 whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, nInMul+nIn);
159715 whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, nIter + nInMul);
159934 SrcItem *pSrc; /* The FROM clause btree term to add */
159946 pSrc = pTabList->a + pNew->iTab;
159947 pTab = pSrc->pTab;
159949 assert( !IsVirtual(pSrc->pTab) );
159951 if( pSrc->fg.isIndexedBy ){
159952 assert( pSrc->fg.isCte==0 );
159954 pProbe = pSrc->u2.pIBIndex;
159974 pFirst = pSrc->pTab->pIndex;
159975 if( pSrc->fg.notIndexed==0 ){
159989 && !pSrc->fg.isIndexedBy /* Has no INDEXED BY clause */
159990 && !pSrc->fg.notIndexed /* Has no NOT INDEXED clause */
159992 && !pSrc->fg.isCorrelated /* Not a correlated subquery */
159993 && !pSrc->fg.isRecursive /* Not a recursive common table expression. */
159994 && (pSrc->fg.jointype & JT_RIGHT)==0 /* Not the right tab of a RIGHT JOIN */
160003 if( termCanDriveIndex(pTerm, pSrc, 0) ){
160042 pProbe=(pSrc->fg.isIndexedBy ? 0 : pProbe->pNext), iSortIdx++
160045 && !whereUsablePartialIndex(pSrc->iCursor, pSrc->fg.jointype, pWC,
160048 testcase( pNew->iTab!=pSrc->iCursor ); /* See ticket [98d973b8f5] */
160063 b = indexMightHelpWithOrderBy(pBuilder, pProbe, pSrc->iCursor);
160104 m = pSrc->colUsed & pProbe->colNotIdxed;
160106 m = whereIsCoveringIndex(pWInfo, pProbe, pSrc->iCursor);
160115 || pSrc->fg.isIndexedBy
160138 int iCur = pSrc->iCursor;
160159 if( (pSrc->fg.jointype & JT_RIGHT)!=0 && pProbe->aColExpr ){
160173 rc = whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, 0);
160240 SrcItem *pSrc = &pBuilder->pWInfo->pTabList->a[pNew->iTab];
160270 pIdxInfo->colUsed = (sqlite3_int64)pSrc->colUsed;
160274 rc = vtabBestIndex(pParse, pSrc->pTab, pIdxInfo);
160303 sqlite3ErrorMsg(pParse,"%s.xBestIndex malfunction",pSrc->pTab->zName);
160364 sqlite3ErrorMsg(pParse,"%s.xBestIndex malfunction",pSrc->pTab->zName);
160554 SrcItem *pSrc; /* The FROM clause term to search */
160568 pSrc = &pWInfo->pTabList->a[pNew->iTab];
160569 assert( IsVirtual(pSrc->pTab) );
160570 p = allocateIndexInfo(pWInfo, pWC, mUnusable, pSrc, &mNoOmit);
160583 WHERETRACE(0x800, ("BEGIN %s.addVirtual()\n", pSrc->pTab->zName));
160667 WHERETRACE(0x800, ("END %s.addVirtual(), rc=%d\n", pSrc->pTab->zName, rc));
162378 sSelect.pSrc = pTabList;
162711 SrcItem *pSrc;
162715 pSrc = &pTabList->a[pLevel->iFrom];
162716 if( pSrc->fg.isMaterialized ){
162717 if( pSrc->fg.isCorrelated ){
162718 sqlite3VdbeAddOp2(v, OP_Gosub, pSrc->regReturn, pSrc->addrFillSub);
162721 sqlite3VdbeAddOp2(v, OP_Gosub, pSrc->regReturn, pSrc->addrFillSub);
163863 SrcList *pSrc;
163889 int nSrc = p->pSrc->nSrc;
163892 if( pExpr->iTable==p->pSrc->a[i].iCursor ) break;
163986 SrcList *pSrc,
164000 sRewrite.pSrc = pSrc;
164093 SrcList *pSrc = p->pSrc;
164119 p->pSrc = 0;
164147 selectWindowRewriteEList(pParse, pMWin, pSrc, p->pEList, pTab, &pSublist);
164148 selectWindowRewriteEList(pParse, pMWin, pSrc, p->pOrderBy, pTab, &pSublist);
164167 selectWindowRewriteEList(pParse, pMWin, pSrc, pArgs, pTab, &pSublist);
164196 pParse, pSublist, pSrc, pWhere, pGroupBy, pHaving, pSort, 0, 0
164201 p->pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0);
164202 assert( pSub!=0 || p->pSrc==0 ); /* Due to db->mallocFailed test inside
164205 if( p->pSrc ){
164207 p->pSrc->a[0].pSelect = pSub;
164208 sqlite3SrcListAssignCursors(pParse, p->pSrc);
164220 p->pSrc->a[0].pTab = pTab;
164515 int nEphExpr = pSelect->pSrc->a[0].pSelect->pEList->nExpr;
165914 int csrInput = p->pSrc->a[0].iCursor; /* Cursor of sub-select */
165915 int nInput = p->pSrc->a[0].pTab->nCol; /* Number of cols returned by sub */
170809 SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
170810 Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
170811 if( yymsp[0].minor.yy322 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy322);
201775 u8 *pSrc = &pDst[pRtree->nBytesPerCell];
201777 memmove(pDst, pSrc, nByte);
202749 RtreeMatchArg *pBlob, *pSrc; /* BLOB returned by geometry function */
202752 pSrc = sqlite3_value_pointer(pValue, "RtreeMatchArg");
202753 if( pSrc==0 ) return SQLITE_ERROR;
202755 sqlite3_malloc64( sizeof(*pInfo)+pSrc->iSize );
202759 memcpy(pBlob, pSrc, pSrc->iSize);