Lines Matching refs:pSrc

12287   SrcList *pSrc;         /* The FROM clause */  member
22049 SrcList *pSrc = va_arg(ap, SrcList*);
22051 struct SrcList_item *pItem = &pSrc->a[k];
22053 assert( k>=0 && k<pSrc->nSrc );
58865 const u8 *pSrc;
58896 pSrc = pData;
58904 pSrc = pKey;
59020 assert( pSrc );
59021 memcpy(pPayload, pSrc, n);
59027 pSrc += n;
59032 pSrc = pData;
62327 Btree *pSrc; /* Source b-tree file */
62419 rc = sqlite3BtreeSetPageSize(p->pDest,sqlite3BtreeGetPageSize(p->pSrc),-1,0);
62489 p->pSrc = findBtree(pDestDb, pSrcDb, zSrcDb);
62496 if( 0==p->pSrc || 0==p->pDest
62510 p->pSrc->nBackup++;
62539 const int nSrcPgsz = sqlite3BtreeGetPageSize(p->pSrc);
62547 int nSrcReserve = sqlite3BtreeGetReserveNoMutex(p->pSrc);
62553 assert( sqlite3BtreeGetReserveNoMutex(p->pSrc)>=0 );
62556 assert( iSrcPg!=PENDING_BYTE_PAGE(p->pSrc->pBt) );
62611 sqlite3Put4byte(&zOut[28], sqlite3BtreeLastPage(p->pSrc));
62643 assert( sqlite3BtreeHoldsMutex(p->pSrc) );
62644 pp = sqlite3PagerBackupPtr(sqlite3BtreePager(p->pSrc));
62663 sqlite3BtreeEnter(p->pSrc);
62670 Pager * const pSrcPager = sqlite3BtreePager(p->pSrc); /* Source pager */
62679 if( p->pDestDb && p->pSrc->pBt->inTransaction==TRANS_WRITE ){
62697 if( rc==SQLITE_OK && 0==sqlite3BtreeIsInReadTrans(p->pSrc) ){
62698 rc = sqlite3BtreeBeginTrans(p->pSrc, 0);
62704 pgszSrc = sqlite3BtreeGetPageSize(p->pSrc);
62714 nSrcPage = (int)sqlite3BtreeLastPage(p->pSrc);
62718 if( iSrcPg!=PENDING_BYTE_PAGE(p->pSrc->pBt) ){
62774 assert( pgszSrc==sqlite3BtreeGetPageSize(p->pSrc) );
62877 TESTONLY( rc2 = ) sqlite3BtreeCommitPhaseOne(p->pSrc, 0);
62878 TESTONLY( rc2 |= ) sqlite3BtreeCommitPhaseTwo(p->pSrc, 0);
62890 sqlite3BtreeLeave(p->pSrc);
62907 sqlite3BtreeEnter(p->pSrc);
62914 p->pSrc->nBackup--;
62917 pp = sqlite3PagerBackupPtr(sqlite3BtreePager(p->pSrc));
62935 sqlite3BtreeLeave(p->pSrc);
62989 assert( sqlite3_mutex_held(p->pSrc->pBt->mutex) );
63022 assert( sqlite3_mutex_held(p->pSrc->pBt->mutex) );
63059 b.pSrc = pFrom;
81238 SrcList *pSrc;
81242 pSrc = p->pSrc;
81243 if( ALWAYS(pSrc) ){
81244 for(i=pSrc->nSrc, pItem=pSrc->a; i>0; i--, pItem++){
81826 SQLITE_PRIVATE Expr *sqlite3CreateColumnExpr(sqlite3 *db, SrcList *pSrc, int iSrc, int iCol){
81829 struct SrcList_item *pItem = &pSrc->a[iSrc];
82174 nc.pSrcList = pSelect->pSrc;
82494 Select *pSub = p->pSrc->a[0].pSelect;
82495 assert( p->pSrc->nSrc==1 && p->pOrderBy );
82503 for(i=0; i<p->pSrc->nSrc; i++){
82504 struct SrcList_item *pItem = &p->pSrc->a[i];
82532 sNC.pSrcList = p->pSrc;
82588 Select *pSub = p->pSrc->a[0].pSelect;
83890 pNew->pSrc = sqlite3SrcListDup(db, p->pSrc, flags);
84340 SrcList *pSrc;
84354 pSrc = p->pSrc;
84355 assert( pSrc!=0 );
84356 if( pSrc->nSrc!=1 ) return 0; /* Single term in FROM clause */
84357 if( pSrc->a[0].pSelect ) return 0; /* FROM is not a subquery or view */
84358 pTab = pSrc->a[0].pTab;
84508 assert( p->pSrc!=0 ); /* Because of isCandidateForInOpt(p) */
84509 pTab = p->pSrc->a[0].pTab;
86908 SrcList *pSrc; /* One particular FROM clause in a nested query */
86925 SrcList *pSrc = p->pSrc;
86926 int nSrc = pSrc ? pSrc->nSrc : 0;
86928 if( pExpr->iTable==pSrc->a[i].iCursor ) break;
86952 cnt.pSrc = pSrcList;
87624 SrcList *pSrc, /* The table to rename. */
87643 assert( pSrc->nSrc==1 );
87646 pTab = sqlite3LocateTableItem(pParse, 0, &pSrc->a[0]);
87813 sqlite3SrcListDelete(db, pSrc);
87980 SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *pParse, SrcList *pSrc){
87993 pTab = sqlite3LocateTableItem(pParse, 0, &pSrc->a[0]);
88056 sqlite3SrcListDelete(db, pSrc);
90453 if( sqlite3FixSrcList(pFix, pSelect->pSrc) ){
92961 sqlite3SrcListAssignCursors(pParse, pSel->pSrc);
94341 SrcList *pSrc, /* The SrcList to be enlarged */
94350 assert( pSrc!=0 );
94351 assert( iStart<=pSrc->nSrc );
94354 if( (u32)pSrc->nSrc+nExtra>pSrc->nAlloc ){
94356 int nAlloc = pSrc->nSrc+nExtra;
94358 pNew = sqlite3DbRealloc(db, pSrc,
94359 sizeof(*pSrc) + (nAlloc-1)*sizeof(pSrc->a[0]) );
94362 return pSrc;
94364 pSrc = pNew;
94365 nGot = (sqlite3DbMallocSize(db, pNew) - sizeof(*pSrc))/sizeof(pSrc->a[0])+1;
94366 pSrc->nAlloc = nGot;
94371 for(i=pSrc->nSrc-1; i>=iStart; i--){
94372 pSrc->a[i+nExtra] = pSrc->a[i];
94374 pSrc->nSrc += nExtra;
94377 memset(&pSrc->a[iStart], 0, sizeof(pSrc->a[0])*nExtra);
94379 pSrc->a[i].iCursor = -1;
94383 return pSrc;
94465 sqlite3SrcListAssignCursors(pParse, pItem->pSelect->pSrc);
95615 SQLITE_PRIVATE Table *sqlite3SrcListLookup(Parse *pParse, SrcList *pSrc){
95616 struct SrcList_item *pItem = pSrc->a;
95618 assert( pItem && pSrc->nSrc==1 );
95711 SrcList *pSrc, /* the FROM clause -- which tables to scan */
95757 pSelectSrc = sqlite3SrcListDup(pParse->db, pSrc, 0);
98766 SrcList *pSrc, /* The child table to be scanned */
98834 pRight = exprTableColumn(db, pTab, pSrc->a[0].iCursor, -1);
98843 pRight = exprTableColumn(db, pTab, pSrc->a[0].iCursor, iCol);
98854 sNameContext.pSrcList = pSrc;
98861 pWInfo = sqlite3WhereBegin(pParse, pSrc, pWhere, 0, 0, 0, 0);
99205 SrcList *pSrc;
99229 pSrc = sqlite3SrcListAppend(db, 0, 0, 0);
99230 if( pSrc ){
99231 struct SrcList_item *pItem = pSrc->a;
99238 fkScanChildren(pParse, pSrc, pTab, pIdx, pFKey, aiCol, regNew, -1);
99242 fkScanChildren(pParse, pSrc, pTab, pIdx, pFKey, aiCol, regOld, 1);
99265 sqlite3SrcListDelete(db, pSrc);
101341 static int xferCompatibleIndex(Index *pDest, Index *pSrc){
101343 assert( pDest && pSrc );
101344 assert( pDest->pTable!=pSrc->pTable );
101345 if( pDest->nKeyCol!=pSrc->nKeyCol ){
101348 if( pDest->onError!=pSrc->onError ){
101351 for(i=0; i<pSrc->nKeyCol; i++){
101352 if( pSrc->aiColumn[i]!=pDest->aiColumn[i] ){
101355 if( pSrc->aSortOrder[i]!=pDest->aSortOrder[i] ){
101358 if( !xferCompatibleCollation(pSrc->azColl[i],pDest->azColl[i]) ){
101362 if( sqlite3ExprCompare(pSrc->pPartIdxWhere, pDest->pPartIdxWhere, -1) ){
101404 Table *pSrc; /* The table in the FROM clause of SELECT */
101439 assert(pSelect->pSrc); /* allocated even if there is no FROM clause */
101440 if( pSelect->pSrc->nSrc!=1 ){
101443 if( pSelect->pSrc->a[0].pSelect ){
101481 pItem = pSelect->pSrc->a;
101482 pSrc = sqlite3LocateTableItem(pParse, 0, pItem);
101483 if( pSrc==0 ){
101486 if( pSrc==pDest ){
101489 if( HasRowid(pDest)!=HasRowid(pSrc) ){
101493 if( pSrc->tabFlags & TF_Virtual ){
101497 if( pSrc->pSelect ){
101500 if( pDest->nCol!=pSrc->nCol ){
101503 if( pDest->iPKey!=pSrc->iPKey ){
101508 Column *pSrcCol = &pSrc->aCol[i];
101530 for(pSrcIdx=pSrc->pIndex; pSrcIdx; pSrcIdx=pSrcIdx->pNext){
101538 if( pDest->pCheck && sqlite3ExprListCompare(pSrc->pCheck,pDest->pCheck,-1) ){
101565 iDbSrc = sqlite3SchemaToIndex(db, pSrc->pSchema);
101601 if( HasRowid(pSrc) ){
101602 sqlite3OpenTable(pParse, iSrc, iDbSrc, pSrc, OP_OpenRead);
101626 sqlite3TableLock(pParse, iDbSrc, pSrc->tnum, 0, pSrc->zName);
101630 for(pSrcIdx=pSrc->pIndex; ALWAYS(pSrcIdx); pSrcIdx=pSrcIdx->pNext){
106535 sqlite3SrcListDelete(db, p->pSrc);
106568 SrcList *pSrc, /* the FROM clause -- which tables to scan */
106590 if( pSrc==0 ) pSrc = sqlite3DbMallocZero(db, sizeof(*pSrc));
106591 pNew->pSrc = pSrc;
106607 assert( pNew->pSrc!=0 || pParse->nErr>0 );
106736 SrcList *pSrc, /* Array of tables to search */
106747 iCol = columnIndex(pSrc->a[i].pTab, zCol);
106772 SrcList *pSrc, /* List of tables in FROM clause */
106786 assert( pSrc->nSrc>iRight );
106787 assert( pSrc->a[iLeft].pTab );
106788 assert( pSrc->a[iRight].pTab );
106790 pE1 = sqlite3CreateColumnExpr(db, pSrc, iLeft, iColLeft);
106791 pE2 = sqlite3CreateColumnExpr(db, pSrc, iRight, iColRight);
106855 SrcList *pSrc; /* All tables in the FROM clause */
106860 pSrc = p->pSrc;
106861 pLeft = &pSrc->a[0];
106863 for(i=0; i<pSrc->nSrc-1; i++, pRight++, pLeft++){
106886 if( tableAndColumnIndex(pSrc, i+1, zName, &iLeft, &iLeftCol) ){
106887 addWhereTerm(pParse, pSrc, iLeft, iLeftCol, i+1, j,
106928 || !tableAndColumnIndex(pSrc, i+1, zName, &iLeft, &iLeftCol)
106934 addWhereTerm(pParse, pSrc, iLeft, iLeftCol, i+1, iRightCol,
107857 sNC.pSrcList = pS->pSrc;
107902 sNC.pSrcList = pS->pSrc;
108166 sNC.pSrcList = pSelect->pSrc;
108417 SrcList *pSrc = p->pSrc; /* The FROM clause of the recursive query */
108450 for(i=0; ALWAYS(i<pSrc->nSrc); i++){
108451 if( pSrc->a[i].isRecursive ){
108452 iCurrent = pSrc->a[i].iCursor;
109612 SrcList *pSrc;
109622 pSrc = p->pSrc;
109623 assert( pSrc ); /* Even for (SELECT 1) we have: pSrc!=0 but pSrc->nSrc==0 */
109624 if( ALWAYS(pSrc) ){
109625 for(i=pSrc->nSrc, pItem=pSrc->a; i>0; i--, pItem++){
109783 SrcList *pSrc; /* The FROM clause of the outer query */
109797 pSrc = p->pSrc;
109798 assert( pSrc && iFrom>=0 && iFrom<pSrc->nSrc );
109799 pSubitem = &pSrc->a[iFrom];
109805 if( pSrc->nSrc>1 ) return 0; /* Restriction (2a) */
109814 pSubSrc = pSub->pSrc;
109828 if( pSub->pLimit && (pSrc->nSrc>1 || isAgg) ){
109896 if( isAgg || (p->selFlags & SF_Distinct)!=0 || pSrc->nSrc!=1 ){
109902 assert( pSub->pSrc!=0 );
109905 || pSub1->pSrc->nSrc<1
109910 testcase( pSub1->pSrc->nSrc>1 );
109972 p->pSrc = 0;
109981 p->pSrc = pSrc;
110048 pSubSrc = pSub->pSrc; /* FROM clause of subquery */
110050 pSrc = pParent->pSrc; /* FROM clause of the outer query */
110052 if( pSrc ){
110057 pSrc = pParent->pSrc = sqlite3SrcListAppend(db, 0, 0, 0);
110058 if( pSrc==0 ){
110080 pParent->pSrc = pSrc = sqlite3SrcListEnlarge(db, pSrc, nSubSrc-1,iFrom+1);
110090 sqlite3IdListDelete(db, pSrc->a[i+iFrom].pUsing);
110091 pSrc->a[i+iFrom] = pSubSrc->a[i];
110094 pSrc->a[iFrom].jointype = jointype;
110253 || p->pSrc->nSrc!=1 || p->pSrc->a[0].pSelect
110257 pTab = p->pSrc->a[0].pTab;
110346 p->pSrc = pNewSrc;
110478 SrcList *pSrc = pFrom->pSelect->pSrc;
110479 for(i=0; i<pSrc->nSrc; i++){
110480 struct SrcList_item *pItem = &pSrc->a[i];
110596 if( NEVER(p->pSrc==0) || (selFlags & SF_Expanded)!=0 ){
110599 pTabList = p->pSrc;
110925 pTabList = p->pSrc;
111230 pTabList = p->pSrc;
111356 pTabList = p->pSrc;
111992 if( p->pSrc && p->pSrc->nSrc ) n++;
112001 if( p->pSrc && p->pSrc->nSrc ){
112005 for(i=0; i<p->pSrc->nSrc; i++){
112006 struct SrcList_item *pItem = &p->pSrc->a[i];
112026 sqlite3TreeViewItem(pView, zLine, i<p->pSrc->nSrc-1);
112955 SrcList *pSrc; /* SrcList to be returned */
112957 pSrc = sqlite3SrcListAppend(db, 0, 0, 0);
112958 if( pSrc ){
112959 assert( pSrc->nSrc>0 );
112960 pSrc->a[pSrc->nSrc-1].zName = sqlite3DbStrDup(db, pStep->zTarget);
112964 pSrc->a[pSrc->nSrc-1].zDatabase = sqlite3DbStrDup(db, db->aDb[iDb].zName);
112967 return pSrc;
113419 SrcList *pSrc, /* The virtual table to be modified */
114100 SrcList *pSrc, /* The virtual table to be modified */
114137 pSelect = sqlite3SelectNew(pParse, pEList, pSrc, pWhere, 0, 0, 0, 0, 0, 0);
116259 static void whereOrMove(WhereOrSet *pDest, WhereOrSet *pSrc){
116260 pDest->n = pSrc->n;
116261 memcpy(pDest->a, pSrc->a, pDest->n*sizeof(pDest->a[0]));
116512 SrcList *pSrc = pS->pSrc;
116518 if( ALWAYS(pSrc!=0) ){
116520 for(i=0; i<pSrc->nSrc; i++){
116521 mask |= exprSelectTableUsage(pMaskSet, pSrc->a[i].pSelect);
116522 mask |= exprTableUsage(pMaskSet, pSrc->a[i].pOn);
116984 SrcList *pSrc, /* the FROM clause */
117018 exprAnalyze(pSrc, pWC, idxNew);
117110 SrcList *pSrc, /* the FROM clause */
117139 exprAnalyzeAll(pSrc, pOrWc);
117165 exprAnalyzeAll(pSrc, pAndWC);
117213 whereCombineDisjuncts(pSrc, pWC, pOne, pTwo);
117341 exprAnalyze(pSrc, pWC, idxNew);
117372 SrcList *pSrc, /* the FROM clause */
117501 exprAnalyze(pSrc, pWC, idxNew);
117514 exprAnalyzeOrTerm(pSrc, pWC, idxTerm);
117586 exprAnalyze(pSrc, pWC, idxNew1);
117594 exprAnalyze(pSrc, pWC, idxNew2);
117847 struct SrcList_item *pSrc, /* Table we are trying to access */
117851 if( pTerm->leftCursor!=pSrc->iCursor ) return 0;
117855 aff = pSrc->pTab->aCol[pTerm->u.leftColumn].affinity;
117871 struct SrcList_item *pSrc, /* The FROM clause term to get the next index */
117905 pTable = pSrc->pTab;
117912 || pExpr->iRightJoinTable!=pSrc->iCursor /* for the right-hand */
117917 && sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor) ){
117921 if( termCanDriveIndex(pTerm, pSrc, notReady) ){
117954 extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1));
117961 if( pSrc->colUsed & MASKBIT(BMS-1) ){
117974 if( termCanDriveIndex(pTerm, pSrc, notReady) ){
118000 if( pSrc->colUsed & MASKBIT(BMS-1) ){
118054 struct SrcList_item *pSrc,
118069 if( pTerm->leftCursor != pSrc->iCursor ) continue;
118088 if( pExpr->op!=TK_COLUMN || pExpr->iTable!=pSrc->iCursor ) break;
118122 if( pTerm->leftCursor != pSrc->iCursor ) continue;
120866 struct SrcList_item *pSrc, /* FROM clause term being analyzed */
120896 }else if( pProbe->tnum<=0 || (pSrc->jointype & JT_LEFT)!=0 ){
120906 pTerm = whereScanInit(&scan, pBuilder->pWC, pSrc->iCursor, iCol,
120926 && (iCol<0 || pSrc->pTab->aCol[iCol].notNull)
121062 rCostIdx = pNew->nOut + 1 + (15*pProbe->szIdxRow)/pSrc->pTab->szTabRow;
121084 whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, nInMul+nIn);
121125 whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, nIter + nInMul);
121247 struct SrcList_item *pSrc; /* The FROM clause btree term to add */
121260 pSrc = pTabList->a + pNew->iTab;
121261 pTab = pSrc->pTab;
121263 assert( !IsVirtual(pSrc->pTab) );
121265 if( pSrc->pIndex ){
121267 pProbe = pSrc->pIndex;
121286 pFirst = pSrc->pTab->pIndex;
121287 if( pSrc->notIndexed==0 ){
121302 && pSrc->pIndex==0
121303 && !pSrc->viaCoroutine
121304 && !pSrc->notIndexed
121306 && !pSrc->isCorrelated
121307 && !pSrc->isRecursive
121314 if( termCanDriveIndex(pTerm, pSrc, 0) ){
121351 && !whereUsablePartialIndex(pSrc->iCursor, pWC, pProbe->pPartIdxWhere) ){
121352 testcase( pNew->iTab!=pSrc->iCursor ); /* See ticket [98d973b8f5] */
121364 b = indexMightHelpWithOrderBy(pBuilder, pProbe, pSrc->iCursor);
121386 m = pSrc->colUsed & ~columnsInIndex(pProbe);
121419 rc = whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, 0);
121428 if( pSrc->pIndex ) break;
121445 struct SrcList_item *pSrc; /* The FROM clause term to search */
121466 pSrc = &pWInfo->pTabList->a[pNew->iTab];
121467 pTab = pSrc->pTab;
121469 pIdxInfo = allocateIndexInfo(pParse, pWC, pSrc, pBuilder->pOrderBy);
126204 SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);
126207 yygotominor.yy346.pExpr->x.pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0,0);
126211 sqlite3SrcListDelete(pParse->db, pSrc);
151585 u8 *pSrc = &pDst[pRtree->nBytesPerCell];
151587 memmove(pDst, pSrc, nByte);