Lines Matching defs:pSrc

19379 ** be NULL.  The pSrc corresponds to the FROM clause of a SELECT or
19508 SrcList *pSrc; /* The FROM clause */
19556 #define SF_UFSrcCheck 0x0800000 /* Check pSrc as required by UPDATE...FROM */
32769 SQLITE_PRIVATE void sqlite3TreeViewSrcList(TreeView *pView, const SrcList *pSrc){
32771 if( pSrc==0 ) return;
32772 for(i=0; i<pSrc->nSrc; i++){
32773 const SrcItem *pItem = &pSrc->a[i];
32815 sqlite3TreeViewItem(pView, zLine, i<pSrc->nSrc-1);
32824 sqlite3TreeViewPush(&pView, i+1<pSrc->nSrc);
32873 if( p->pSrc && p->pSrc->nSrc ) n++;
32899 if( p->pSrc && p->pSrc->nSrc ){
32902 sqlite3TreeViewSrcList(pView, p->pSrc);
72115 ** The cell pCell is currently part of page pSrc but will ultimately be part
72116 ** of pPage. (pSrc and pPage are often the same.) If pCell contains a
72120 static void ptrmapPutOvflPtr(MemPage *pPage, MemPage *pSrc, u8 *pCell,int *pRC){
72127 if( SQLITE_OVERFLOW(pSrc->aDataEnd, pCell, pCell+info.nLocal) ){
72128 testcase( pSrc!=pPage );
77525 const u8 *pSrc;
77546 pSrc = pX->pData;
77554 pSrc = pX->pKey;
77573 memcpy(pPayload, pSrc, nSrc);
77631 memcpy(pPayload, pSrc, n);
77634 memcpy(pPayload, pSrc, n);
77641 pSrc += n;
80142 ** pSrc into cursor pDest. If the cursors are open on intkey tables, then
80155 SQLITE_PRIVATE int sqlite3BtreeTransferRow(BtCursor *pDest, BtCursor *pSrc, i64 iKey){
80162 getCellInfo(pSrc);
80163 if( pSrc->info.nPayload<0x80 ){
80164 *(aOut++) = pSrc->info.nPayload;
80166 aOut += sqlite3PutVarint(aOut, pSrc->info.nPayload);
80169 nIn = pSrc->info.nLocal;
80170 aIn = pSrc->info.pPayload;
80171 if( aIn+nIn>pSrc->pPage->aDataEnd ){
80172 return SQLITE_CORRUPT_PAGE(pSrc->pPage);
80174 nRem = pSrc->info.nPayload;
80181 Pager *pSrcPager = pSrc->pBt->pPager;
80188 nOut = btreePayloadToLocal(pDest->pPage, pSrc->info.nPayload);
80190 if( nOut<pSrc->info.nPayload ){
80196 if( aIn+nIn+4>pSrc->pPage->aDataEnd ){
80197 return SQLITE_CORRUPT_PAGE(pSrc->pPage);
80199 ovflIn = get4byte(&pSrc->info.pPayload[nIn]);
80222 nIn = pSrc->pBt->usableSize - 4;
82041 Btree *pSrc; /* Source b-tree file */
82126 rc = sqlite3BtreeSetPageSize(p->pDest,sqlite3BtreeGetPageSize(p->pSrc),0,0);
82196 p->pSrc = findBtree(pDestDb, pSrcDb, zSrcDb);
82203 if( 0==p->pSrc || 0==p->pDest
82216 p->pSrc->nBackup++;
82245 const int nSrcPgsz = sqlite3BtreeGetPageSize(p->pSrc);
82252 assert( sqlite3BtreeGetReserveNoMutex(p->pSrc)>=0 );
82255 assert( iSrcPg!=PENDING_BYTE_PAGE(p->pSrc->pBt) );
82284 sqlite3Put4byte(&zOut[28], sqlite3BtreeLastPage(p->pSrc));
82316 assert( sqlite3BtreeHoldsMutex(p->pSrc) );
82317 pp = sqlite3PagerBackupPtr(sqlite3BtreePager(p->pSrc));
82336 sqlite3BtreeEnter(p->pSrc);
82343 Pager * const pSrcPager = sqlite3BtreePager(p->pSrc); /* Source pager */
82352 if( p->pDestDb && p->pSrc->pBt->inTransaction==TRANS_WRITE ){
82362 if( rc==SQLITE_OK && SQLITE_TXN_NONE==sqlite3BtreeTxnState(p->pSrc) ){
82363 rc = sqlite3BtreeBeginTrans(p->pSrc, 0, 0);
82387 pgszSrc = sqlite3BtreeGetPageSize(p->pSrc);
82400 nSrcPage = (int)sqlite3BtreeLastPage(p->pSrc);
82404 if( iSrcPg!=PENDING_BYTE_PAGE(p->pSrc->pBt) ){
82459 assert( pgszSrc==sqlite3BtreeGetPageSize(p->pSrc) );
82562 TESTONLY( rc2 = ) sqlite3BtreeCommitPhaseOne(p->pSrc, 0);
82563 TESTONLY( rc2 |= ) sqlite3BtreeCommitPhaseTwo(p->pSrc, 0);
82575 sqlite3BtreeLeave(p->pSrc);
82592 sqlite3BtreeEnter(p->pSrc);
82599 p->pSrc->nBackup--;
82602 pp = sqlite3PagerBackupPtr(sqlite3BtreePager(p->pSrc));
82622 sqlite3BtreeLeave(p->pSrc);
82680 assert( sqlite3_mutex_held(p->pSrc->pBt->mutex) );
82716 assert( sqlite3_mutex_held(p->pSrc->pBt->mutex) );
82753 b.pSrc = pFrom;
98866 VdbeCursor *pSrc; /* Cursor to read from */
98873 pSrc = p->apCsr[pOp->p2];
98875 rc = sqlite3BtreeTransferRow(pDest->uc.pCursor, pSrc->uc.pCursor, iKey);
106627 SrcList *pSrc;
106631 pSrc = p->pSrc;
106632 if( ALWAYS(pSrc) ){
106633 for(i=pSrc->nSrc, pItem=pSrc->a; i>0; i--, pItem++){
107588 ** from datasource iSrc in SrcList pSrc.
107590 SQLITE_PRIVATE Expr *sqlite3CreateColumnExpr(sqlite3 *db, SrcList *pSrc, int iSrc, int iCol){
107593 SrcItem *pItem = &pSrc->a[iSrc];
108237 nc.pSrcList = pSelect->pSrc;
108605 Select *pSub = p->pSrc->a[0].pSelect;
108606 assert( p->pSrc->nSrc==1 && p->pOrderBy );
108615 for(i=0; i<p->pSrc->nSrc; i++){
108616 SrcItem *pItem = &p->pSrc->a[i];
108648 sNC.pSrcList = p->pSrc;
108691 for(i=0; i<p->pSrc->nSrc; i++){
108692 SrcItem *pItem = &p->pSrc->a[i];
108725 Select *pSub = p->pSrc->a[0].pSelect;
110949 pNew->pSrc = sqlite3SrcListDup(db, p->pSrc, flags);
111615 ** pSrc = &pSrcList->a[iSrc]. In other words, check to see if pExpr
111616 ** constrains pSrc but does not depend on any other tables or data
111618 ** is a constraint on pSrc only.
111626 ** (1) pExpr cannot refer to any table other than pSrc->iCursor.
111633 ** (3) pSrc cannot be part of the left operand for a RIGHT JOIN.
111636 ** (4) If pSrc is the right operand of a LEFT JOIN, then...
111640 ** (5) If pSrc is not the right operand of a LEFT JOIN or the left
111663 const SrcItem *pSrc = &pSrcList->a[iSrc];
111664 if( pSrc->fg.jointype & JT_LTORJ ){
111667 if( pSrc->fg.jointype & JT_LEFT ){
111669 if( pExpr->w.iJoin!=pSrc->iCursor ) return 0; /* rule (4b) */
111687 return sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor, bAllowSubq);
111960 SrcList *pSrc;
111976 pSrc = p->pSrc;
111977 assert( pSrc!=0 );
111978 if( pSrc->nSrc!=1 ) return 0; /* Single term in FROM clause */
111979 if( pSrc->a[0].pSelect ) return 0; /* FROM is not a subquery or view */
111980 pTab = pSrc->a[0].pTab;
111990 assert( pRes->iTable==pSrc->a[0].iCursor ); /* Not a correlated subquery */
112162 assert( p->pSrc!=0 ); /* Because of isCandidateForInOpt(p) */
112163 pTab = p->pSrc->a[0].pTab;
115557 SrcList *pSrc = pSelect->pSrc;
115560 if( pSrc->nSrc==0 ) return WRC_Continue;
115562 p->nExclude += pSrc->nSrc;
115570 for(i=0; i<pSrc->nSrc; i++, j++){
115571 p->aiExclude[j] = pSrc->a[i].iCursor;
115577 SrcList *pSrc = pSelect->pSrc;
115579 assert( p->nExclude>=pSrc->nSrc );
115580 p->nExclude -= pSrc->nSrc;
115598 SrcList *pSrc = p->pRef;
115599 int nSrc = pSrc ? pSrc->nSrc : 0;
115601 if( pExpr->iTable==pSrc->a[i].iCursor ){
116263 SrcList *pSrc, /* The table to rename. */
116277 assert( pSrc->nSrc==1 );
116280 pTab = sqlite3LocateTableItem(pParse, 0, &pSrc->a[0]);
116422 sqlite3SrcListDelete(db, pSrc);
116608 ** pSrc is the full-name of the table being altered.
116620 SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *pParse, SrcList *pSrc){
116632 pTab = sqlite3LocateTableItem(pParse, 0, &pSrc->a[0]);
116690 sqlite3SrcListDelete(db, pSrc);
116731 ** cmd ::= ALTER TABLE pSrc RENAME COLUMN pOld TO pNew
116735 SrcList *pSrc, /* Table being altered. pSrc->nSrc==1 */
116749 pTab = sqlite3LocateTableItem(pParse, 0, &pSrc->a[0]);
116815 sqlite3SrcListDelete(db, pSrc);
117031 if( ALWAYS(p->pSrc) ){ /* Every Select as a SrcList, even if it is empty */
117032 SrcList *pSrc = p->pSrc;
117033 for(i=0; i<pSrc->nSrc; i++){
117034 sqlite3RenameTokenRemap(pParse, 0, (void*)pSrc->a[i].zName);
117035 if( pSrc->a[i].fg.isUsing==0 ){
117036 sqlite3WalkExpr(pWalker, pSrc->a[i].u3.pOn);
117038 unmapColumnIdlistNames(pParse, pSrc->a[i].u3.pUsing);
117474 SrcList *pSrc = sqlite3TriggerStepSrc(pParse, pStep);
117475 if( pSrc ){
117477 pParse, pStep->pExprList, pSrc, 0, 0, 0, 0, 0, 0
117481 pSrc = 0;
117490 ** part of pSrc from being incorrectly resolved against the
117497 assert( pSrc==pSel->pSrc );
117499 pSel->pSrc = 0;
117515 sNC.pSrcList = pSrc;
117525 pUpsert->pUpsertSrc = pSrc;
117542 sqlite3SrcListDelete(db, pSrc);
117811 SrcList *pSrc = pSelect->pSrc;
117817 if( NEVER(pSrc==0) ){
117821 for(i=0; i<pSrc->nSrc; i++){
117822 SrcItem *pItem = &pSrc->a[i];
118286 ** ALTER TABLE pSrc DROP COLUMN pName
118288 ** statement. Argument pSrc contains the possibly qualified name of the
118291 SQLITE_PRIVATE void sqlite3AlterDropColumn(Parse *pParse, SrcList *pSrc, const Token *pName){
118303 pTab = sqlite3LocateTableItem(pParse, 0, &pSrc->a[0]);
118432 sqlite3SrcListDelete(db, pSrc);
120949 SrcList *pList = pSelect->pSrc;
121036 s.pSrc = pList;
124497 sqlite3SrcListAssignCursors(pParse, pSel->pSrc);
126136 SrcList *pSrc, /* The SrcList to be enlarged */
126137 int nExtra, /* Number of new slots to add to pSrc->a[] */
126138 int iStart /* Index in pSrc->a[] of first new slot */
126145 assert( pSrc!=0 );
126146 assert( iStart<=pSrc->nSrc );
126149 if( (u32)pSrc->nSrc+nExtra>pSrc->nAlloc ){
126151 sqlite3_int64 nAlloc = 2*(sqlite3_int64)pSrc->nSrc+nExtra;
126154 if( pSrc->nSrc+nExtra>=SQLITE_MAX_SRCLIST ){
126160 pNew = sqlite3DbRealloc(db, pSrc,
126161 sizeof(*pSrc) + (nAlloc-1)*sizeof(pSrc->a[0]) );
126166 pSrc = pNew;
126167 pSrc->nAlloc = nAlloc;
126172 for(i=pSrc->nSrc-1; i>=iStart; i--){
126173 pSrc->a[i+nExtra] = pSrc->a[i];
126175 pSrc->nSrc += nExtra;
126178 memset(&pSrc->a[iStart], 0, sizeof(pSrc->a[0])*nExtra);
126180 pSrc->a[i].iCursor = -1;
126184 return pSrc;
126277 sqlite3SrcListAssignCursors(pParse, pItem->pSelect->pSrc);
127636 ** The following fields are initialized appropriate in pSrc:
127638 ** pSrc->a[0].pTab Pointer to the Table object
127639 ** pSrc->a[0].pIndex Pointer to the INDEXED BY index, if there is one
127642 SQLITE_PRIVATE Table *sqlite3SrcListLookup(Parse *pParse, SrcList *pSrc){
127643 SrcItem *pItem = pSrc->a;
127645 assert( pItem && pSrc->nSrc>=1 );
127793 SrcList *pSrc, /* the FROM clause -- which tables to scan */
127803 SrcList *pSelectSrc = NULL; /* SELECT rowid FROM x ... (dup of pSrc) */
127832 pTab = pSrc->a[0].pTab;
127865 pSrc->a[0].pTab = 0;
127866 pSelectSrc = sqlite3SrcListDup(db, pSrc, 0);
127867 pSrc->a[0].pTab = pTab;
127868 if( pSrc->a[0].fg.isIndexedBy ){
127869 assert( pSrc->a[0].fg.isCte==0 );
127870 pSrc->a[0].u2.pIBIndex = 0;
127871 pSrc->a[0].fg.isIndexedBy = 0;
127872 sqlite3DbFree(db, pSrc->a[0].u1.zIndexedBy);
127873 }else if( pSrc->a[0].fg.isCte ){
127874 pSrc->a[0].u2.pCteUse->nUse++;
131949 SrcList *pSrc, /* The child table to be scanned */
131952 FKey *pFKey, /* The foreign key linking pSrc to pTab */
132020 pRight = exprTableColumn(db, pTab, pSrc->a[0].iCursor, -1);
132040 sNameContext.pSrcList = pSrc;
132044 /* Create VDBE to loop through the entries in pSrc that match the WHERE
132048 pWInfo = sqlite3WhereBegin(pParse, pSrc, pWhere, 0, 0, 0, 0, 0);
132419 SrcList *pSrc;
132443 pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0);
132444 if( pSrc ){
132445 SrcItem *pItem = pSrc->a;
132452 fkScanChildren(pParse, pSrc, pTab, pIdx, pFKey, aiCol, regNew, -1);
132458 fkScanChildren(pParse, pSrc, pTab, pIdx, pFKey, aiCol, regOld, 1);
132481 sqlite3SrcListDelete(db, pSrc);
132728 SrcList *pSrc;
132735 pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0);
132736 if( pSrc ){
132737 assert( pSrc->nSrc==1 );
132738 pSrc->a[0].zName = sqlite3DbStrDup(db, zFrom);
132739 pSrc->a[0].zDatabase = sqlite3DbStrDup(db, db->aDb[iDb].zDbSName);
132743 pSrc,
133471 if( ALWAYS(pVal) && pVal->pSrc->nSrc>0 ){
133472 SrcItem *pItem = &pVal->pSrc->a[0];
133563 || (pLeft->pSrc->nSrc==0 &&
133570 if( pLeft->pSrc->nSrc ){
133587 if( pLeft->pSrc->nSrc==0 ){
133602 pRet->pSrc->nSrc = 1;
133609 p = &pRet->pSrc->a[0];
133635 p = &pLeft->pSrc->a[0];
133992 if( pSelect->pSrc->nSrc==1
133993 && pSelect->pSrc->a[0].fg.viaCoroutine
133996 SrcItem *pItem = &pSelect->pSrc->a[0];
135805 ** Check to see if index pSrc is compatible as a source of data
135815 static int xferCompatibleIndex(Index *pDest, Index *pSrc){
135817 assert( pDest && pSrc );
135818 assert( pDest->pTable!=pSrc->pTable );
135819 if( pDest->nKeyCol!=pSrc->nKeyCol || pDest->nColumn!=pSrc->nColumn ){
135822 if( pDest->onError!=pSrc->onError ){
135825 for(i=0; i<pSrc->nKeyCol; i++){
135826 if( pSrc->aiColumn[i]!=pDest->aiColumn[i] ){
135829 if( pSrc->aiColumn[i]==XN_EXPR ){
135830 assert( pSrc->aColExpr!=0 && pDest->aColExpr!=0 );
135831 if( sqlite3ExprCompare(0, pSrc->aColExpr->a[i].pExpr,
135836 if( pSrc->aSortOrder[i]!=pDest->aSortOrder[i] ){
135839 if( sqlite3_stricmp(pSrc->azColl[i],pDest->azColl[i])!=0 ){
135843 if( sqlite3ExprCompare(0, pSrc->pPartIdxWhere, pDest->pPartIdxWhere, -1) ){
135885 Table *pSrc; /* The table in the FROM clause of SELECT */
135887 SrcItem *pItem; /* An element of pSelect->pSrc */
135889 int iDbSrc; /* The database of pSrc */
135893 int emptySrcTest = 0; /* Address of test for empty pSrc */
135915 assert(pSelect->pSrc); /* allocated even if there is no FROM clause */
135916 if( pSelect->pSrc->nSrc!=1 ){
135919 if( pSelect->pSrc->a[0].pSelect ){
135956 pItem = pSelect->pSrc->a;
135957 pSrc = sqlite3LocateTableItem(pParse, 0, pItem);
135958 if( pSrc==0 ){
135961 if( pSrc->tnum==pDest->tnum && pSrc->pSchema==pDest->pSchema ){
135962 testcase( pSrc!=pDest ); /* Possible due to bad sqlite_schema.rootpage */
135965 if( HasRowid(pDest)!=HasRowid(pSrc) ){
135968 if( !IsOrdinaryTable(pSrc) ){
135971 if( pDest->nCol!=pSrc->nCol ){
135974 if( pDest->iPKey!=pSrc->iPKey ){
135977 if( (pDest->tabFlags & TF_Strict)!=0 && (pSrc->tabFlags & TF_Strict)==0 ){
135982 Column *pSrcCol = &pSrc->aCol[i];
136017 sqlite3ColumnExpr(pSrc, pSrcCol),
136038 Expr *pSrcExpr = sqlite3ColumnExpr(pSrc, pSrcCol);
136055 for(pSrcIdx=pSrc->pIndex; pSrcIdx; pSrcIdx=pSrcIdx->pNext){
136059 return 0; /* pDestIdx has no corresponding index in pSrc */
136061 if( pSrcIdx->tnum==pDestIdx->tnum && pSrc->pSchema==pDest->pSchema
136072 && sqlite3ExprListCompare(pSrc->pCheck,pDest->pCheck,-1)
136101 iDbSrc = sqlite3SchemaToIndex(db, pSrc->pSchema);
136138 if( HasRowid(pSrc) ){
136140 sqlite3OpenTable(pParse, iSrc, iDbSrc, pSrc, OP_OpenRead);
136185 sqlite3TableLock(pParse, iDbSrc, pSrc->tnum, 0, pSrc->zName);
136189 for(pSrcIdx=pSrc->pIndex; ALWAYS(pSrcIdx); pSrcIdx=pSrcIdx->pNext){
136225 }else if( !HasRowid(pSrc) && pDestIdx->idxType==SQLITE_IDXTYPE_PRIMARYKEY ){
142969 sqlite3SrcListDelete(db, p->pSrc);
143011 SrcList *pSrc, /* the FROM clause -- which tables to scan */
143039 if( pSrc==0 ) pSrc = sqlite3DbMallocZero(pParse->db, sizeof(*pSrc));
143040 pNew->pSrc = pSrc;
143057 assert( pNew->pSrc!=0 || pParse->nErr>0 );
143229 ** Search the tables iStart..iEnd (inclusive) in pSrc, looking for a
143239 SrcList *pSrc, /* Array of tables to search */
143240 int iStart, /* First member of pSrc->a[] to check */
143241 int iEnd, /* Last member of pSrc->a[] to check */
143243 int *piTab, /* Write index of pSrc->a[] here */
143244 int *piCol, /* Write index of pSrc->a[*piTab].pTab->aCol[] here */
143247 int i; /* For looping over tables in pSrc */
143250 assert( iEnd<pSrc->nSrc );
143255 iCol = sqlite3ColumnIndex(pSrc->a[i].pTab, zCol);
143257 && (bIgnoreHidden==0 || IsHiddenColumn(&pSrc->a[i].pTab->aCol[iCol])==0)
143260 sqlite3SrcItemColumnUsed(&pSrc->a[i], iCol);
143367 ** The terms of a FROM clause are contained in the Select.pSrc structure.
143368 ** The left most table is the first entry in Select.pSrc. The right-most
143377 SrcList *pSrc; /* All tables in the FROM clause */
143382 pSrc = p->pSrc;
143383 pLeft = &pSrc->a[0];
143385 for(i=0; i<pSrc->nSrc-1; i++, pRight++, pLeft++){
143407 if( tableAndColumnIndex(pSrc, 0, i, zName, 0, 0, 1) ){
143447 || tableAndColumnIndex(pSrc, 0, i, zName, &iLeft, &iLeftCol,
143454 pE1 = sqlite3CreateColumnExpr(db, pSrc, iLeft, iLeftCol);
143455 sqlite3SrcItemColumnUsed(&pSrc->a[iLeft], iLeftCol);
143456 if( (pSrc->a[0].fg.jointype & JT_LTORJ)!=0 ){
143472 while( tableAndColumnIndex(pSrc, iLeft+1, i, zName, &iLeft, &iLeftCol,
143474 if( pSrc->a[iLeft].fg.isUsing==0
143475 || sqlite3IdListIndex(pSrc->a[iLeft].u3.pUsing, zName)<0
143482 pE1 = sqlite3CreateColumnExpr(db, pSrc, iLeft, iLeftCol);
143483 sqlite3SrcItemColumnUsed(&pSrc->a[iLeft], iLeftCol);
143490 pE2 = sqlite3CreateColumnExpr(db, pSrc, i+1, iRightCol);
144852 sNC.pSrcList = pS->pSrc;
144898 sNC.pSrcList = pS->pSrc;
145006 pTabList = pSelect->pSrc;
145216 sNC.pSrcList = pSelect->pSrc;
145510 SrcList *pSrc = p->pSrc; /* The FROM clause of the recursive query */
145551 for(i=0; ALWAYS(i<pSrc->nSrc); i++){
145552 if( pSrc->a[i].fg.isRecursive ){
145553 iCurrent = pSrc->a[i].iCursor;
146844 SrcList *pSrc;
146854 pSrc = p->pSrc;
146855 assert( pSrc!=0 );
146856 for(i=pSrc->nSrc, pItem=pSrc->a; i>0; i--, pItem++){
146900 ** Assign new cursor numbers to each of the items in pSrc. For each
146907 ** existing cursor numbers in pSrc. aCsrMap[0] is the array size.
146909 ** If pSrc contains any sub-selects, call this routine recursively
146915 SrcList *pSrc, /* FROM clause to renumber */
146920 for(i=0, pItem=pSrc->a; i<pSrc->nSrc; i++, pItem++){
146929 srclistRenumberCursors(pParse, aCsrMap, p->pSrc, -1);
146962 ** Assign a new cursor number to each cursor in the FROM clause (Select.pSrc)
146986 srclistRenumberCursors(pParse, aCsrMap, p->pSrc, iExcept);
147200 ** The subquery is p->pSrc->a[iFrom]. isAgg is true if the outer query
147212 int iFrom, /* Index in p->pSrc->a[] of the inner subquery */
147219 SrcList *pSrc; /* The FROM clause of the outer query */
147236 pSrc = p->pSrc;
147237 assert( pSrc && iFrom>=0 && iFrom<pSrc->nSrc );
147238 pSubitem = &pSrc->a[iFrom];
147247 pSubSrc = pSub->pSrc;
147261 if( pSub->pLimit && (pSrc->nSrc>1 || isAgg) ){
147326 assert( pSub->pSrc!=0 );
147331 || pSub1->pSrc->nSrc<1 /* (17c) */
147338 if( iFrom>0 && (pSub1->pSrc->a[0].fg.jointype & JT_LTORJ)!=0 ){
147344 testcase( pSub1->pSrc->nSrc>1 );
147360 if( pSrc->nSrc>1 ){
147495 u8 ltorj = pSrc->a[iFrom].fg.jointype & JT_LTORJ;
147497 pSubSrc = pSub->pSrc; /* FROM clause of subquery */
147499 pSrc = pParent->pSrc; /* FROM clause of the outer query */
147521 pSrc = sqlite3SrcListEnlarge(pParse, pSrc, nSubSrc-1,iFrom+1);
147522 if( pSrc==0 ) break;
147523 pParent->pSrc = pSrc;
147530 SrcItem *pItem = &pSrc->a[i+iFrom];
147538 pSrc->a[iFrom].fg.jointype &= JT_LTORJ;
147539 pSrc->a[iFrom].fg.jointype |= jointype | ltorj;
147563 ** currently part of pSub->pSrc). See ticket [d11a6e908f]. */
147614 recomputeColumnsUsed(pParent, &pSrc->a[i+iFrom]);
147877 if( ALWAYS(p->pSrc!=0)
147878 && p->pSrc->nSrc>0
147879 && (p->pSrc->a[0].fg.jointype & JT_LTORJ)!=0
148050 SrcItem *pSrc; /* The subquery FROM term into which WHERE is pushed */
148052 pSrc = &pSrcList->a[iSrc];
148057 if( pSrc->fg.jointype & (JT_LTORJ|JT_RIGHT) ){
148169 x.iTable = pSrc->iCursor;
148170 x.iNewTable = pSrc->iCursor;
148346 || p->pSrc->nSrc!=1
148347 || p->pSrc->a[0].pSelect
148353 pTab = p->pSrc->a[0].pTab;
148457 p->pSrc = pNewSrc;
148663 SrcList *pSrc = pRecTerm->pSrc;
148665 for(i=0; i<pSrc->nSrc; i++){
148666 SrcItem *pItem = &pSrc->a[i];
148865 assert( p->pSrc!=0 );
148873 pTabList = p->pSrc;
149297 pTabList = p->pSrc;
150027 if( p->pSrc->nSrc!=1 ) return 0; /* One table in FROM */
150029 pSub = p->pSrc->a[0].pSelect;
150047 pSub = p->pSrc->a[0].pSelect;
150048 p->pSrc->a[0].pSelect = 0;
150049 sqlite3SrcListDelete(db, p->pSrc);
150050 p->pSrc = sqlite3DbMallocZero(pParse->db, sizeof(*p->pSrc));
150084 ** If any term of pSrc, or any SF_NestedFrom sub-query, is not the same
150088 static int sameSrcAlias(SrcItem *p0, SrcList *pSrc){
150090 for(i=0; i<pSrc->nSrc; i++){
150091 SrcItem *p1 = &pSrc->a[i];
150098 && sameSrcAlias(p0, p1->pSelect->pSrc)
150262 ** In this case, it is an error if the target object (pSrc->a[0]) name
150263 ** or alias is duplicated within FROM clause (pSrc->a[1..n]).
150270 SrcItem *p0 = &p->pSrc->a[0];
150271 if( sameSrcAlias(p0, p->pSrc) ){
150281 ** in p->pSrc is flattened into this query and this function called
150302 pTabList = p->pSrc;
150469 pTabList = p->pSrc;
150518 pTabList = p->pSrc;
151332 if( !p->pSrc->a[0].fg.notIndexed ){
152565 SrcList *pSrc; /* SrcList to be returned */
152567 pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0);
152568 assert( pSrc==0 || pSrc->nSrc==1 );
152569 assert( zName || pSrc==0 );
152570 if( pSrc ){
152572 pSrc->a[0].zName = zName;
152574 pSrc->a[0].pSchema = pSchema;
152586 pSrc = sqlite3SrcListAppendList(pParse, pSrc, pDup);
152591 return pSrc;
152682 SrcList *pSrc;
152684 pSrc = pSelect->pSrc;
152685 assert( pSrc!=0 );
152686 for(i=0; i<pSrc->nSrc; i++){
152687 if( pSrc->a[i].pTab==pWalker->u.pTab ){
152756 sSelect.pSrc = &sFrom;
153285 SrcList *pSrc, /* The virtual table to be modified */
153405 ** table in the source-list (pSrc->a[0]).
153470 SrcList *pSrc;
153486 pSrc = sqlite3SrcListDup(db, pTabList, 0);
153490 if( pSrc ){
153491 assert( pSrc->a[0].fg.notCte );
153492 pSrc->a[0].iCursor = -1;
153493 pSrc->a[0].pTab->nTabRef--;
153494 pSrc->a[0].pTab = 0;
153530 pSrc, pWhere2, pGrp, 0, pOrderBy2,
154468 SrcList *pSrc, /* The virtual table to be modified */
154486 int iCsr = pSrc->a[0].iCursor; /* Cursor used for virtual table scan */
154499 if( pSrc->nSrc>1 ){
154535 updateFromSelect(pParse, ephemTab, pPk, pList, pSrc, pWhere, 0, 0);
154544 pParse, pSrc, pWhere, 0, 0, 0, WHERE_ONEPASS_DESIRED, 0
154604 if( pSrc->nSrc==1 ){
154911 SrcList *pSrc; /* FROM clause for the UPDATE */
154952 pSrc = sqlite3SrcListDup(db, pTop->pUpsertSrc, 0);
154959 sqlite3Update(pParse, pSrc, sqlite3ExprListDup(db,pUpsert->pUpsertSet,0),
160745 SrcList *pSrc, /* the FROM clause */
160780 exprAnalyze(pSrc, pWC, idxNew);
160872 SrcList *pSrc, /* the FROM clause */
160902 sqlite3WhereExprAnalyze(pSrc, pOrWc);
160930 sqlite3WhereExprAnalyze(pSrc, pAndWC);
160983 whereCombineDisjuncts(pSrc, pWC, pOne, pTwo);
161119 exprAnalyze(pSrc, pWC, idxNew);
161171 SrcList *pSrc = pS->pSrc;
161177 if( ALWAYS(pSrc!=0) ){
161179 for(i=0; i<pSrc->nSrc; i++){
161180 mask |= exprSelectUsage(pMaskSet, pSrc->a[i].pSelect);
161181 if( pSrc->a[i].fg.isUsing==0 ){
161182 mask |= sqlite3WhereExprUsage(pMaskSet, pSrc->a[i].u3.pOn);
161184 if( pSrc->a[i].fg.isTabFunc ){
161185 mask |= sqlite3WhereExprListUsage(pMaskSet, pSrc->a[i].u1.pFuncArg);
161291 SrcList *pSrc, /* the FROM clause */
161370 if( ALWAYS(pSrc->nSrc>0) && (pSrc->a[0].fg.jointype & JT_LTORJ)!=0 ){
161394 if( exprMightBeIndexed(pSrc, aiCurCol, pLeft, op) ){
161402 && exprMightBeIndexed(pSrc, aiCurCol, pRight, op)
161487 exprAnalyze(pSrc, pWC, idxNew);
161500 exprAnalyzeOrTerm(pSrc, pWC, idxTerm);
161620 exprAnalyze(pSrc, pWC, idxNew1);
161621 exprAnalyze(pSrc, pWC, idxNew2);
161657 exprAnalyze(pSrc, pWC, idxNew);
161688 exprAnalyze(pSrc, pWC, idxNew);
161850 && (p->pSrc->nSrc==1 && IsVirtual(p->pSrc->a[0].pTab)) /* 3 */
161853 int iCsr = p->pSrc->a[0].iCursor;
162297 ** Move the content of pSrc into pDest
162299 static void whereOrMove(WhereOrSet *pDest, WhereOrSet *pSrc){
162300 pDest->n = pSrc->n;
162301 memcpy(pDest->a, pSrc->a, pDest->n*sizeof(pDest->a[0]));
162917 ** We know that pSrc is an operand of an outer join. Return true if
162920 ** pTerm must be EP_OuterON if pSrc is the right operand of an
162921 ** outer join. pTerm can be either EP_OuterON or EP_InnerON if pSrc
162931 const SrcItem *pSrc /* Table we are trying to access */
162933 assert( (pSrc->fg.jointype&(JT_LEFT|JT_LTORJ|JT_RIGHT))!=0 ); /* By caller */
162934 testcase( (pSrc->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT))==JT_LEFT );
162935 testcase( (pSrc->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT))==JT_LTORJ );
162939 || pTerm->pExpr->w.iJoin != pSrc->iCursor
162943 if( (pSrc->fg.jointype & (JT_LEFT|JT_RIGHT))!=0
162956 ** could be used with an index to access pSrc, assuming an appropriate
162961 const SrcItem *pSrc, /* Table we are trying to access */
162965 if( pTerm->leftCursor!=pSrc->iCursor ) return 0;
162967 assert( (pSrc->fg.jointype & JT_RIGHT)==0 );
162968 if( (pSrc->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT))!=0
162969 && !constraintCompatibleWithOuterJoin(pTerm,pSrc)
162976 aff = pSrc->pTab->aCol[pTerm->u.x.leftColumn].affinity;
163058 int mxBitCol; /* Maximum column in pSrc->colUsed */
163069 SrcItem *pSrc; /* The FROM clause term to get the next index */
163086 pSrc = &pTabList->a[pLevel->iFrom];
163087 pTable = pSrc->pTab;
163095 ** rows of the target table (pSrc) that can be used. */
163102 if( termCanDriveIndex(pTerm, pSrc, notReady) ){
163141 extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1));
163149 if( pSrc->colUsed & MASKBIT(BMS-1) ){
163162 if( termCanDriveIndex(pTerm, pSrc, notReady) ){
163202 if( pSrc->colUsed & MASKBIT(BMS-1) ){
163227 assert( pSrc == &pWC->pWInfo->pTabList->a[pLevel->iFrom] );
163228 if( pSrc->fg.viaCoroutine ){
163229 int regYield = pSrc->regReturn;
163231 sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, pSrc->addrFillSub);
163234 VdbeComment((v, "next row of %s", pSrc->pTab->zName));
163255 if( pSrc->fg.viaCoroutine ){
163260 pSrc->regResult, pLevel->iIdxCur);
163262 pSrc->fg.viaCoroutine = 0;
163429 SrcItem *pSrc, /* The FROM clause term that is the vtab */
163447 assert( pSrc!=0 );
163448 pTab = pSrc->pTab;
163458 if( pTerm->leftCursor != pSrc->iCursor ) continue;
163471 if( (pSrc->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT))!=0
163472 && !constraintCompatibleWithOuterJoin(pTerm,pSrc)
163500 if( pExpr->op==TK_COLUMN && pExpr->iTable==pSrc->iCursor ){
163509 && pE2->iTable==pSrc->iCursor
163527 if( (pWInfo->wctrlFlags & WHERE_DISTINCTBY) && !pSrc->fg.rowidUsed ){
165095 SrcItem *pSrc, /* FROM clause term being analyzed */
165096 Index *pProbe, /* An index on pSrc */
165138 if( pProbe->bLowQual && pSrc->fg.isIndexedBy==0 ){
165155 pTerm = whereScanInit(&scan, pBuilder->pWC, pSrc->iCursor, saved_nEq,
165179 if( (pSrc->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT))!=0
165180 && !constraintCompatibleWithOuterJoin(pTerm,pSrc)
165293 pParse, pSrc->iCursor, pProbe, saved_nEq, pTerm
165414 assert( pSrc->pTab->szTabRow>0 );
165422 rCostIdx = pNew->nOut + 1 + (15*pProbe->szIdxRow)/pSrc->pTab->szTabRow;
165458 whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, nInMul+nIn);
165504 whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, nIter + nInMul);
165874 SrcItem *pSrc; /* The FROM clause btree term to add */
165886 pSrc = pTabList->a + pNew->iTab;
165887 pTab = pSrc->pTab;
165889 assert( !IsVirtual(pSrc->pTab) );
165891 if( pSrc->fg.isIndexedBy ){
165892 assert( pSrc->fg.isCte==0 );
165894 pProbe = pSrc->u2.pIBIndex;
165914 pFirst = pSrc->pTab->pIndex;
165915 if( pSrc->fg.notIndexed==0 ){
165929 && !pSrc->fg.isIndexedBy /* Has no INDEXED BY clause */
165930 && !pSrc->fg.notIndexed /* Has no NOT INDEXED clause */
165932 && !pSrc->fg.isCorrelated /* Not a correlated subquery */
165933 && !pSrc->fg.isRecursive /* Not a recursive common table expression. */
165934 && (pSrc->fg.jointype & JT_RIGHT)==0 /* Not the right tab of a RIGHT JOIN */
165943 if( termCanDriveIndex(pTerm, pSrc, 0) ){
165983 pProbe=(pSrc->fg.isIndexedBy ? 0 : pProbe->pNext), iSortIdx++
165986 && !whereUsablePartialIndex(pSrc->iCursor, pSrc->fg.jointype, pWC,
165989 testcase( pNew->iTab!=pSrc->iCursor ); /* See ticket [98d973b8f5] */
166004 b = indexMightHelpWithOrderBy(pBuilder, pProbe, pSrc->iCursor);
166042 m = pSrc->colUsed & pProbe->colNotIdxed;
166050 u32 isCov = whereIsCoveringIndex(pWInfo, pProbe, pSrc->iCursor);
166082 || pSrc->fg.isIndexedBy
166105 int iCur = pSrc->iCursor;
166126 if( (pSrc->fg.jointype & JT_RIGHT)!=0 && pProbe->aColExpr ){
166140 rc = whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, 0);
166222 SrcItem *pSrc = &pBuilder->pWInfo->pTabList->a[pNew->iTab];
166252 pIdxInfo->colUsed = (sqlite3_int64)pSrc->colUsed;
166256 rc = vtabBestIndex(pParse, pSrc->pTab, pIdxInfo);
166285 sqlite3ErrorMsg(pParse,"%s.xBestIndex malfunction",pSrc->pTab->zName);
166353 sqlite3ErrorMsg(pParse,"%s.xBestIndex malfunction",pSrc->pTab->zName);
166538 SrcItem *pSrc; /* The FROM clause term to search */
166552 pSrc = &pWInfo->pTabList->a[pNew->iTab];
166553 assert( IsVirtual(pSrc->pTab) );
166554 p = allocateIndexInfo(pWInfo, pWC, mUnusable, pSrc, &mNoOmit);
166567 WHERETRACE(0x800, ("BEGIN %s.addVirtual()\n", pSrc->pTab->zName));
166651 WHERETRACE(0x800, ("END %s.addVirtual(), rc=%d\n", pSrc->pTab->zName, rc));
168569 sSelect.pSrc = pTabList;
168920 SrcItem *pSrc;
168924 pSrc = &pTabList->a[pLevel->iFrom];
168925 if( pSrc->fg.isMaterialized ){
168926 if( pSrc->fg.isCorrelated ){
168927 sqlite3VdbeAddOp2(v, OP_Gosub, pSrc->regReturn, pSrc->addrFillSub);
168930 sqlite3VdbeAddOp2(v, OP_Gosub, pSrc->regReturn, pSrc->addrFillSub);
169161 SrcItem *pSrc = &pTabList->a[pLevel->iFrom];
169162 assert( pLevel->iTabCur==pSrc->iCursor );
169163 if( pSrc->fg.viaCoroutine ){
169165 n = pSrc->regResult;
169166 assert( pSrc->pTab!=0 );
169167 m = pSrc->pTab->nCol;
170094 SrcList *pSrc;
170120 int nSrc = p->pSrc->nSrc;
170123 if( pExpr->iTable==p->pSrc->a[i].iCursor ) break;
170218 SrcList *pSrc,
170232 sRewrite.pSrc = pSrc;
170325 SrcList *pSrc = p->pSrc;
170351 p->pSrc = 0;
170379 selectWindowRewriteEList(pParse, pMWin, pSrc, p->pEList, pTab, &pSublist);
170380 selectWindowRewriteEList(pParse, pMWin, pSrc, p->pOrderBy, pTab, &pSublist);
170399 selectWindowRewriteEList(pParse, pMWin, pSrc, pArgs, pTab, &pSublist);
170428 pParse, pSublist, pSrc, pWhere, pGroupBy, pHaving, pSort, 0, 0
170433 p->pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0);
170434 assert( pSub!=0 || p->pSrc==0 ); /* Due to db->mallocFailed test inside
170437 if( p->pSrc ){
170439 p->pSrc->a[0].pSelect = pSub;
170440 p->pSrc->a[0].fg.isCorrelated = 1;
170441 sqlite3SrcListAssignCursors(pParse, p->pSrc);
170453 p->pSrc->a[0].pTab = pTab;
170749 int nEphExpr = pSelect->pSrc->a[0].pSelect->pEList->nExpr;
172148 int csrInput = p->pSrc->a[0].iCursor; /* Cursor of sub-select */
172149 int nInput = p->pSrc->a[0].pTab->nCol; /* Number of cols returned by sub */
177135 SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
177136 Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
177137 if( yymsp[0].minor.yy14 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy14);
211159 u8 *pSrc = &pDst[pRtree->nBytesPerCell];
211161 memmove(pDst, pSrc, nByte);
212141 RtreeMatchArg *pBlob, *pSrc; /* BLOB returned by geometry function */
212144 pSrc = sqlite3_value_pointer(pValue, "RtreeMatchArg");
212145 if( pSrc==0 ) return SQLITE_ERROR;
212147 sqlite3_malloc64( sizeof(*pInfo)+pSrc->iSize );
212151 memcpy(pBlob, pSrc, pSrc->iSize);