Lines Matching refs:pReader
92068 PmaReader *pReader; /* Readr data from here after Rewind() */
92972 assert( pSorter->bUseThreads || pSorter->pReader==0 );
92974 if( pSorter->pReader ){
92975 vdbePmaReaderClear(pSorter->pReader);
92976 sqlite3DbFree(db, pSorter->pReader);
92977 pSorter->pReader = 0;
93634 PmaReader *pReader = &pMerger->aReadr[ pMerger->aTree[1] ];
93635 int nKey = pReader->nKey;
93640 if( pReader->pFd==0 ) break;
93645 vdbePmaWriteBlob(&writer, pReader->aKey, nKey);
93997 PmaReader *pReader = (PmaReader*)pCtx;
93999 vdbePmaReaderIncrMergeInit(pReader,INCRINIT_TASK)
94001 pReader->pIncr->pTask->bDone = 1;
94263 pSorter->pReader = pReadr;
94356 assert( pSorter->pReader==0 );
94379 assert( pSorter->bUsePMA || (pSorter->pReader==0 && pSorter->pMerger==0) );
94381 assert( pSorter->pReader==0 || pSorter->pMerger==0 );
94382 assert( pSorter->bUseThreads==0 || pSorter->pReader );
94386 rc = vdbePmaReaderNext(pSorter->pReader);
94387 if( rc==SQLITE_OK && pSorter->pReader->pFd==0 ) rc = SQLITE_DONE;
94417 PmaReader *pReader;
94420 pReader = pSorter->pReader;
94424 pReader = &pSorter->pMerger->aReadr[pSorter->pMerger->aTree[1]];
94426 *pnKey = pReader->nKey;
94427 pKey = pReader->aKey;
171810 static int fts3SegReaderIncrRead(Fts3SegReader *pReader){
171814 nRead = MIN(pReader->nNode - pReader->nPopulate, FTS3_NODE_CHUNKSIZE);
171816 pReader->pBlob,
171817 &pReader->aNode[pReader->nPopulate],
171819 pReader->nPopulate
171823 pReader->nPopulate += nRead;
171824 memset(&pReader->aNode[pReader->nPopulate], 0, FTS3_NODE_PADDING);
171825 if( pReader->nPopulate==pReader->nNode ){
171826 sqlite3_blob_close(pReader->pBlob);
171827 pReader->pBlob = 0;
171828 pReader->nPopulate = 0;
171834 static int fts3SegReaderRequire(Fts3SegReader *pReader, char *pFrom, int nByte){
171836 assert( !pReader->pBlob
171837 || (pFrom>=pReader->aNode && pFrom<&pReader->aNode[pReader->nNode])
171839 while( pReader->pBlob && rc==SQLITE_OK
171840 && (pFrom - pReader->aNode + nByte)>pReader->nPopulate
171842 rc = fts3SegReaderIncrRead(pReader);
171866 Fts3SegReader *pReader,
171874 if( !pReader->aDoclist ){
171875 pNext = pReader->aNode;
171877 pNext = &pReader->aDoclist[pReader->nDoclist];
171880 if( !pNext || pNext>=&pReader->aNode[pReader->nNode] ){
171882 if( fts3SegReaderIsPending(pReader) ){
171883 Fts3HashElem *pElem = *(pReader->ppNextElem);
171884 sqlite3_free(pReader->aNode);
171885 pReader->aNode = 0;
171890 pReader->zTerm = (char *)fts3HashKey(pElem);
171891 pReader->nTerm = fts3HashKeysize(pElem);
171895 pReader->nNode = pReader->nDoclist = nCopy;
171896 pReader->aNode = pReader->aDoclist = aCopy;
171897 pReader->ppNextElem++;
171898 assert( pReader->aNode );
171903 fts3SegReaderSetEof(pReader);
171908 assert( pReader->iCurrentBlock<=pReader->iLeafEndBlock || CORRUPT_DB );
171910 if( pReader->iCurrentBlock>=pReader->iLeafEndBlock ){
171915 p, ++pReader->iCurrentBlock, &pReader->aNode, &pReader->nNode,
171916 (bIncr ? &pReader->nPopulate : 0)
171919 assert( pReader->pBlob==0 );
171920 if( bIncr && pReader->nPopulate<pReader->nNode ){
171921 pReader->pBlob = p->pSegments;
171924 pNext = pReader->aNode;
171927 assert( !fts3SegReaderIsPending(pReader) );
171929 rc = fts3SegReaderRequire(pReader, pNext, FTS3_VARINT_MAX*2);
171937 || (&pReader->aNode[pReader->nNode] - pNext)<nSuffix
171938 || nPrefix>pReader->nTerm
171946 if( (i64)nPrefix+nSuffix>(i64)pReader->nTermAlloc ){
171948 char *zNew = sqlite3_realloc64(pReader->zTerm, nNew);
171952 pReader->zTerm = zNew;
171953 pReader->nTermAlloc = nNew;
171956 rc = fts3SegReaderRequire(pReader, pNext, nSuffix+FTS3_VARINT_MAX);
171959 memcpy(&pReader->zTerm[nPrefix], pNext, nSuffix);
171960 pReader->nTerm = nPrefix+nSuffix;
171962 pNext += fts3GetVarint32(pNext, &pReader->nDoclist);
171963 pReader->aDoclist = pNext;
171964 pReader->pOffsetList = 0;
171970 if( pReader->nDoclist > pReader->nNode-(pReader->aDoclist-pReader->aNode)
171971 || (pReader->nPopulate==0 && pReader->aDoclist[pReader->nDoclist-1])
171982 static int fts3SegReaderFirstDocid(Fts3Table *pTab, Fts3SegReader *pReader){
171984 assert( pReader->aDoclist );
171985 assert( !pReader->pOffsetList );
171986 if( pTab->bDescIdx && fts3SegReaderIsPending(pReader) ){
171988 pReader->iDocid = 0;
171989 pReader->nOffsetList = 0;
171991 pReader->aDoclist, pReader->nDoclist, &pReader->pOffsetList,
171992 &pReader->iDocid, &pReader->nOffsetList, &bEof
171995 rc = fts3SegReaderRequire(pReader, pReader->aDoclist, FTS3_VARINT_MAX);
171997 int n = sqlite3Fts3GetVarint(pReader->aDoclist, &pReader->iDocid);
171998 pReader->pOffsetList = &pReader->aDoclist[n];
172016 Fts3SegReader *pReader, /* Reader to advance to next docid */
172021 char *p = pReader->pOffsetList;
172026 if( pTab->bDescIdx && fts3SegReaderIsPending(pReader) ){
172032 *ppOffsetList = pReader->pOffsetList;
172033 *pnOffsetList = pReader->nOffsetList - 1;
172036 pReader->aDoclist, pReader->nDoclist, &p, &pReader->iDocid,
172037 &pReader->nOffsetList, &bEof
172040 pReader->pOffsetList = 0;
172042 pReader->pOffsetList = p;
172045 char *pEnd = &pReader->aDoclist[pReader->nDoclist];
172061 if( pReader->pBlob==0 || p<&pReader->aNode[pReader->nPopulate] ) break;
172062 rc = fts3SegReaderIncrRead(pReader);
172071 *ppOffsetList = pReader->pOffsetList;
172072 *pnOffsetList = (int)(p - pReader->pOffsetList - 1);
172084 pReader->pOffsetList = 0;
172086 rc = fts3SegReaderRequire(pReader, p, FTS3_VARINT_MAX);
172089 pReader->pOffsetList = p + sqlite3Fts3GetVarintU(p, &iDelta);
172091 pReader->iDocid = (i64)((u64)pReader->iDocid - iDelta);
172093 pReader->iDocid = (i64)((u64)pReader->iDocid + iDelta);
172118 Fts3SegReader *pReader = pMsr->apSegment[ii];
172119 if( !fts3SegReaderIsPending(pReader)
172120 && !fts3SegReaderIsRootOnly(pReader)
172123 for(jj=pReader->iStartBlock; jj<=pReader->iLeafEndBlock; jj++){
172141 SQLITE_PRIVATE void sqlite3Fts3SegReaderFree(Fts3SegReader *pReader){
172142 if( pReader ){
172143 if( !fts3SegReaderIsPending(pReader) ){
172144 sqlite3_free(pReader->zTerm);
172146 if( !fts3SegReaderIsRootOnly(pReader) ){
172147 sqlite3_free(pReader->aNode);
172149 sqlite3_blob_close(pReader->pBlob);
172151 sqlite3_free(pReader);
172167 Fts3SegReader *pReader; /* Newly allocated SegReader object */
172180 pReader = (Fts3SegReader *)sqlite3_malloc(sizeof(Fts3SegReader) + nExtra);
172181 if( !pReader ){
172184 memset(pReader, 0, sizeof(Fts3SegReader));
172185 pReader->iIdx = iAge;
172186 pReader->bLookup = bLookup!=0;
172187 pReader->iStartBlock = iStartLeaf;
172188 pReader->iLeafEndBlock = iEndLeaf;
172189 pReader->iEndBlock = iEndBlock;
172193 pReader->aNode = (char *)&pReader[1];
172194 pReader->rootOnly = 1;
172195 pReader->nNode = nRoot;
172196 if( nRoot ) memcpy(pReader->aNode, zRoot, nRoot);
172197 memset(&pReader->aNode[nRoot], 0, FTS3_NODE_PADDING);
172199 pReader->iCurrentBlock = iStartLeaf-1;
172201 *ppReader = pReader;
172254 Fts3SegReader *pReader = 0; /* Fts3SegReader object to return */
172313 pReader = (Fts3SegReader *)sqlite3_malloc64(nByte);
172314 if( !pReader ){
172317 memset(pReader, 0, nByte);
172318 pReader->iIdx = 0x7FFFFFFF;
172319 pReader->ppNextElem = (Fts3HashElem **)&pReader[1];
172320 memcpy(pReader->ppNextElem, aElem, nElem*sizeof(Fts3HashElem *));
172327 *ppReader = pReader;
209440 sqlite3_blob *pReader; /* RO incr-blob open on %_data table */
209763 if( p->pReader ){
209764 sqlite3_blob *pReader = p->pReader;
209765 p->pReader = 0;
209766 sqlite3_blob_close(pReader);
209781 if( p->pReader ){
209785 sqlite3_blob *pBlob = p->pReader;
209786 p->pReader = 0;
209788 assert( p->pReader==0 );
209789 p->pReader = pBlob;
209798 if( p->pReader==0 && rc==SQLITE_OK ){
209801 pConfig->zDb, p->zDataTbl, "block", iRowid, 0, &p->pReader
209814 int nByte = sqlite3_blob_bytes(p->pReader);
209825 rc = sqlite3_blob_read(p->pReader, aOut, nByte, 0);
214417 assert( p->pReader==0 );