• Home
  • Raw
  • Download

Lines Matching refs:pWriter

58652   Btree *pWriter;       /* Btree with currently open write transaction */
59469 assert( eLock==READ_LOCK || (p==pBt->pWriter && p->inTrans==TRANS_WRITE) );
59480 if( pBt->pWriter!=p && (pBt->btsFlags & BTS_EXCLUSIVE)!=0 ){
59481 sqlite3ConnectionBlocked(p->db, pBt->pWriter->db);
59500 assert( p==pBt->pWriter );
59602 assert( (pBt->btsFlags & BTS_EXCLUSIVE)==0 || pBt->pWriter==pLock->pBtree );
59615 assert( (pBt->btsFlags & BTS_PENDING)==0 || pBt->pWriter );
59616 if( pBt->pWriter==p ){
59617 pBt->pWriter = 0;
59638 if( pBt->pWriter==p ){
59640 pBt->pWriter = 0;
62449 pBlock = pBt->pWriter->db;
62521 assert( !pBt->pWriter );
62522 pBt->pWriter = p;
158265 SegmentWriter *pWriter = *ppWriter;
158267 if( !pWriter ){
158272 pWriter = (SegmentWriter *)sqlite3_malloc(sizeof(SegmentWriter));
158273 if( !pWriter ) return SQLITE_NOMEM;
158274 memset(pWriter, 0, sizeof(SegmentWriter));
158275 *ppWriter = pWriter;
158278 pWriter->aData = (char *)sqlite3_malloc(p->nNodeSize);
158279 if( !pWriter->aData ) return SQLITE_NOMEM;
158280 pWriter->nSize = p->nNodeSize;
158286 pWriter->iFree = sqlite3_column_int64(pStmt, 0);
158287 pWriter->iFirst = pWriter->iFree;
158292 nData = pWriter->nData;
158294 nPrefix = fts3PrefixCompress(pWriter->zTerm, pWriter->nTerm, zTerm, nTerm);
158308 rc = fts3WriteSegment(p, pWriter->iFree++, pWriter->aData, nData);
158325 rc = fts3NodeAddTerm(p, &pWriter->pTree, isCopyTerm, zTerm, nPrefix+1);
158329 pWriter->nTerm = 0;
158341 pWriter->nLeafData += nReq;
158346 if( nReq>pWriter->nSize ){
158347 char *aNew = sqlite3_realloc(pWriter->aData, nReq);
158349 pWriter->aData = aNew;
158350 pWriter->nSize = nReq;
158352 assert( nData+nReq<=pWriter->nSize );
158355 nData += sqlite3Fts3PutVarint(&pWriter->aData[nData], nPrefix);
158356 nData += sqlite3Fts3PutVarint(&pWriter->aData[nData], nSuffix);
158357 memcpy(&pWriter->aData[nData], &zTerm[nPrefix], nSuffix);
158359 nData += sqlite3Fts3PutVarint(&pWriter->aData[nData], nDoclist);
158360 memcpy(&pWriter->aData[nData], aDoclist, nDoclist);
158361 pWriter->nData = nData + nDoclist;
158369 if( nTerm>pWriter->nMalloc ){
158370 char *zNew = sqlite3_realloc(pWriter->zMalloc, nTerm*2);
158374 pWriter->nMalloc = nTerm*2;
158375 pWriter->zMalloc = zNew;
158376 pWriter->zTerm = zNew;
158378 assert( pWriter->zTerm==pWriter->zMalloc );
158379 memcpy(pWriter->zTerm, zTerm, nTerm);
158381 pWriter->zTerm = (char *)zTerm;
158383 pWriter->nTerm = nTerm;
158396 SegmentWriter *pWriter, /* SegmentWriter to flush to the db */
158401 if( pWriter->pTree ){
158407 iLastLeaf = pWriter->iFree;
158408 rc = fts3WriteSegment(p, pWriter->iFree++, pWriter->aData, pWriter->nData);
158410 rc = fts3NodeWrite(p, pWriter->pTree, 1,
158411 pWriter->iFirst, pWriter->iFree, &iLast, &zRoot, &nRoot);
158415 pWriter->iFirst, iLastLeaf, iLast, pWriter->nLeafData, zRoot, nRoot);
158420 0, 0, 0, pWriter->nLeafData, pWriter->aData, pWriter->nData);
158430 static void fts3SegWriterFree(SegmentWriter *pWriter){
158431 if( pWriter ){
158432 sqlite3_free(pWriter->aData);
158433 sqlite3_free(pWriter->zMalloc);
158434 fts3NodeFree(pWriter->pTree);
158435 sqlite3_free(pWriter);
159224 SegmentWriter *pWriter = 0; /* Used to write the new, merged, segment */
159281 rc = fts3SegWriterAdd(p, &pWriter, 1,
159285 assert( pWriter || bIgnoreEmpty );
159293 if( pWriter ){
159294 rc = fts3SegWriterFlush(p, pWriter, iNewLevel, iIdx);
159297 rc = fts3PromoteSegments(p, iNewLevel, pWriter->nLeafData);
159303 fts3SegWriterFree(pWriter);
159846 IncrmergeWriter *pWriter, /* Writer object */
159850 sqlite3_int64 iPtr = pWriter->aNodeWriter[0].iBlock;
159856 NodeWriter *pNode = &pWriter->aNodeWriter[iLayer];
159997 IncrmergeWriter *pWriter, /* Writer object */
160010 pLeaf = &pWriter->aNodeWriter[0];
160023 pWriter->nWork++;
160038 rc = fts3IncrmergePush(p, pWriter, zTerm, nPrefix+1);
160052 pWriter->nLeafData += nSpace;
160082 IncrmergeWriter *pWriter, /* Merge-writer object */
160095 NodeWriter *pNode = &pWriter->aNodeWriter[iRoot];
160122 Blob *pBlock = &pWriter->aNodeWriter[1].block;
160127 &pBlock->a[1], pWriter->aNodeWriter[0].iBlock
160132 pRoot = &pWriter->aNodeWriter[iRoot];
160136 NodeWriter *pNode = &pWriter->aNodeWriter[i];
160147 pWriter->iAbsLevel+1, /* level */
160148 pWriter->iIdx, /* idx */
160149 pWriter->iStart, /* start_block */
160150 pWriter->aNodeWriter[0].iBlock, /* leaves_end_block */
160151 pWriter->iEnd, /* end_block */
160152 (pWriter->bNoLeafData==0 ? pWriter->nLeafData : 0), /* end_block */
160233 IncrmergeWriter *pWriter /* Populate this object */
160254 fts3ReadEndBlockField(pSelect, 3, &iEnd, &pWriter->nLeafData);
160255 if( pWriter->nLeafData<0 ){
160256 pWriter->nLeafData = pWriter->nLeafData * -1;
160258 pWriter->bNoLeafData = (pWriter->nLeafData==0);
160297 pWriter->nLeafEst = (int)((iEnd - iStart) + 1)/FTS_MAX_APPENDABLE_HEIGHT;
160298 pWriter->iStart = iStart;
160299 pWriter->iEnd = iEnd;
160300 pWriter->iAbsLevel = iAbsLevel;
160301 pWriter->iIdx = iIdx;
160304 pWriter->aNodeWriter[i].iBlock = pWriter->iStart + i*pWriter->nLeafEst;
160307 pNode = &pWriter->aNodeWriter[nHeight];
160308 pNode->iBlock = pWriter->iStart + pWriter->nLeafEst*nHeight;
160317 pNode = &pWriter->aNodeWriter[i];
160328 pNode = &pWriter->aNodeWriter[i-1];
160409 IncrmergeWriter *pWriter /* Populate this object */
160433 pWriter->iStart = sqlite3_column_int64(pFirstBlock, 0);
160434 pWriter->iEnd = pWriter->iStart - 1;
160435 pWriter->iEnd += nLeafEst * FTS_MAX_APPENDABLE_HEIGHT;
160444 rc = fts3WriteSegment(p, pWriter->iEnd, 0, 0);
160447 pWriter->iAbsLevel = iAbsLevel;
160448 pWriter->nLeafEst = nLeafEst;
160449 pWriter->iIdx = iIdx;
160453 pWriter->aNodeWriter[i].iBlock = pWriter->iStart + i*pWriter->nLeafEst;
160870 IncrmergeWriter *pWriter; /* Writer object */
160877 const int nAlloc = sizeof(*pCsr) + sizeof(*pFilter) + sizeof(*pWriter);
160878 pWriter = (IncrmergeWriter *)sqlite3_malloc(nAlloc);
160879 if( !pWriter ) return SQLITE_NOMEM;
160880 pFilter = (Fts3SegFilter *)&pWriter[1];
160941 memset(pWriter, 0, nAlloc);
160966 rc = fts3IncrmergeLoad(p, iAbsLevel, iIdx-1, zKey, nKey, pWriter);
160968 rc = fts3IncrmergeWriter(p, iAbsLevel, iIdx, pCsr, pWriter);
160971 if( rc==SQLITE_OK && pWriter->nLeafEst ){
160974 rc = fts3IncrmergeAppend(p, pWriter, pCsr);
160976 if( pWriter->nWork>=nRem && rc==SQLITE_ROW ) rc = SQLITE_OK;
160981 nRem -= (1 + pWriter->nWork);
160991 pWriter->nLeafData = pWriter->nLeafData * -1;
160993 fts3IncrmergeRelease(p, pWriter, &rc);
160994 if( nSeg==0 && pWriter->bNoLeafData==0 ){
160995 fts3PromoteSegments(p, iAbsLevel+1, pWriter->nLeafData);
161007 sqlite3_free(pWriter);
172314 sqlite3_stmt *pWriter;
172332 pWriter = pIter->pDelete;
172334 pWriter = pIter->pInsert;
172355 p->rc = sqlite3_bind_value(pWriter, i+1, pVal);
172374 p->rc = sqlite3_bind_value(pWriter, pIter->nCol+1, pVal);
172378 sqlite3_step(pWriter);
172379 p->rc = resetAndCollectError(pWriter, &p->zErrmsg);
185643 Fts5PoslistWriter *pWriter,
185648 sqlite3Fts5PoslistSafeAppend(pBuf, &pWriter->iPrev, iPos);
187382 Fts5PoslistWriter *pWriter = &a[i].writer;
187383 if( a[i].pOut->n==0 || iPos!=pWriter->iPrev ){
187384 sqlite3Fts5PoslistWriterAppend(a[i].pOut, pWriter, iPos);
190417 sqlite3_stmt *pWriter; /* "INSERT ... %_data VALUES(?,?)" */
190863 if( p->pWriter==0 ){
190865 fts5IndexPrepareStmt(p, &p->pWriter, sqlite3_mprintf(
190872 sqlite3_bind_int64(p->pWriter, 1, iRowid);
190873 sqlite3_bind_blob(p->pWriter, 2, pData, nData, SQLITE_STATIC);
190874 sqlite3_step(p->pWriter);
190875 p->rc = sqlite3_reset(p->pWriter);
193752 Fts5SegWriter *pWriter,
193756 assert( bFlush==0 || (pWriter->nDlidx>0 && pWriter->aDlidx[0].buf.n>0) );
193757 for(i=0; i<pWriter->nDlidx; i++){
193758 Fts5DlidxWriter *pDlidx = &pWriter->aDlidx[i];
193763 FTS5_DLIDX_ROWID(pWriter->iSegid, i, pDlidx->pgno),
193778 Fts5SegWriter *pWriter,
193781 if( p->rc==SQLITE_OK && nLvl>=pWriter->nDlidx ){
193783 pWriter->aDlidx, sizeof(Fts5DlidxWriter) * nLvl
193788 int nByte = sizeof(Fts5DlidxWriter) * (nLvl - pWriter->nDlidx);
193789 memset(&aDlidx[pWriter->nDlidx], 0, nByte);
193790 pWriter->aDlidx = aDlidx;
193791 pWriter->nDlidx = nLvl;
193802 static int fts5WriteFlushDlidx(Fts5Index *p, Fts5SegWriter *pWriter){
193807 if( pWriter->aDlidx[0].buf.n>0 && pWriter->nEmpty>=FTS5_MIN_DLIDX_SIZE ){
193810 fts5WriteDlidxClear(p, pWriter, bFlag);
193811 pWriter->nEmpty = 0;
193826 static void fts5WriteFlushBtree(Fts5Index *p, Fts5SegWriter *pWriter){
193829 assert( pWriter->iBtPage || pWriter->nEmpty==0 );
193830 if( pWriter->iBtPage==0 ) return;
193831 bFlag = fts5WriteFlushDlidx(p, pWriter);
193834 const char *z = (pWriter->btterm.n>0?(const char*)pWriter->btterm.p:"");
193837 sqlite3_bind_blob(p->pIdxWriter, 2, z, pWriter->btterm.n, SQLITE_STATIC);
193838 sqlite3_bind_int64(p->pIdxWriter, 3, bFlag + ((i64)pWriter->iBtPage<<1));
193842 pWriter->iBtPage = 0;
193856 Fts5SegWriter *pWriter, /* Writer object */
193859 fts5WriteFlushBtree(p, pWriter);
193860 fts5BufferSet(&p->rc, &pWriter->btterm, nTerm, pTerm);
193861 pWriter->iBtPage = pWriter->writer.pgno;
193870 Fts5SegWriter *pWriter /* Writer object */
193874 if( pWriter->bFirstRowidInPage && pWriter->aDlidx[0].buf.n>0 ){
193875 Fts5DlidxWriter *pDlidx = &pWriter->aDlidx[0];
193881 pWriter->nEmpty++;
193900 Fts5SegWriter *pWriter,
193908 Fts5DlidxWriter *pDlidx = &pWriter->aDlidx[i];
193918 FTS5_DLIDX_ROWID(pWriter->iSegid, i, pDlidx->pgno),
193921 fts5WriteDlidxGrow(p, pWriter, i+2);
193922 pDlidx = &pWriter->aDlidx[i];
193945 i64 iPgno = (i==0 ? pWriter->writer.pgno : pDlidx[-1].pgno);
193958 static void fts5WriteFlushLeaf(Fts5Index *p, Fts5SegWriter *pWriter){
193960 Fts5PageWriter *pPage = &pWriter->writer;
193963 assert( (pPage->pgidx.n==0)==(pWriter->bFirstTermInPage) );
193969 if( pWriter->bFirstTermInPage ){
193972 fts5WriteBtreeNoTerm(p, pWriter);
193979 iRowid = FTS5_SEGMENT_ROWID(pWriter->iSegid, pPage->pgno);
193990 pWriter->nLeafWritten++;
193993 pWriter->bFirstTermInPage = 1;
193994 pWriter->bFirstRowidInPage = 1;
194006 Fts5SegWriter *pWriter,
194010 Fts5PageWriter *pPage = &pWriter->writer;
194011 Fts5Buffer *pPgidx = &pWriter->writer.pgidx;
194015 assert( pPage->buf.n>4 || pWriter->bFirstTermInPage );
194020 fts5WriteFlushLeaf(p, pWriter);
194035 if( pWriter->bFirstTermInPage ){
194055 fts5WriteBtreeTerm(p, pWriter, n, pTerm);
194056 pPage = &pWriter->writer;
194070 pWriter->bFirstTermInPage = 0;
194072 pWriter->bFirstRowidInPage = 0;
194073 pWriter->bFirstRowidInDoclist = 1;
194075 assert( p->rc || (pWriter->nDlidx>0 && pWriter->aDlidx[0].buf.n==0) );
194076 pWriter->aDlidx[0].pgno = pPage->pgno;
194084 Fts5SegWriter *pWriter,
194088 Fts5PageWriter *pPage = &pWriter->writer;
194091 fts5WriteFlushLeaf(p, pWriter);
194097 if( pWriter->bFirstRowidInPage ){
194099 fts5WriteDlidxAppend(p, pWriter, iRowid);
194103 if( pWriter->bFirstRowidInDoclist || pWriter->bFirstRowidInPage ){
194106 assert( p->rc || iRowid>pWriter->iPrevRowid );
194107 fts5BufferAppendVarint(&p->rc, &pPage->buf, iRowid - pWriter->iPrevRowid);
194109 pWriter->iPrevRowid = iRowid;
194110 pWriter->bFirstRowidInDoclist = 0;
194111 pWriter->bFirstRowidInPage = 0;
194117 Fts5SegWriter *pWriter,
194121 Fts5PageWriter *pPage = &pWriter->writer;
194138 fts5WriteFlushLeaf(p, pWriter);
194151 Fts5SegWriter *pWriter, /* Writer object */
194155 Fts5PageWriter *pLeaf = &pWriter->writer;
194159 fts5WriteFlushLeaf(p, pWriter);
194163 fts5WriteFlushBtree(p, pWriter);
194169 fts5BufferFree(&pWriter->btterm);
194171 for(i=0; i<pWriter->nDlidx; i++){
194172 sqlite3Fts5BufferFree(&pWriter->aDlidx[i].buf);
194174 sqlite3_free(pWriter->aDlidx);
194179 Fts5SegWriter *pWriter,
194184 memset(pWriter, 0, sizeof(Fts5SegWriter));
194185 pWriter->iSegid = iSegid;
194187 fts5WriteDlidxGrow(p, pWriter, 1);
194188 pWriter->writer.pgno = 1;
194189 pWriter->bFirstTermInPage = 1;
194190 pWriter->iBtPage = 1;
194192 assert( pWriter->writer.buf.n==0 );
194193 assert( pWriter->writer.pgidx.n==0 );
194196 sqlite3Fts5BufferSize(&p->rc, &pWriter->writer.pgidx, nBuffer);
194197 sqlite3Fts5BufferSize(&p->rc, &pWriter->writer.buf, nBuffer);
194209 memset(pWriter->writer.buf.p, 0, 4);
194210 pWriter->writer.buf.n = 4;
194215 sqlite3_bind_int(p->pIdxWriter, 1, pWriter->iSegid);
194286 Fts5SegWriter *pWriter = (Fts5SegWriter*)pCtx;
194287 fts5WriteAppendPoslistData(p, pWriter, pChunk, nChunk);
195339 sqlite3_finalize(p->pWriter);