Home | History | Annotate | Download | only in orig

Lines Matching refs:pNew

5067 ** encrypted, this routine will encrypt it.  If pNew==0 or nNew==0, the
18417 void *pNew;
18421 pNew = sqlite3MemMalloc(nByte);
18422 if( pNew ){
18423 memcpy(pNew, pPrior, (int)(nByte<pOldHdr->iSize ? nByte : pOldHdr->iSize));
18425 randomFill(&((char*)pNew)[pOldHdr->iSize], nByte - (int)pOldHdr->iSize);
18429 return pNew;
20155 sqlite3_debug_mutex *pNew = 0;
20159 pNew = sqlite3Malloc(sizeof(*pNew));
20160 if( pNew ){
20161 pNew->id = id;
20162 pNew->cnt = 0;
20173 pNew = &aStatic[id-2];
20174 pNew->id = id;
20178 return (sqlite3_mutex*)pNew;
21841 void *pNew;
21861 pNew = pOld;
21870 pNew = sqlite3GlobalConfig.m.xRealloc(pOld, nNew);
21871 if( pNew==0 && mem0.alarmThreshold>0 ){
21873 pNew = sqlite3GlobalConfig.m.xRealloc(pOld, nNew);
21875 if( pNew ){
21876 nNew = sqlite3MallocSize(pNew);
21881 pNew = sqlite3GlobalConfig.m.xRealloc(pOld, nNew);
21883 assert( EIGHT_BYTE_ALIGNMENT(pNew) ); /* IMP: R-11148-40995 */
21884 return pNew;
21992 void *pNew = 0;
22003 pNew = sqlite3DbMallocRaw(db, n);
22004 if( pNew ){
22005 memcpy(pNew, p, db->lookaside.sz);
22012 pNew = sqlite3_realloc64(p, n);
22013 if( !pNew ){
22016 sqlite3MemdebugSetType(pNew,
22020 return pNew;
22028 void *pNew;
22029 pNew = sqlite3DbRealloc(db, p, n);
22030 if( !pNew ){
22033 return pNew;
25998 ** "pNew" is a pointer to the hash table that is to be initialized.
26000 SQLITE_PRIVATE void sqlite3HashInit(Hash *pNew){
26001 assert( pNew!=0 );
26002 pNew->first = 0;
26003 pNew->count = 0;
26004 pNew->htsize = 0;
26005 pNew->ht = 0;
26042 /* Link pNew element into the hash table pH. If pEntry!=0 then also
26043 ** insert pNew into the pEntry hash bucket.
26047 struct _ht *pEntry, /* The entry into which pNew is inserted */
26048 HashElem *pNew /* The element to be inserted */
26054 pEntry->chain = pNew;
26059 pNew->next = pHead;
26060 pNew->prev = pHead->prev;
26061 if( pHead->prev ){ pHead->prev->next = pNew; }
26062 else { pH->first = pNew; }
26063 pHead->prev = pNew;
26065 pNew->next = pH->first;
26066 if( pH->first ){ pH->first->prev = pNew; }
26067 pNew->prev = 0;
26068 pH->first = pNew;
27523 struct vxworksFileId *pNew; /* search key and new file ID */
27529 pNew = sqlite3_malloc64( sizeof(*pNew) + (n+1) );
27530 if( pNew==0 ) return 0;
27531 pNew->zCanonicalName = (char*)&pNew[1];
27532 memcpy(pNew->zCanonicalName, zAbsoluteName, n+1);
27533 n = vxworksSimplifyName(pNew->zCanonicalName, n);
27542 && memcmp(pCandidate->zCanonicalName, pNew->zCanonicalName, n)==0
27544 sqlite3_free(pNew);
27552 pNew->nRef = 1;
27553 pNew->nName = n;
27554 pNew->pNext = vxworksFileList;
27555 vxworksFileList = pNew;
27557 return pNew;
31386 u8 *pNew = 0; /* Location of new mapping */
31413 pNew = osMremap(pOrig, nReuse, nNew, MREMAP_MAYMOVE);
31416 pNew = osMmap(pReq, nNew-nReuse, flags, MAP_SHARED, h, nReuse);
31417 if( pNew!=MAP_FAILED ){
31418 if( pNew!=pReq ){
31419 osMunmap(pNew, nNew - nReuse);
31420 pNew = 0;
31422 pNew = pOrig;
31428 if( pNew==MAP_FAILED || pNew==0 ){
31433 /* If pNew is still NULL, try to create an entirely new mapping. */
31434 if( pNew==0 ){
31435 pNew = osMmap(0, nNew, flags, MAP_SHARED, h, 0);
31438 if( pNew==MAP_FAILED ){
31439 pNew = 0;
31448 pFd->pMapRegion = (void *)pNew;
31764 unixFile *pNew /* open file object for the database file */
31805 if( osFcntl(pNew->h, F_GETLK, &lockInfo)!=-1 ) {
31828 unixFile *pNew /* the open file object */
31845 if( osFcntl(pNew->h, F_GETLK, &lockInfo)!=-1 ) {
31880 unixFile *pNew = (unixFile *)pId;
31883 assert( pNew->pInode==NULL );
31900 pNew->h = h;
31901 pNew->pVfs = pVfs;
31902 pNew->zPath = zFilename;
31903 pNew->ctrlFlags = (u8)ctrlFlags;
31905 pNew->mmapSizeMax = sqlite3GlobalConfig.szMmap;
31909 pNew->ctrlFlags |= UNIXFILE_PSOW;
31912 pNew->ctrlFlags |= UNIXFILE_EXCL;
31916 pNew->pId = vxworksFindFileId(zFilename);
31917 if( pNew->pId==0 ){
31926 pLockingStyle = (**(finder_type*)pVfs->pAppData)(zFilename, pNew);
31931 pNew->lockingContext = (void*)zFilename;
31941 rc = findInodeInfo(pNew, &pNew->pInode);
31961 robust_close(pNew, h, __LINE__);
31973 pNew
31984 rc = findInodeInfo(pNew, &pNew->pInode);
31986 sqlite3_free(pNew->lockingContext);
31987 robust_close(pNew, h, __LINE__);
32009 pNew->lockingContext = zLockFile;
32018 rc = findInodeInfo(pNew, &pNew->pInode);
32019 if( (rc==SQLITE_OK) && (pNew->pInode->pSem==NULL) ){
32020 char *zSemName = pNew->pInode->aSemName;
32023 pNew->pId->zCanonicalName);
32026 pNew->pInode->pSem = sem_open(zSemName, O_CREAT, 0666, 1);
32027 if( pNew->pInode->pSem == SEM_FAILED ){
32029 pNew->pInode->aSemName[0] = '\0';
32036 storeLastErrno(pNew, 0);
32039 if( h>=0 ) robust_close(pNew, h, __LINE__);
32042 pNew->ctrlFlags |= UNIXFILE_DELETE;
32046 if( h>=0 ) robust_close(pNew, h, __LINE__);
32048 pNew->pMethod = pLockingStyle;
32050 verifyDbFile(pNew);
33155 unixFile *pNew;
33205 pNew = (unixFile *)sqlite3_malloc64(sizeof(*pNew));
33206 if( pNew==NULL ){
33210 memset(pNew, 0, sizeof(unixFile));
33211 pNew->openFlags = openFlags;
33217 pNew->pUnused = pUnused;
33219 rc = fillInUnixFile(&dummyVfs, fd, (sqlite3_file*)pNew, path, 0);
33221 *ppFile = pNew;
33225 robust_close(pNew, fd, __LINE__);
33226 sqlite3_free(pNew);
37980 struct winShmNode *pNew; /* Newly allocated winShmNode */
37991 pNew = sqlite3MallocZero( sizeof(*pShmNode) + nName + 17 );
37992 if( pNew==0 ){
37996 pNew->zFilename = (char*)&pNew[1];
37997 sqlite3_snprintf(nName+15, pNew->zFilename, "%s-shm", pDbFd->zPath);
37998 sqlite3FileSuffix3(pDbFd->zPath, pNew->zFilename);
38008 if( sqlite3StrICmp(pShmNode->zFilename, pNew->zFilename)==0 ) break;
38011 sqlite3_free(pNew);
38013 pShmNode = pNew;
38014 pNew = 0;
38078 sqlite3_free(pNew);
38482 void *pNew = 0;
38514 pNew = osMapViewOfFileFromApp(pFd->hMap, flags, 0, (SIZE_T)nMap);
38516 pNew = osMapViewOfFile(pFd->hMap, flags, 0, 0, (SIZE_T)nMap);
38518 if( pNew==NULL ){
38529 pFd->pMapRegion = pNew;
40633 sqlite3_pcache *pNew;
40634 pNew = sqlite3GlobalConfig.pcache2.xCreate(
40638 if( pNew==0 ) return SQLITE_NOMEM;
40639 sqlite3GlobalConfig.pcache2.xCachesize(pNew, numberOfCachePages(pCache));
40643 pCache->pCache = pNew;
42539 struct RowSetChunk *pNew;
42540 pNew = sqlite3DbMallocRaw(p->db, sizeof(*pNew));
42541 if( pNew==0 ){
42544 pNew->pNextChunk = p->pChunk;
42545 p->pChunk = pNew;
42546 p->pFresh = pNew->aEntry;
46647 char *pNew = NULL; /* New temp space */
46654 pNew = (char *)sqlite3PageMalloc(pageSize);
46655 if( !pNew ) rc = SQLITE_NOMEM;
46664 pPager->pTmpSpace = pNew;
46668 sqlite3PageFree(pNew);
61221 MemPage *pNew; /* Newly allocated page */
61223 Pgno pgnoNew; /* Page number of pNew */
61236 rc = allocateBtreePage(pBt, &pNew, &pgnoNew, 0, 0);
61245 assert( sqlite3PagerIswriteable(pNew->pDbPage) );
61247 zeroPage(pNew, PTF_INTKEY|PTF_LEAFDATA|PTF_LEAF);
61248 rc = rebuildPage(pNew, 1, &pCell, &szCell);
61250 pNew->nFree = pBt->usableSize - pNew->cellOffset - 2 - szCell;
61263 if( szCell>pNew->minLocal ){
61264 ptrmapPutOvflPtr(pNew, pCell, &rc);
61295 releasePage(pNew);
61849 MemPage *pNew;
61851 pNew = apNew[i] = apOld[i];
61853 rc = sqlite3PagerWrite(pNew->pDbPage);
61858 rc = allocateBtreePage(pBt, &pNew, &pgno, (bBulk ? 1 : pgno), 0);
61860 zeroPage(pNew, pageFlags);
61861 apNew[i] = pNew;
61867 ptrmapPut(pBt, pNew->pgno, PTRMAP_BTREE, pParent->pgno, &rc);
61961 MemPage *pNew = apNew[0];
61962 u8 *aOld = pNew->aData;
61963 int cntOldNext = pNew->nCell + pNew->nOverflow;
61976 pNew = apNew[++iNew];
61980 /* Cell pCell is destined for new sibling page pNew. Originally, it
61983 ** if sibling page iOld had the same page number as pNew, and if
61987 || pNew->pgno!=aPgno[iOld]
61992 ptrmapPut(pBt, get4byte(pCell), PTRMAP_BTREE, pNew->pgno, &rc);
61994 if( cachedCellSize(&b,i)>pNew->minLocal ){
61995 ptrmapPutOvflPtr(pNew, pCell, &rc);
62007 MemPage *pNew = apNew[i];
62015 if( !pNew->leaf ){
62016 memcpy(&pNew->aData[8], pCell, 4);
62025 pNew->xParseCell(pNew, b.apCell[j], &info);
62050 insertCell(pParent, nxDiv+i, pCell, sz, pTemp, pNew->pgno, &rc);
66788 VdbeOp *pNew;
66807 pNew = sqlite3DbRealloc(p->db, v->aOp, nNew*sizeof(Op));
66808 if( pNew ){
66809 p->nOpAlloc = sqlite3DbMallocSize(p->db, pNew)/sizeof(Op);
66810 v->aOp = pNew;
66812 return (pNew ? SQLITE_OK : SQLITE_NOMEM);
67372 ScanStatus *pNew = &aNew[p->nScan++];
67373 pNew->addrExplain = addrExplain;
67374 pNew->addrLoop = addrLoop;
67375 pNew->addrVisit = addrVisit;
67376 pNew->nEst = nEst;
67377 pNew->zName = sqlite3DbStrDup(p->db, zName);
71200 sqlite3_value *pNew;
71202 pNew = sqlite3_malloc( sizeof(*pNew) );
71203 if( pNew==0 ) return 0;
71204 memset(pNew, 0, sizeof(*pNew));
71205 memcpy(pNew, pOrig, MEMCELLSIZE);
71206 pNew->flags &= ~MEM_Dyn;
71207 pNew->db = 0;
71208 if( pNew->flags&(MEM_Str|MEM_Blob) ){
71209 pNew->flags &= ~(MEM_Static|MEM_Dyn);
71210 pNew->flags |= MEM_Ephem;
71211 if( sqlite3VdbeMemMakeWriteable(pNew)!=SQLITE_OK ){
71212 sqlite3ValueFree(pNew);
71213 pNew = 0;
71216 return pNew;
75707 Savepoint *pNew;
75747 pNew = sqlite3DbMallocRaw(db, sizeof(Savepoint)+nName+1);
75748 if( pNew ){
75749 pNew->zName = (char *)&pNew[1];
75750 memcpy(pNew->zName, zName, nName+1);
75762 pNew->pNext = db->pSavepoint;
75763 db->pSavepoint = pNew;
75764 pNew->nDeferredCons = db->nDeferredCons;
75765 pNew->nDeferredImmCons = db->nDeferredImmCons;
81245 MergeEngine *pNew; /* Pointer to allocated object to return */
81252 pNew = sqlite3FaultSim(100) ? 0 : (MergeEngine*)sqlite3MallocZero(nByte);
81253 if( pNew ){
81254 pNew->nTree = N;
81255 pNew->pTask = 0;
81256 pNew->aReadr = (PmaReader*)&pNew[1];
81257 pNew->aTree = (int*)&pNew->aReadr[N];
81259 return pNew;
81835 SorterRecord *pNew; /* New list element */
81912 pNew = (SorterRecord*)&pSorter->list.aMemory[pSorter->iMemory];
81914 pNew->u.iNext = (int)((u8*)(pSorter->list.pList) - pSorter->list.aMemory);
81916 pNew = (SorterRecord *)sqlite3Malloc(nReq);
81917 if( pNew==0 ){
81920 pNew->u.pNext = pSorter->list.pList;
81923 memcpy(SRVAL(pNew), pVal->z, pVal->n);
81924 pNew->nVal = pVal->n;
81925 pSorter->list.pList = pNew;
82364 MergeEngine *pNew; /* Merge engine to return */
82369 *ppOut = pNew = vdbeMergeEngineNew(nPMA);
82370 if( pNew==0 ) rc = SQLITE_NOMEM;
82374 PmaReader *pReadr = &pNew->aReadr[i];
82380 vdbeMergeEngineFree(pNew);
82439 MergeEngine *pNew = vdbeMergeEngineNew(SORTER_MAX_MERGE_COUNT);
82440 if( pNew==0 ){
82443 rc = vdbeIncrMergerNew(pTask, pNew, &pReadr->pIncr);
83199 FileChunk *pNew = sqlite3_malloc(sizeof(FileChunk));
83200 if( !pNew ){
83203 pNew->pNext = 0;
83206 pChunk->pNext = pNew;
83209 p->pFirst = pNew;
83211 p->endpoint.pChunk = pNew;
84444 Expr *pNew = sqlite3Expr(db, TK_INTEGER, 0);
84445 if( pNew==0 ) return 1;
84446 pNew->flags |= EP_IntValue;
84447 pNew->u.iValue = iCol;
84449 pItem->pExpr = pNew;
84455 pParent->pLeft = pNew;
85058 Expr *pNew = sqlite3ExprAlloc(pParse->db, TK_COLLATE, pCollName, dequote);
85059 if( pNew ){
85060 pNew->pLeft = pExpr;
85061 pNew->flags |= EP_Collate|EP_Skip;
85062 pExpr = pNew;
85435 Expr *pNew;
85446 pNew = sqlite3DbMallocZero(db, sizeof(Expr)+nExtra);
85447 if( pNew ){
85448 pNew->op = (u8)op;
85449 pNew->iAgg = -1;
85452 pNew->flags |= EP_IntValue;
85453 pNew->u.iValue = iValue;
85456 pNew->u.zToken = (char*)&pNew[1];
85458 if( pToken->n ) memcpy(pNew->u.zToken, pToken->z, pToken->n);
85459 pNew->u.zToken[pToken->n] = 0;
85462 sqlite3Dequote(pNew->u.zToken);
85463 if( c=='"' ) pNew->flags |= EP_DblQuoted;
85468 pNew->nHeight = 1;
85471 return pNew;
85591 Expr *pNew = sqlite3ExprAlloc(db, TK_AND, 0, 0);
85592 sqlite3ExprAttachSubtrees(db, pNew, pLeft, pRight);
85593 return pNew;
85602 Expr *pNew;
85605 pNew = sqlite3ExprAlloc(db, TK_FUNCTION, pToken, 1);
85606 if( pNew==0 ){
85610 pNew->x.pList = pList;
85611 assert( !ExprHasProperty(pNew, EP_xIsSelect) );
85612 sqlite3ExprSetHeightAndFlags(pParse, pNew);
85613 return pNew;
85837 Expr *pNew = 0; /* Value to return */
85852 pNew = (Expr *)zAlloc;
85854 if( pNew ){
85856 ** by pNew. This is either EXPR_FULLSIZE, EXPR_REDUCEDSIZE or
85878 pNew->flags &= ~(EP_Reduced|EP_TokenOnly|EP_Static|EP_MemToken);
85879 pNew->flags |= nStructSize & (EP_Reduced|EP_TokenOnly);
85880 pNew->flags |= staticFlag;
85884 char *zToken = pNew->u.zToken = (char*)&zAlloc[nNewSize];
85888 if( 0==((p->flags|pNew->flags) & EP_TokenOnly) ){
85889 /* Fill in the pNew->x.pSelect or pNew->x.pList member. */
85891 pNew->x.pSelect = sqlite3SelectDup(db, p->x.pSelect, isReduced);
85893 pNew->x.pList = sqlite3ExprListDup(db, p->x.pList, isReduced);
85897 /* Fill in pNew->pLeft and pNew->pRight. */
85898 if( ExprHasProperty(pNew, EP_Reduced|EP_TokenOnly) ){
85900 if( ExprHasProperty(pNew, EP_Reduced) ){
85901 pNew->pLeft = exprDup(db, p->pLeft, EXPRDUP_REDUCE, &zAlloc);
85902 pNew->pRight = exprDup(db, p->pRight, EXPRDUP_REDUCE, &zAlloc);
85909 pNew->pLeft = sqlite3ExprDup(db, p->pLeft, 0);
85910 pNew->pRight = sqlite3ExprDup(db, p->pRight, 0);
85916 return pNew;
85967 ExprList *pNew;
85971 pNew = sqlite3DbMallocRaw(db, sizeof(*pNew) );
85972 if( pNew==0 ) return 0;
85973 pNew->nExpr = i = p->nExpr;
85975 pNew->a = pItem = sqlite3DbMallocRaw(db, i*sizeof(p->a[0]) );
85977 sqlite3DbFree(db, pNew);
85991 return pNew;
86003 SrcList *pNew;
86008 pNew = sqlite3DbMallocRaw(db, nByte );
86009 if( pNew==0 ) return 0;
86010 pNew->nSrc = pNew->nAlloc = p->nSrc;
86012 struct SrcList_item *pNewItem = &pNew->a[i];
86040 return pNew;
86043 IdList *pNew;
86046 pNew = sqlite3DbMallocRaw(db, sizeof(*pNew) );
86047 if( pNew==0 ) return 0;
86048 pNew->nId = p->nId;
86049 pNew->a = sqlite3DbMallocRaw(db, p->nId*sizeof(p->a[0]) );
86050 if( pNew->a==0 ){
86051 sqlite3DbFree(db, pNew);
86058 struct IdList_item *pNewItem = &pNew->a[i];
86063 return pNew;
86066 Select *pNew, *pPrior;
86068 pNew = sqlite3DbMallocRaw(db, sizeof(*p) );
86069 if( pNew==0 ) return 0;
86070 pNew->pEList = sqlite3ExprListDup(db, p->pEList, flags);
86071 pNew->pSrc = sqlite3SrcListDup(db, p->pSrc, flags);
86072 pNew->pWhere = sqlite3ExprDup(db, p->pWhere, flags);
86073 pNew->pGroupBy = sqlite3ExprListDup(db, p->pGroupBy, flags);
86074 pNew->pHaving = sqlite3ExprDup(db, p->pHaving, flags);
86075 pNew->pOrderBy = sqlite3ExprListDup(db, p->pOrderBy, flags);
86076 pNew->op = p->op;
86077 pNew->pPrior = pPrior = sqlite3SelectDup(db, p->pPrior, flags);
86078 if( pPrior ) pPrior->pNext = pNew;
86079 pNew->pNext = 0;
86080 pNew->pLimit = sqlite3ExprDup(db, p->pLimit, flags);
86081 pNew->pOffset = sqlite3ExprDup(db, p->pOffset, flags);
86082 pNew->iLimit = 0;
86083 pNew->iOffset = 0;
86084 pNew->selFlags = p->selFlags & ~SF_UsesEphemeral;
86085 pNew->addrOpenEphm[0] = -1;
86086 pNew->addrOpenEphm[1] = -1;
86087 pNew->nSelectRow = p->nSelectRow;
86088 pNew->pWith = withDup(db, p->pWith);
86089 sqlite3SelectSetName(pNew, p->zSelName);
86090 return pNew;
89812 Table *pNew; /* Copy of pParse->pNewTable */
89824 pNew = pParse->pNewTable;
89825 assert( pNew );
89828 iDb = sqlite3SchemaToIndex(db, pNew->pSchema);
89830 zTab = &pNew->zName[16]; /* Skip the "sqlite_altertab_" prefix on the name */
89831 pCol = &pNew->aCol[pNew->nCol-1];
89859 if( pNew->pIndex ){
89863 if( (db->flags&SQLITE_ForeignKeys) && pNew->pFKey && pDflt ){
89906 zDb, SCHEMA_TABLE(iDb), pNew->addColOffset, zCol, pNew->addColOffset+1,
89939 Table *pNew;
89980 pNew = (Table*)sqlite3DbMallocZero(db, sizeof(Table));
89981 if( !pNew ) goto exit_begin_add_column;
89982 pParse->pNewTable = pNew;
89983 pNew->nRef = 1;
89984 pNew->nCol = pTab->nCol;
89985 assert( pNew->nCol>0 );
89986 nAlloc = (((pNew->nCol-1)/8)*8)+8;
89987 assert( nAlloc>=pNew->nCol && nAlloc%8==0 && nAlloc-pNew->nCol<8 );
89988 pNew->aCol = (Column*)sqlite3DbMallocZero(db, sizeof(Column)*nAlloc);
89989 pNew->zName = sqlite3MPrintf(db, "sqlite_altertab_%s", pTab->zName);
89990 if( !pNew->aCol || !pNew->zName ){
89994 memcpy(pNew->aCol, pTab->aCol, sizeof(Column)*pNew->nCol);
89995 for(i=0; i<pNew->nCol; i++){
89996 Column *pCol = &pNew->aCol[i];
90003 pNew->pSchema = db->aDb[iDb].pSchema;
90004 pNew->addColOffset = pTab->addColOffset;
90005 pNew->nRef = 1;
90511 ** pNew and pOld are both candidate non-periodic samples selected for
90512 ** the same column (pNew->iCol==pOld->iCol). Ignoring this column and
90514 ** function returns true if sample pNew is to be preferred over pOld.
90516 ** column for pNew and pOld are equal, is pNew to be preferred over pOld.
90523 Stat4Sample *pNew,
90528 assert( pNew->iCol==pOld->iCol );
90529 for(i=pNew->iCol+1; i<nCol; i++){
90530 if( pNew->anEq[i]>pOld->anEq[i] ) return 1;
90531 if( pNew->anEq[i]<pOld->anEq[i] ) return 0;
90533 if( pNew->iHash>pOld->iHash ) return 1;
90540 ** Return true if pNew is to be preferred over pOld.
90547 Stat4Sample *pNew,
90550 tRowcnt nEqNew = pNew->anEq[pNew->iCol];
90553 assert( pOld->isPSample==0 && pNew->isPSample==0 );
90554 assert( IsStat4 || (pNew->iCol==0 && pOld->iCol==0) );
90559 if( pNew->iCol<pOld->iCol ) return 1;
90560 return (pNew->iCol==pOld->iCol && sampleIsBetterPost(pAccum, pNew, pOld));
90564 return (nEqNew==nEqOld && pNew->iHash>pOld->iHash);
90569 ** Copy the contents of sample *pNew into the p->a[] array. If necessary,
90572 static void sampleInsert(Stat4Accum *p, Stat4Sample *pNew, int nEqZero){
90579 if( pNew->isPSample==0 ){
90581 assert( pNew->anEq[pNew->iCol]>0 );
90590 if( pOld->anEq[pNew->iCol]==0 ){
90592 assert( pOld->iCol>pNew->iCol );
90593 assert( sampleIsBetter(p, pNew, pOld) );
90600 pUpgrade->iCol = pNew->iCol;
90601 pUpgrade->anEq[pUpgrade->iCol] = pNew->anEq[pUpgrade->iCol];
90628 || pNew->anLt[p->nCol-1] > p->a[p->nSample-1].anLt[p->nCol-1] );
90633 sampleCopy(p, pSample, pNew);
96319 void *pNew = sqlite3DbRealloc(db, pArray, sz*szEntry);
96320 if( pNew==0 ){
96324 pArray = pNew;
96421 SrcList *pNew;
96424 pNew = sqlite3DbRealloc(db, pSrc,
96426 if( pNew==0 ){
96430 pSrc = pNew;
96431 nGot = (sqlite3DbMallocSize(db, pNew) - sizeof(*pSrc))/sizeof(pSrc->a[0])+1;
97139 With *pNew;
97156 pNew = sqlite3DbRealloc(db, pWith, nByte);
97158 pNew = sqlite3DbMallocZero(db, sizeof(*pWith));
97160 assert( zName!=0 || pNew==0 );
97161 assert( db->mallocFailed==0 || pNew==0 );
97163 if( pNew==0 ){
97167 pNew = pWith;
97169 pNew->a[pNew->nCte].pSelect = pQuery;
97170 pNew->a[pNew->nCte].pCols = pArglist;
97171 pNew->a[pNew->nCte].zName = zName;
97172 pNew->a[pNew->nCte].zCteErr = 0;
97173 pNew->nCte++;
97176 return pNew;
101607 Expr *pNew;
101609 pNew = sqlite3PExpr(pParse, TK_DOT,
101616 pNew = sqlite3ExprDup(db, pDflt, 0);
101618 pNew = sqlite3PExpr(pParse, TK_NULL, 0, 0, 0);
101621 pNew = sqlite3PExpr(pParse, TK_NULL, 0, 0, 0);
101623 pList = sqlite3ExprListAppend(pParse, pList, pNew);
108486 sqlite3_stmt *pNew;
108495 rc = sqlite3LockAndPrepare(db, zSql, -1, 0, p, &pNew, 0);
108500 assert( pNew==0 );
108503 assert( pNew!=0 );
108505 sqlite3VdbeSwap((Vdbe*)pNew, p);
108506 sqlite3TransferBindings(pNew, (sqlite3_stmt*)p);
108507 sqlite3VdbeResetStepResult((Vdbe*)pNew);
108508 sqlite3VdbeFinalize((Vdbe*)pNew);
108748 Select *pNew;
108751 pNew = sqlite3DbMallocZero(db, sizeof(*pNew) );
108752 if( pNew==0 ){
108754 pNew = &standin;
108755 memset(pNew, 0, sizeof(*pNew));
108760 pNew->pEList = pEList;
108762 pNew->pSrc = pSrc;
108763 pNew->pWhere = pWhere;
108764 pNew->pGroupBy = pGroupBy;
108765 pNew->pHaving = pHaving;
108766 pNew->pOrderBy = pOrderBy;
108767 pNew->selFlags = selFlags;
108768 pNew->op = TK_SELECT;
108769 pNew->pLimit = pLimit;
108770 pNew->pOffset = pOffset;
108772 pNew->addrOpenEphm[0] = -1;
108773 pNew->addrOpenEphm[1] = -1;
108775 clearSelect(db, pNew, pNew!=&standin);
108776 pNew = 0;
108778 assert( pNew->pSrc!=0 || pParse->nErr>0 );
108780 assert( pNew!=&standin );
108781 return pNew;
111483 Expr *pNew = sqlite3Expr(db, TK_INTEGER, 0);
111484 if( pNew==0 ) return SQLITE_NOMEM;
111485 pNew->flags |= EP_IntValue;
111486 pNew->u.iValue = i;
111487 pOrderBy = sqlite3ExprListAppend(pParse, pOrderBy, pNew);
111748 Expr *pNew;
111751 pNew = sqlite3ExprDup(db, pEList->a[pExpr->iColumn].pExpr, 0);
111753 pExpr = pNew;
112141 Select *pNew;
112151 pNew = sqlite3SelectDup(db, p, 0);
112152 sqlite3SelectSetName(pNew, pSub->zSelName);
112158 if( pNew==0 ){
112161 pNew->pPrior = pPrior;
112162 if( pPrior ) pPrior->pNext = pNew;
112163 pNew->pNext = p;
112164 p->pPrior = pNew;
112167 pNew->zSelName, pNew));
112402 Expr *pNew;
112419 pNew = sqlite3ExprDup(db, pWhere, 0);
112420 pNew = substExpr(db, pNew, iCursor, pSubq->pEList);
112421 pSubq->pWhere = sqlite3ExprAnd(db, pSubq->pWhere, pNew);
112552 Select *pNew;
112574 pNew = sqlite3DbMallocZero(db, sizeof(*pNew) );
112575 if( pNew==0 ) return WRC_Abort;
112577 pNewSrc = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&dummy,pNew,0,0);
112579 *pNew = *p;
112584 pNew->pGroupBy = 0;
112585 pNew->pHaving = 0;
112586 pNew->pOrderBy = 0;
112593 assert( pNew->pPrior!=0 );
112594 pNew->pPrior->pNext = pNew;
112595 pNew->pLimit = 0;
112596 pNew->pOffset = 0;
112941 ExprList *pNew = 0;
112953 pNew = sqlite3ExprListAppend(pParse, pNew, a[k].pExpr);
112954 if( pNew ){
112955 pNew->a[pNew->nExpr-1].zName = a[k].zName;
112956 pNew->a[pNew->nExpr-1].zSpan = a[k].zSpan;
113044 pNew = sqlite3ExprListAppend(pParse, pNew, pExpr);
113047 sqlite3ExprListSetName(pParse, pNew, &sColname, 0);
113048 if( pNew && (p->selFlags & SF_NestedFrom)!=0 ){
113049 struct ExprList_item *pX = &pNew->a[pNew->nExpr-1];
113073 p->pEList = pNew;
117788 FuncDef *pNew;
117823 pNew = sqlite3DbMallocZero(db, sizeof(*pNew)
117825 if( pNew==0 ){
117828 *pNew = *pDef;
117829 pNew->zName = (char *)&pNew[1];
117830 memcpy(pNew->zName, pDef->zName, sqlite3Strlen30(pDef->zName)+1);
117831 pNew->xFunc = xFunc;
117832 pNew->pUserData = pArg;
117833 pNew->funcFlags |= SQLITE_FUNC_EPHEM;
117834 return pNew;
118390 WhereLoop *pNew; /* Template WhereLoop */
120404 Expr *pNew; /* New virtual expression */
120426 pNew = sqlite3ExprDup(db, pOne->pExpr, 0);
120427 if( pNew==0 ) return;
120429 pNew->op = op;
120430 idxNew = whereClauseInsert(pWC, pNew, TERM_VIRTUAL|TERM_DYNAMIC);
120734 Expr *pNew; /* The complete IN operator */
120747 pNew = sqlite3PExpr(pParse, TK_IN, pDup, 0, 0);
120748 if( pNew ){
120750 transferJoinMarkings(pNew, pExpr);
120751 assert( !ExprHasProperty(pNew, EP_xIsSelect) );
120752 pNew->x.pList = pList;
120753 idxNew = whereClauseInsert(pWC, pNew, TERM_VIRTUAL|TERM_DYNAMIC);
120961 WhereTerm *pNew;
120963 u16 eExtraOp = 0; /* Extra bits for pNew->eOperator */
120973 pNew = &pWC->a[idxNew];
120975 if( op==TK_IS ) pNew->wtFlags |= TERM_IS;
120985 pNew = pTerm;
120988 pNew->leftCursor = iCur;
120989 pNew->u.leftColumn = iColumn;
120991 pNew->prereqRight = prereqLeft | extraRight;
120992 pNew->prereqAll = prereqAll;
120993 pNew->eOperator = (operatorMask(pDup->op) + eExtraOp) & opMask;
122694 ** The value in (pBuilder->pNew->u.btree.nEq) is the number of the index
122900 Index *p = pBuilder->pNew->u.btree.pIndex;
122901 int nEq = pBuilder->pNew->u.btree.nEq;
122965 Index *p = pBuilder->pNew->u.btree.pIndex;
123527 ** We have so far matched pBuilder->pNew->u.btree.nEq terms of the
123530 ** When this function is called, pBuilder->pNew->nOut contains the
123547 WhereLoop *pNew; /* Template WhereLoop under construction */
123551 Bitmask saved_prereq; /* Original value of pNew->prereq */
123552 u16 saved_nLTerm; /* Original value of pNew->nLTerm */
123553 u16 saved_nEq; /* Original value of pNew->u.btree.nEq */
123554 u16 saved_nSkip; /* Original value of pNew->nSkip */
123555 u32 saved_wsFlags; /* Original value of pNew->wsFlags */
123556 LogEst saved_nOut; /* Original value of pNew->nOut */
123562 pNew = pBuilder->pNew;
123565 assert( (pNew->wsFlags & WHERE_VIRTUALTABLE)==0 );
123566 assert( (pNew->wsFlags & WHERE_TOP_LIMIT)==0 );
123567 if( pNew->wsFlags & WHERE_BTM_LIMIT ){
123576 assert( pNew->u.btree.nEq<pProbe->nColumn );
123578 saved_nEq = pNew->u.btree.nEq;
123579 saved_nSkip = pNew->nSkip;
123580 saved_nLTerm = pNew->nLTerm;
123581 saved_wsFlags = pNew->wsFlags;
123582 saved_prereq = pNew->prereq;
123583 saved_nOut = pNew->nOut;
123586 pNew->rSetup = 0;
123602 if( pTerm->prereqRight & pNew->maskSelf ) continue;
123608 pNew->wsFlags = saved_wsFlags;
123609 pNew->u.btree.nEq = saved_nEq;
123610 pNew->nLTerm = saved_nLTerm;
123611 if( whereLoopResize(db, pNew, pNew->nLTerm+1) ) break; /* OOM */
123612 pNew->aLTerm[pNew->nLTerm++] = pTerm;
123613 pNew->prereq = (saved_prereq | pTerm->prereqRight) & ~pNew->maskSelf;
123616 || (pNew->wsFlags & WHERE_COLUMN_NULL)!=0
123617 || (pNew->wsFlags & WHERE_COLUMN_IN)!=0
123618 || (pNew->wsFlags & WHERE_SKIPSCAN)!=0
123623 pNew->wsFlags |= WHERE_COLUMN_IN;
123636 pNew->wsFlags |= WHERE_COLUMN_EQ;
123637 assert( saved_nEq==pNew->u.btree.nEq );
123642 pNew->wsFlags |= WHERE_UNQ_WANTED;
123644 pNew->wsFlags |= WHERE_ONEROW;
123648 pNew->wsFlags |= WHERE_COLUMN_NULL;
123652 pNew->wsFlags |= WHERE_COLUMN_RANGE|WHERE_BTM_LIMIT;
123662 if( whereLoopResize(db, pNew, pNew->nLTerm+1) ) break; /* OOM */
123663 pNew->aLTerm[pNew->nLTerm++] = pTop;
123664 pNew->wsFlags |= WHERE_TOP_LIMIT;
123670 pNew->wsFlags |= WHERE_COLUMN_RANGE|WHERE_TOP_LIMIT;
123672 pBtm = (pNew->wsFlags & WHERE_BTM_LIMIT)!=0 ?
123673 pNew->aLTerm[pNew->nLTerm-2] : 0;
123676 /* At this point pNew->nOut is set to the number of rows expected to
123680 ** the value of pNew->nOut to account for pTerm (but not nIn/nInMul). */
123681 assert( pNew->nOut==saved_nOut );
123682 if( pNew->wsFlags & WHERE_COLUMN_RANGE ){
123685 whereRangeScanEst(pParse, pBuilder, pBtm, pTop, pNew);
123687 int nEq = ++pNew->u.btree.nEq;
123690 assert( pNew->nOut==saved_nOut );
123694 pNew->nOut += pTerm->truthProb;
123695 pNew->nOut -= nIn;
123701 && pNew->u.btree.nEq<=pProbe->nSampleCol
123716 pNew->nOut = sqlite3LogEst(nOut);
123717 if( pNew->nOut>saved_nOut ) pNew->nOut = saved_nOut;
123718 pNew->nOut -= nIn;
123724 pNew->nOut += (pProbe->aiRowLogEst[nEq] - pProbe->aiRowLogEst[nEq-1]);
123729 pNew->nOut += 10;
123736 ** it to pNew->rRun, which is currently set to the cost of the index
123739 rCostIdx = pNew->nOut + 1 + (15*pProbe->szIdxRow)/pSrc->pTab->szTabRow;
123740 pNew->rRun = sqlite3LogEstAdd(rLogSize, rCostIdx);
123741 if( (pNew->wsFlags & (WHERE_IDX_ONLY|WHERE_IPK))==0 ){
123742 pNew->rRun = sqlite3LogEstAdd(pNew->rRun, pNew->nOut + 16);
123744 ApplyCostMultiplier(pNew->rRun, pProbe->pTable->costMult);
123746 nOutUnadjusted = pNew->nOut;
123747 pNew->rRun += nInMul + nIn;
123748 pNew->nOut += nInMul + nIn;
123749 whereLoopOutputAdjust(pBuilder->pWC, pNew, rSize);
123750 rc = whereLoopInsert(pBuilder, pNew);
123752 if( pNew->wsFlags & WHERE_COLUMN_RANGE ){
123753 pNew->nOut = saved_nOut;
123755 pNew->nOut = nOutUnadjusted;
123758 if( (pNew->wsFlags & WHERE_TOP_LIMIT)==0
123759 && pNew->u.btree.nEq<pProbe->nColumn
123763 pNew->nOut = saved_nOut;
123768 pNew->prereq = saved_prereq;
123769 pNew->u.btree.nEq = saved_nEq;
123770 pNew->nSkip = saved_nSkip;
123771 pNew->wsFlags = saved_wsFlags;
123772 pNew->nOut = saved_nOut;
123773 pNew->nLTerm = saved_nLTerm;
123790 && (rc = whereLoopResize(db, pNew, pNew->nLTerm+1))==SQLITE_OK
123793 pNew->u.btree.nEq++;
123794 pNew->nSkip++;
123795 pNew->aLTerm[pNew->nLTerm++] = 0;
123796 pNew->wsFlags |= WHERE_SKIPSCAN;
123798 pNew->nOut -= nIter;
123803 pNew->nOut = saved_nOut;
123804 pNew->u.btree.nEq = saved_nEq;
123805 pNew->nSkip = saved_nSkip;
123806 pNew->wsFlags = saved_wsFlags;
123891 ** is idenfied by pBuilder->pNew->iTab. That table is guaranteed to be
123936 WhereLoop *pNew; /* Template WhereLoop object */
123945 pNew = pBuilder->pNew;
123948 pSrc = pTabList->a + pNew->iTab;
124000 if( pTerm->prereqRight & pNew->maskSelf ) continue;
124002 pNew->u.btree.nEq = 1;
124003 pNew->nSkip = 0;
124004 pNew->u.btree.pIndex = 0;
124005 pNew->nLTerm = 1;
124006 pNew->aLTerm[0] = pTerm;
124015 pNew->rSetup = rLogSize + rSize + 4;
124017 pNew->rSetup += 24;
124019 ApplyCostMultiplier(pNew->rSetup, pTab->costMult);
124024 pNew->nOut = 43; assert( 43==sqlite3LogEst(20) );
124025 pNew->rRun = sqlite3LogEstAdd(rLogSize,pNew->nOut);
124026 pNew->wsFlags = WHERE_AUTO_INDEX;
124027 pNew->prereq = mExtra | pTerm->prereqRight;
124028 rc = whereLoopInsert(pBuilder, pNew);
124039 testcase( pNew->iTab!=pSrc->iCursor ); /* See ticket [98d973b8f5] */
124043 pNew->u.btree.nEq = 0;
124044 pNew->nSkip = 0;
124045 pNew->nLTerm = 0;
124046 pNew->iSortIdx = 0;
124047 pNew->rSetup = 0;
124048 pNew->prereq = mExtra;
124049 pNew->nOut = rSize;
124050 pNew->u.btree.pIndex = pProbe;
124056 pNew->wsFlags = WHERE_IPK;
124059 pNew->iSortIdx = b ? iSortIdx : 0;
124061 pNew->rRun = rSize + 16;
124062 ApplyCostMultiplier(pNew->rRun, pTab->costMult);
124063 whereLoopOutputAdjust(pWC, pNew, rSize);
124064 rc = whereLoopInsert(pBuilder, pNew);
124065 pNew->nOut = rSize;
124070 pNew->wsFlags = WHERE_IDX_ONLY | WHERE_INDEXED;
124074 pNew->wsFlags = (m==0) ? (WHERE_IDX_ONLY|WHERE_INDEXED) : WHERE_INDEXED;
124088 pNew->iSortIdx = b ? iSortIdx : 0;
124094 pNew->rRun = rSize + 1 + (15*pProbe->szIdxRow)/pTab->szTabRow;
124096 pNew->rRun = sqlite3LogEstAdd(pNew->rRun, rSize+16);
124098 ApplyCostMultiplier(pNew->rRun, pTab->costMult);
124099 whereLoopOutputAdjust(pWC, pNew, rSize);
124100 rc = whereLoopInsert(pBuilder, pNew);
124101 pNew->nOut = rSize;
124123 ** pBuilder->pNew->iTab. That table is guaranteed to be a virtual table.
124167 WhereLoop *pNew;
124175 pNew = pBuilder->pNew;
124176 pSrc = &pWInfo->pTabList->a[pNew->iTab];
124181 pNew->prereq = 0;
124182 pNew->rSetup = 0;
124183 pNew->wsFlags = WHERE_VIRTUALTABLE;
124184 pNew->nLTerm = 0;
124185 pNew->u.vtab.needFree = 0;
124188 if( whereLoopResize(db, pNew, nConstraint) ){
124241 pNew->prereq = mExtra;
124243 assert( pNew->nLSlot>=nConstraint );
124244 for(i=0; i<nConstraint; i++) pNew->aLTerm[i] = 0;
124245 pNew->u.vtab.omitMask = 0;
124252 || pNew->aLTerm[iTerm]!=0
124262 pNew->prereq |= pTerm->prereqRight;
124263 assert( iTerm<pNew->nLSlot );
124264 pNew->aLTerm[iTerm] = pTerm;
124268 if( iTerm<16 && pUsage[i].omit ) pNew->u.vtab.omitMask |= 1<<iTerm;
124288 pNew->nLTerm = mxTerm+1;
124289 assert( pNew->nLTerm<=pNew->nLSlot );
124290 pNew->u.vtab.idxNum = pIdxInfo->idxNum;
124291 pNew->u.vtab.needFree = pIdxInfo->needToFreeIdxStr;
124293 pNew->u.vtab.idxStr = pIdxInfo->idxStr;
124294 pNew->u.vtab.isOrdered = (i8)(pIdxInfo->orderByConsumed ?
124296 pNew->rSetup = 0;
124297 pNew->rRun = sqlite3LogEstFromDouble(pIdxInfo->estimatedCost);
124298 pNew->nOut = sqlite3LogEst(pIdxInfo->estimatedRows);
124303 pNew->wsFlags |= WHERE_ONEROW;
124305 pNew->wsFlags &= ~WHERE_ONEROW;
124307 whereLoopInsert(pBuilder, pNew);
124308 if( pNew->u.vtab.needFree ){
124309 sqlite3_free(pNew->u.vtab.idxStr);
124310 pNew->u.vtab.needFree = 0;
124333 WhereLoop *pNew;
124344 pNew = pBuilder->pNew;
124346 pItem = pWInfo->pTabList->a + pNew->iTab;
124351 && (pTerm->u.pOrInfo->indexable & pNew->maskSelf)!=0
124418 pNew->nLTerm = 1;
124419 pNew->aLTerm[0] = pTerm;
124420 pNew->wsFlags = WHERE_MULTI_OR;
124421 pNew->rSetup = 0;
124422 pNew->iSortIdx = 0;
124423 memset(&pNew->u, 0, sizeof(pNew->u));
124437 pNew->rRun = sSum.a[i].rRun + 1;
124438 pNew->nOut = sSum.a[i].nOut;
124439 pNew->prereq = sSum.a[i].prereq;
124440 rc = whereLoopInsert(pBuilder, pNew);
124461 WhereLoop *pNew;
124465 pNew = pBuilder->pNew;
124466 whereLoopInit(pNew);
124469 pNew->iTab = iTab;
124470 pNew->maskSelf = sqlite3WhereGetMask(&pWInfo->sMaskSet, pItem->iCursor);
124491 mPrior |= pNew->maskSelf;
124495 whereLoopClear(db, pNew);
125220 pLoop = pBuilder->pNew;
125451 sWLB.pNew = (WhereLoop*)(((char*)pWInfo)+nByteWInfo);
125452 assert( EIGHT_BYTE_ALIGNMENT(sWLB.pNew) );
125453 whereLoopInit(sWLB.pNew);
125455 sWLB.pNew->cId = '*';
127346 yyStackEntry *pNew;
127349 pNew = realloc(p->yystack, newSize*sizeof(pNew[0]));
127350 if( pNew ){
127351 p->yystack = pNew;
128604 struct SrcList_item *pNew = &yygotominor.yy65->a[yygotominor.yy65->nSrc-1];
128606 pNew->zName = pOld->zName;
128607 pNew->zDatabase = pOld->zDatabase;
128608 pNew->pSelect = pOld->pSelect;
134420 /* sqlite3_test_control(SQLITE_TESTCTRL_SCRATCHMALLOC, sz, &pNew, pFree);
134423 ** If sz>0 then allocate a scratch buffer into pNew.
134883 void **pNew = (void **)sqlite3Malloc(nArg*sizeof(void *)*2);
134884 if( pNew ){
134885 memcpy(pNew, aArg, nArg*sizeof(void *));
134887 aDyn = aArg = pNew;
135529 SQLITE_PRIVATE void sqlite3Fts3HashInit(Fts3Hash *pNew, char keyClass, char copyKey);
138643 ** Append SegReader object pNew to the end of the pCsr->apSegment[] array.
138647 Fts3SegReader *pNew
138654 sqlite3Fts3SegReaderFree(pNew);
138659 pCsr->apSegment[pCsr->nSegment++] = pNew;
142908 ** inserted into the tree. This function adds pNew, which is always a binary
142910 ** of pNew and the existing nodes of the tree. This may result in the head
142916 Fts3Expr *pNew /* New binary node to insert into expression tree */
142919 while( pSplit->pParent && opPrecedence(pSplit->pParent)<=opPrecedence(pNew) ){
142925 pSplit->pParent->pRight = pNew;
142926 pNew->pParent = pSplit->pParent;
142928 *ppHead = pNew;
142930 pNew->pLeft = pSplit;
142931 pSplit->pParent = pNew;
143697 ** "pNew" is a pointer to the hash table that is to be initialized.
143704 SQLITE_PRIVATE void sqlite3Fts3HashInit(Fts3Hash *pNew, char keyClass, char copyKey){
143705 assert( pNew!=0 );
143707 pNew->keyClass = keyClass;
143708 pNew->copyKey = copyKey;
143709 pNew->first = 0;
143710 pNew->count = 0;
143711 pNew->htsize = 0;
143712 pNew->ht = 0;
143813 struct _fts3ht *pEntry, /* The entry into which pNew is inserted */
143814 Fts3HashElem *pNew /* The element to be inserted */
143819 pNew->next = pHead;
143820 pNew->prev = pHead->prev;
143821 if( pHead->prev ){ pHead->prev->next = pNew; }
143822 else { pH->first = pNew; }
143823 pHead->prev = pNew;
143825 pNew->next = pH->first;
143826 if( pH->first ){ pH->first->prev = pNew; }
143827 pNew->prev = 0;
143828 pH->first = pNew;
143831 pEntry->chain = pNew;
144653 char *pNew;
144655 pNew = sqlite3_realloc(c->zToken, c->nAllocated);
144656 if( !pNew ) return SQLITE_NOMEM;
144657 c->zToken = pNew;
145379 char *pNew;
145381 pNew = sqlite3_realloc(c->pToken, c->nTokenAllocated);
145382 if( !pNew ) return SQLITE_NOMEM;
145383 c->pToken = pNew;
147889 SegmentNode *pNew;
147959 pNew = (SegmentNode *)sqlite3_malloc(sizeof(SegmentNode) + p->nNodeSize);
147960 if( !pNew ){
147963 memset(pNew, 0, sizeof(SegmentNode));
147964 pNew->nData = 1 + FTS3_VARINT_MAX;
147965 pNew->aData = (char *)&pNew[1];
147973 pTree->pRight = pNew;
147974 pNew->pLeftmost = pTree->pLeftmost;
147975 pNew->pParent = pParent;
147976 pNew->zMalloc = pTree->zMalloc;
147977 pNew->nMalloc = pTree->nMalloc;
147980 pNew->pLeftmost = pNew;
147981 rc = fts3NodeAddTerm(p, &pNew, isCopyTerm, zTerm, nTerm);
147984 *ppTree = pNew;
148514 char *pNew;
148516 pNew = (char *)sqlite3_realloc(pMsr->aBuffer, pMsr->nBuffer);
148517 if( !pNew ) return SQLITE_NOMEM;
148518 pMsr->aBuffer = pNew;
150393 ** This function creates a new node image in blob object *pNew by copying
150400 Blob *pNew, /* OUT: Write new node image here */
150411 blobGrowBuffer(pNew, nNode, &rc);
150413 pNew->n = 0;
150420 if( pNew->n==0 ){
150423 fts3StartNode(pNew, (int)aNode[0], reader.iChild);
150427 pNew, &prev, reader.term.a, reader.term.n,
150432 if( pNew->n==0 ){
150433 fts3StartNode(pNew, (int)aNode[0], reader.iChild);
150436 assert( pNew->n<=pNew->nAlloc );
153498 unicode_tokenizer *pNew; /* New tokenizer object */
153502 pNew = (unicode_tokenizer *) sqlite3_malloc(sizeof(unicode_tokenizer));
153503 if( pNew==NULL ) return SQLITE_NOMEM;
153504 memset(pNew, 0, sizeof(unicode_tokenizer));
153505 pNew->bRemoveDiacritic = 1;
153512 pNew->bRemoveDiacritic = 1;
153515 pNew->bRemoveDiacritic = 0;
153518 rc = unicodeAddExceptions(pNew, 1, &z[11], n-11);
153521 rc = unicodeAddExceptions(pNew, 0, &z[11], n-11);
153530 unicodeDestroy((sqlite3_tokenizer *)pNew);
153531 pNew = 0;
153533 *pp = (sqlite3_tokenizer *)pNew;
155211 RtreeSearchPoint *pNew;
155214 pNew = sqlite3_realloc(pCur->aPoint, nNew*sizeof(pCur->aPoint[0]));
155215 if( pNew==0 ) return 0;
155216 pCur->aPoint = pNew;
155220 pNew = pCur->aPoint + i;
155221 pNew->rScore = rScore;
155222 pNew->iLevel = iLevel;
155228 if( rtreeSearchPointCompare(pNew, pParent)>=0 ) break;
155231 pNew = pParent;
155233 return pNew;
155245 RtreeSearchPoint *pNew, *pFirst;
155254 pNew = rtreeEnqueue(pCur, rScore, iLevel);
155255 if( pNew==0 ) return 0;
155256 ii = (int)(pNew - pCur->aPoint) + 1;
155264 *pNew = pCur->sPoint;
155642 RtreeSearchPoint *pNew;
155643 pNew = rtreeSearchPointNew(pCsr, RTREE_ZERO, pRtree->iDepth+1);
155644 if( pNew==0 ) return SQLITE_NOMEM;
155645 pNew->id = 1;
155646 pNew->iCell = 0;
155647 pNew->eWithin = PARTLY_WITHIN;
162436 char *pNew = (char*)sqlite3_malloc(szRegion);
162437 if( pNew==0 ){
162440 memset(pNew, 0, szRegion);
162441 p->apShm[iRegion] = pNew;
162801 rbu_vfs *pNew = 0; /* Newly allocated VFS */
162808 pNew = (rbu_vfs*)sqlite3_malloc(nByte);
162809 if( pNew==0 ){
162813 memset(pNew, 0, nByte);
162819 memcpy(&pNew->base, &vfs_template, sizeof(sqlite3_vfs));
162820 pNew->base.mxPathname = pParent->mxPathname;
162821 pNew->base.szOsFile = sizeof(rbu_file) + pParent->szOsFile;
162822 pNew->pRealVfs = pParent;
162823 pNew->base.zName = (const char*)(zSpace = (char*)&pNew[1]);
162827 pNew->mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_RECURSIVE);
162828 if( pNew->mutex==0 ){
162831 rc = sqlite3_vfs_register(&pNew->base, 0);
162836 sqlite3_mutex_free(pNew->mutex);
162837 sqlite3_free(pNew);
164192 JsonNode *pNew;
164196 pNew = sqlite3_realloc(pParse->aNode, sizeof(JsonNode)*nNew);
164197 if( pNew==0 ){
164202 pParse->aNode = pNew;
165096 sqlite3_vtab *pNew;
165119 pNew = *ppVtab = sqlite3_malloc( sizeof(*pNew) );
165120 if( pNew==0 ) return SQLITE_NOMEM;
165121 memset(pNew, 0, sizeof(*pNew));
167241 fts5yyStackEntry *pNew;
167244 pNew = realloc(p->fts5yystack, newSize*sizeof(pNew[0]));
167245 if( pNew ){
167246 p->fts5yystack = pNew;
168613 u8 *pNew;
168622 pNew = sqlite3_realloc(pBuf->p, nNew);
168623 if( pNew==0 ){
168628 pBuf->p = pNew;
169979 Fts5Expr *pNew;
169996 *ppNew = pNew = sqlite3_malloc(sizeof(Fts5Expr));
169997 if( pNew==0 ){
170001 pNew->pRoot = sParse.pExpr;
170002 pNew->pIndex = 0;
170003 pNew->apExprPhrase = sParse.apPhrase;
170004 pNew->nPhrase = sParse.nPhrase;
171209 Fts5ExprPhrase *pNew;
171212 pNew = (Fts5ExprPhrase*)sqlite3_realloc(pPhrase,
171215 if( pNew==0 ){
171218 if( pPhrase==0 ) memset(pNew, 0, sizeof(Fts5ExprPhrase));
171219 pCtx->pPhrase = pPhrase = pNew;
171220 pNew->nTerm = nNew - SZALLOC;
171333 Fts5Expr *pNew = 0; /* Expression to return via *ppNew */
171340 pNew = (Fts5Expr*)sqlite3Fts5MallocZero(&rc, sizeof(Fts5Expr));
171342 pNew->apExprPhrase = (Fts5ExprPhrase**)sqlite3Fts5MallocZero(&rc,
171346 pNew->pRoot = (Fts5ExprNode*)sqlite3Fts5MallocZero(&rc,
171350 pNew->pRoot->pNear = (Fts5ExprNearset*)sqlite3Fts5MallocZero(&rc,
171369 pNew->pIndex = pExpr->pIndex;
171370 pNew->nPhrase = 1;
171371 pNew->apExprPhrase[0] = sCtx.pPhrase;
171372 pNew->pRoot->pNear->apPhrase[0] = sCtx.pPhrase;
171373 pNew->pRoot->pNear->nPhrase = 1;
171374 sCtx.pPhrase->pNode = pNew->pRoot;
171377 pNew->pRoot->eType = FTS5_TERM;
171379 pNew->pRoot->eType = FTS5_STRING;
171382 sqlite3Fts5ExprFree(pNew);
171384 pNew = 0;
171387 *ppNew = pNew;
171444 Fts5Colset *pNew; /* New colset object to return */
171449 pNew = sqlite3_realloc(p, sizeof(Fts5Colset) + sizeof(int)*nCol);
171450 if( pNew==0 ){
171453 int *aiCol = pNew->aiCol;
171456 if( aiCol[i]==iCol ) return pNew;
171463 pNew->nCol = nCol+1;
171467 for(i=1; i<pNew->nCol; i++) assert( pNew->aiCol[i]>pNew->aiCol[i-1] );
171471 return pNew;
172085 Fts5Hash *pNew;
172087 *ppNew = pNew = (Fts5Hash*)sqlite3_malloc(sizeof(Fts5Hash));
172088 if( pNew==0 ){
172092 memset(pNew, 0, sizeof(Fts5Hash));
172093 pNew->pnByte = pnByte;
172095 pNew->nSlot = 1024;
172096 nByte = sizeof(Fts5HashEntry*) * pNew->nSlot;
172097 pNew->aSlot = (Fts5HashEntry**)sqlite3_malloc(nByte);
172098 if( pNew->aSlot==0 ){
172099 sqlite3_free(pNew);
172103 memset(pNew->aSlot, 0, nByte);
172271 Fts5HashEntry *pNew;
172273 pNew = (Fts5HashEntry*)sqlite3_realloc(p, nNew);
172274 if( pNew==0 ) return SQLITE_NOMEM;
172275 pNew->nAlloc = nNew;
172277 *pp = pNew;
172278 p = pNew;
173849 Fts5DlidxIter *pNew;
173851 pNew = (Fts5DlidxIter*)sqlite3_realloc(pIter, nByte);
173852 if( pNew==0 ){
173856 Fts5DlidxLvl *pLvl = &pNew->aLvl[i];
173857 pIter = pNew;
174127 Fts5Data *pNew;
174129 pNew = fts5DataRead(p, FTS5_SEGMENT_ROWID(
174132 if( pNew ){
174137 && pIter->iTermLeafOffset<pNew->szLeaf
174139 pIter->pLeaf = pNew;
174143 iRowidOff = fts5LeafFirstRowidOff(pNew);
174145 pIter->pLeaf = pNew;
174155 fts5DataRelease(pNew);
174346 Fts5Data *pNew = fts5DataRead(p, iAbs);
174347 if( pNew ){
174349 iRowid = fts5LeafFirstRowidOff(pNew);
174350 bTermless = fts5LeafIsTermless(pNew);
174352 SWAPVAL(Fts5Data*, pNew, pLast);
174355 fts5DataRelease(pNew);
174985 Fts5SegIter *pNew = &pIter->aSeg[iChanged];
174987 if( pNew->iRowid==pIter->iSwitchRowid
174988 || (pNew->iRowid<pIter->iSwitchRowid)==pIter->bRev
174996 assert( pNew->pLeaf );
175000 if( pNew->iRowid==pOther->iRowid ){
175002 }else if( (pOther->iRowid>pNew->iRowid)==pIter->bRev ){
175004 pNew = pOther;
175009 pRes->iFirst = (pNew - pIter->aSeg);
175071 Fts5IndexIter *pNew;
175075 pNew = fts5IdxMalloc(p,
175076 sizeof(Fts5IndexIter) + /* pNew */
175077 sizeof(Fts5SegIter) * (nSlot-1) + /* pNew->aSeg[] */
175078 sizeof(Fts5CResult) * nSlot /* pNew->aFirst[] */
175080 if( pNew ){
175081 pNew->nSeg = nSlot;
175082 pNew->aFirst = (Fts5CResult*)&pNew->aSeg[nSlot];
175083 pNew->pIndex = p;
175085 return pNew;
175114 Fts5IndexIter *pNew;
175128 *ppOut = pNew = fts5MultiIterAlloc(p, nSeg);
175129 if( pNew==0 ) return;
175130 pNew->bRev = (0!=(flags & FTS5INDEX_QUERY_DESC));
175131 pNew->bSkipEmpty = bSkipEmpty;
175132 pNew->pStruct = pStruct;
175140 Fts5SegIter *pIter = &pNew->aSeg[iIter++];
175146 Fts5SegIter *pIter = &pNew->aSeg[iIter++];
175157 fts5SegIterInit(p, &pLvl->aSeg[iSeg], &pNew->aSeg[iIter++]);
175167 for(iIter=pNew->nSeg-1; iIter>0; iIter--){
175169 if( (iEq = fts5MultiIterDoCompare(pNew, iIter)) ){
175170 fts5SegIterNext(p, &pNew->aSeg[iEq], 0);
175171 fts5MultiIterAdvanced(p, pNew, iEq, iIter);
175174 fts5MultiIterSetEof(pNew);
175175 fts5AssertMultiIterSetup(p, pNew);
175177 if( pNew->bSkipEmpty && fts5MultiIterIsEmpty(p, pNew) ){
175178 fts5MultiIterNext(p, pNew, 0, 0);
175181 fts5MultiIterFree(p, pNew);
175197 Fts5IndexIter *pNew;
175198 pNew = fts5MultiIterAlloc(p, 2);
175199 if( pNew ){
175200 Fts5SegIter *pIter = &pNew->aSeg[1];
175202 pNew->bFiltered = 1;
175208 pNew->aFirst[1].iFirst = 1;
175210 pNew->bRev = 1;
175218 pNew->bEof = 1;
175221 *ppOut = pNew;
175362 ** Return the size of the prefix, in bytes, that buffer (nNew/pNew) shares
175367 int nNew, const u8 *pNew
175370 assert( fts5BlobCompare(pOld, nOld, pNew, nNew)<0 );
175372 if( pOld[i]!=pNew[i] ) break;
176343 Fts5Structure *pNew = 0;
176356 pNew = (Fts5Structure*)sqlite3Fts5MallocZero(&p->rc, nByte);
176359 if( pNew ){
176362 pNew->nLevel = pStruct->nLevel+1;
176363 pNew->nRef = 1;
176364 pNew->nWriteCounter = pStruct->nWriteCounter;
176365 pLvl = &pNew->aLevel[pStruct->nLevel];
176376 pNew->nSegment = pLvl->nSeg = nSeg;
176378 sqlite3_free(pNew);
176379 pNew = 0;
176383 if( pNew ){
176384 int iLvl = pNew->nLevel-1;
176385 while( p->rc==SQLITE_OK && pNew->aLevel[iLvl].nSeg>0 ){
176387 fts5IndexMergeLevel(p, &pNew, iLvl, &nRem);
176390 fts5StructureWrite(p, pNew);
176391 fts5StructureRelease(pNew);
180150 Fts5Cursor *pNew = 0;
180152 rc = fts5OpenMethod(pCsr->base.pVtab, (sqlite3_vtab_cursor**)&pNew);
180155 pNew->ePlan = FTS5_PLAN_MATCH;
180156 pNew->iFirstRowid = SMALLEST_INT64;
180157 pNew->iLastRowid = LARGEST_INT64;
180158 pNew->base.pVtab = (sqlite3_vtab*)pTab;
180159 rc = sqlite3Fts5ExprClonePhrase(pConf, pCsr->pExpr, iPhrase, &pNew->pExpr);
180163 for(rc = fts5CursorFirst(pTab, pNew, 0);
180164 rc==SQLITE_OK && CsrFlagTest(pNew, FTS5CSR_EOF)==0;
180165 rc = fts5NextMethod((sqlite3_vtab_cursor*)pNew)
180167 rc = xCallback(&sFts5Api, (Fts5Context*)pNew, pUserData);
180175 fts5CloseMethod((sqlite3_vtab_cursor*)pNew);
180462 Fts5TokenizerModule *pNew;
180469 pNew = (Fts5TokenizerModule*)sqlite3_malloc(nByte);
180470 if( pNew ){
180471 memset(pNew, 0, nByte);
180472 pNew->zName = (char*)&pNew[1];
180473 memcpy(pNew->zName, zName, nName);
180474 pNew->pUserData = pUserData;
180475 pNew->x = *pTokenizer;
180476 pNew->xDestroy = xDestroy;
180477 pNew->pNext = pGlobal->pTok;
180478 pGlobal->pTok = pNew;
180479 if( pNew->pNext==0 ){
180480 pGlobal->pDfltTok = pNew;