diff options
author | dumi@chromium.org <dumi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-16 03:51:06 +0000 |
---|---|---|
committer | dumi@chromium.org <dumi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-16 03:51:06 +0000 |
commit | 047e07212c7da949be3107a70e3fe9ecb160d818 (patch) | |
tree | 8a53ef891b2bd96b04e7a7698df9004324bb20be | |
parent | a85eba366b78e2f4ff4a90463042bf46ed8e3a50 (diff) | |
download | chromium_src-047e07212c7da949be3107a70e3fe9ecb160d818.zip chromium_src-047e07212c7da949be3107a70e3fe9ecb160d818.tar.gz chromium_src-047e07212c7da949be3107a70e3fe9ecb160d818.tar.bz2 |
Fix the FTS3 patch.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/2849007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49898 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | third_party/sqlite/ext/fts3/fts3.c | 2 | ||||
-rw-r--r-- | third_party/sqlite/fts3.patch | 105 |
2 files changed, 55 insertions, 52 deletions
diff --git a/third_party/sqlite/ext/fts3/fts3.c b/third_party/sqlite/ext/fts3/fts3.c index d75058c..d118c41 100644 --- a/third_party/sqlite/ext/fts3/fts3.c +++ b/third_party/sqlite/ext/fts3/fts3.c @@ -5482,6 +5482,8 @@ static int leavesReaderInit(fulltext_vtab *v, } return rc; } + + pReader->pStmt = s; } return SQLITE_OK; } diff --git a/third_party/sqlite/fts3.patch b/third_party/sqlite/fts3.patch index 2ca7631..83d2412 100644 --- a/third_party/sqlite/fts3.patch +++ b/third_party/sqlite/fts3.patch @@ -1,18 +1,6 @@ -Index: ext/fts3/fts3_tokenizer.c -=================================================================== ---- ext/fts3/fts3_tokenizer.c (revision 48758) -+++ ext/fts3/fts3_tokenizer.c (working copy) -@@ -33,6 +33,7 @@ - #include "fts3_hash.h" - #include "fts3_tokenizer.h" - #include <assert.h> -+#include <stddef.h> - - /* - ** Implementation of the SQL scalar function for accessing the underlying Index: ext/fts3/fts3.c =================================================================== ---- ext/fts3/fts3.c (revision 48758) +--- ext/fts3/fts3.c (revision 48811) +++ ext/fts3/fts3.c (working copy) @@ -271,6 +271,7 @@ ** deletions and duplications. This would basically be a forced merge @@ -1245,7 +1233,7 @@ Index: ext/fts3/fts3.c } /* strcmp-style comparison of pReader's current term against pTerm. -@@ -5222,32 +5423,65 @@ +@@ -5222,32 +5423,67 @@ dataBufferInit(&pReader->rootData, 0); if( iStartBlockid==0 ){ @@ -1288,10 +1276,6 @@ Index: ext/fts3/fts3.c } - if( rc!=SQLITE_ROW ) return rc; -- pReader->pStmt = s; -- leafReaderInit(sqlite3_column_blob(pReader->pStmt, 0), -- sqlite3_column_bytes(pReader->pStmt, 0), -- &pReader->leafReader); + if( rc!=SQLITE_ROW ) goto err; + rc = SQLITE_OK; + @@ -1319,10 +1303,15 @@ Index: ext/fts3/fts3.c + } + return rc; + } ++ + pReader->pStmt = s; +- leafReaderInit(sqlite3_column_blob(pReader->pStmt, 0), +- sqlite3_column_bytes(pReader->pStmt, 0), +- &pReader->leafReader); } return SQLITE_OK; } -@@ -5256,11 +5490,12 @@ +@@ -5256,11 +5492,12 @@ ** end of the current leaf, step forward to the next leaf block. */ static int leavesReaderStep(fulltext_vtab *v, LeavesReader *pReader){ @@ -1337,7 +1326,7 @@ Index: ext/fts3/fts3.c if( pReader->rootData.pData ){ pReader->eof = 1; return SQLITE_OK; -@@ -5270,10 +5505,25 @@ +@@ -5270,10 +5507,25 @@ pReader->eof = 1; return rc==SQLITE_DONE ? SQLITE_OK : rc; } @@ -1367,7 +1356,7 @@ Index: ext/fts3/fts3.c } return SQLITE_OK; } -@@ -5334,8 +5584,19 @@ +@@ -5334,8 +5586,19 @@ sqlite_int64 iEnd = sqlite3_column_int64(s, 1); const char *pRootData = sqlite3_column_blob(s, 2); int nRootData = sqlite3_column_bytes(s, 2); @@ -1388,7 +1377,7 @@ Index: ext/fts3/fts3.c rc = leavesReaderInit(v, i, iStart, iEnd, pRootData, nRootData, &pReaders[i]); if( rc!=SQLITE_OK ) break; -@@ -5346,6 +5607,7 @@ +@@ -5346,6 +5609,7 @@ while( i-->0 ){ leavesReaderDestroy(&pReaders[i]); } @@ -1396,7 +1385,7 @@ Index: ext/fts3/fts3.c return rc; } -@@ -5369,14 +5631,27 @@ +@@ -5369,14 +5633,27 @@ DLReader dlReaders[MERGE_COUNT]; const char *pTerm = leavesReaderTerm(pReaders); int i, nTerm = leavesReaderTermBytes(pReaders); @@ -1427,7 +1416,7 @@ Index: ext/fts3/fts3.c return leafWriterStepMerge(v, pWriter, pTerm, nTerm, dlReaders, nReaders); } -@@ -5429,10 +5704,14 @@ +@@ -5429,10 +5706,14 @@ memset(&lrs, '\0', sizeof(lrs)); rc = leavesReadersInit(v, iLevel, lrs, &i); if( rc!=SQLITE_OK ) return rc; @@ -1443,7 +1432,7 @@ Index: ext/fts3/fts3.c /* Since leavesReaderReorder() pushes readers at eof to the end, ** when the first reader is empty, all will be empty. */ -@@ -5475,12 +5754,14 @@ +@@ -5475,12 +5756,14 @@ } /* Accumulate the union of *acc and *pData into *acc. */ @@ -1461,7 +1450,7 @@ Index: ext/fts3/fts3.c } /* TODO(shess) It might be interesting to explore different merge -@@ -5522,8 +5803,13 @@ +@@ -5522,8 +5805,13 @@ int c = leafReaderTermCmp(&pReader->leafReader, pTerm, nTerm, isPrefix); if( c>0 ) break; /* Past any possible matches. */ if( c==0 ){ @@ -1476,7 +1465,7 @@ Index: ext/fts3/fts3.c /* Find the first empty buffer. */ for(iBuffer=0; iBuffer<nBuffers; ++iBuffer){ -@@ -5569,11 +5855,13 @@ +@@ -5569,11 +5857,13 @@ ** with pData/nData. */ dataBufferSwap(p, pAcc); @@ -1492,7 +1481,7 @@ Index: ext/fts3/fts3.c /* dataBufferReset() could allow a large doclist to blow up ** our memory requirements. -@@ -5598,13 +5886,15 @@ +@@ -5598,13 +5888,15 @@ if( out->nData==0 ){ dataBufferSwap(out, &(pBuffers[iBuffer])); }else{ @@ -1510,7 +1499,7 @@ Index: ext/fts3/fts3.c while( nBuffers-- ){ dataBufferDestroy(&(pBuffers[nBuffers])); } -@@ -5663,20 +5953,26 @@ +@@ -5663,20 +5955,26 @@ ** node. Consider whether breaking symmetry is worthwhile. I suspect ** it is not worthwhile. */ @@ -1543,7 +1532,7 @@ Index: ext/fts3/fts3.c } *piStartChild = interiorReaderCurrentBlockid(&reader); -@@ -5686,7 +5982,11 @@ +@@ -5686,7 +5984,11 @@ */ while( !interiorReaderAtEnd(&reader) ){ if( interiorReaderTermCmp(&reader, pTerm, nTerm, isPrefix)>0 ) break; @@ -1556,7 +1545,7 @@ Index: ext/fts3/fts3.c } *piEndChild = interiorReaderCurrentBlockid(&reader); -@@ -5695,6 +5995,7 @@ +@@ -5695,6 +5997,7 @@ /* Children must ascend, and if !prefix, both must be the same. */ assert( *piEndChild>=*piStartChild ); assert( isPrefix || *piStartChild==*piEndChild ); @@ -1564,7 +1553,7 @@ Index: ext/fts3/fts3.c } /* Read block at iBlockid and pass it with other params to -@@ -5722,12 +6023,32 @@ +@@ -5722,12 +6025,32 @@ if( rc!=SQLITE_OK ) return rc; rc = sqlite3_step(s); @@ -1600,7 +1589,7 @@ Index: ext/fts3/fts3.c /* We expect only one row. We must execute another sqlite3_step() * to complete the iteration; otherwise the table will remain * locked. */ -@@ -5756,8 +6077,9 @@ +@@ -5756,8 +6079,9 @@ /* Process pData as an interior node, then loop down the tree ** until we find the set of leaf nodes to scan for the term. */ @@ -1612,7 +1601,7 @@ Index: ext/fts3/fts3.c while( iStartChild>iLeavesEnd ){ sqlite_int64 iNextStart, iNextEnd; rc = loadAndGetChildrenContaining(v, iStartChild, pTerm, nTerm, isPrefix, -@@ -5809,7 +6131,8 @@ +@@ -5809,7 +6133,8 @@ DataBuffer result; int rc; @@ -1622,7 +1611,7 @@ Index: ext/fts3/fts3.c /* This code should never be called with buffered updates. */ assert( v->nPendingData<0 ); -@@ -5826,16 +6149,21 @@ +@@ -5826,16 +6151,21 @@ DataBuffer merged; DLReader readers[2]; @@ -1652,7 +1641,7 @@ Index: ext/fts3/fts3.c dataBufferDestroy(&result); return rc; } -@@ -5869,11 +6197,20 @@ +@@ -5869,11 +6199,20 @@ const char *pData = sqlite3_column_blob(s, 2); const int nData = sqlite3_column_bytes(s, 2); const sqlite_int64 iLeavesEnd = sqlite3_column_int64(s, 1); @@ -1673,7 +1662,7 @@ Index: ext/fts3/fts3.c if( doclist.nData!=0 ){ /* TODO(shess) The old term_select_all() code applied the column ** restrict as we merged segments, leading to smaller buffers. -@@ -5881,13 +6218,13 @@ +@@ -5881,13 +6220,13 @@ ** system is checked in. */ if( iColumn==v->nColumn) iColumn = -1; @@ -1690,7 +1679,7 @@ Index: ext/fts3/fts3.c dataBufferDestroy(&doclist); return rc; } -@@ -6250,6 +6587,7 @@ +@@ -6250,6 +6589,7 @@ LeafWriter *pWriter){ int i, rc = SQLITE_OK; DataBuffer doclist, merged, tmp; @@ -1698,7 +1687,7 @@ Index: ext/fts3/fts3.c /* Order the readers. */ i = nReaders; -@@ -6270,14 +6608,20 @@ +@@ -6270,14 +6610,20 @@ if( 0!=optLeavesReaderTermCmp(&readers[0], &readers[i]) ) break; } @@ -1723,7 +1712,7 @@ Index: ext/fts3/fts3.c }else{ DLReader dlReaders[MERGE_COUNT]; int iReader, nReaders; -@@ -6285,9 +6629,10 @@ +@@ -6285,9 +6631,10 @@ /* Prime the pipeline with the first reader's doclist. After ** one pass index 0 will reference the accumulated doclist. */ @@ -1737,7 +1726,7 @@ Index: ext/fts3/fts3.c iReader = 1; assert( iReader<i ); /* Must execute the loop at least once. */ -@@ -6295,24 +6640,34 @@ +@@ -6295,24 +6642,34 @@ /* Merge 16 inputs per pass. */ for( nReaders=1; iReader<i && nReaders<MERGE_COUNT; iReader++, nReaders++ ){ @@ -1781,7 +1770,7 @@ Index: ext/fts3/fts3.c } /* Destroy reader that was left in the pipeline. */ -@@ -6320,8 +6675,9 @@ +@@ -6320,8 +6677,9 @@ /* Trim deletions from the doclist. */ dataBufferReset(&merged); @@ -1793,7 +1782,7 @@ Index: ext/fts3/fts3.c } /* Only pass doclists with hits (skip if all hits deleted). */ -@@ -6401,6 +6757,14 @@ +@@ -6401,6 +6759,14 @@ const char *pRootData = sqlite3_column_blob(s, 2); int nRootData = sqlite3_column_bytes(s, 2); @@ -1808,7 +1797,7 @@ Index: ext/fts3/fts3.c assert( i<nReaders ); rc = leavesReaderInit(v, -1, iStart, iEnd, pRootData, nRootData, &readers[i].reader); -@@ -6414,6 +6778,8 @@ +@@ -6414,6 +6780,8 @@ if( rc==SQLITE_DONE ){ assert( i==nReaders ); rc = optimizeInternal(v, readers, nReaders, &writer); @@ -1817,7 +1806,7 @@ Index: ext/fts3/fts3.c } while( i-- > 0 ){ -@@ -6477,9 +6843,18 @@ +@@ -6477,9 +6845,18 @@ const sqlite_int64 iEndBlockid = sqlite3_column_int64(s, 1); const char *pRootData = sqlite3_column_blob(s, 2); const int nRootData = sqlite3_column_bytes(s, 2); @@ -1838,7 +1827,7 @@ Index: ext/fts3/fts3.c if( rc!=SQLITE_OK ) return rc; while( rc==SQLITE_OK && !leavesReaderAtEnd(&reader) ){ -@@ -6641,16 +7016,19 @@ +@@ -6641,16 +7018,19 @@ const char *pData, int nData){ DataBuffer dump; DLReader dlReader; @@ -1861,7 +1850,7 @@ Index: ext/fts3/fts3.c if( DL_DEFAULT==DL_DOCIDS || plrAtEnd(&plReader) ){ sqlite3_snprintf(sizeof(buf), buf, "[%lld] ", dlrDocid(&dlReader)); dataBufferAppend(&dump, buf, strlen(buf)); -@@ -6661,7 +7039,8 @@ +@@ -6661,7 +7041,8 @@ dlrDocid(&dlReader), iColumn); dataBufferAppend(&dump, buf, strlen(buf)); @@ -1871,7 +1860,7 @@ Index: ext/fts3/fts3.c if( plrColumn(&plReader)!=iColumn ){ iColumn = plrColumn(&plReader); sqlite3_snprintf(sizeof(buf), buf, "] %d[", iColumn); -@@ -6682,6 +7061,7 @@ +@@ -6682,6 +7063,7 @@ dataBufferAppend(&dump, buf, strlen(buf)); } plrDestroy(&plReader); @@ -1879,7 +1868,7 @@ Index: ext/fts3/fts3.c assert( dump.nData>0 ); dump.nData--; /* Overwrite trailing space. */ -@@ -6690,6 +7070,10 @@ +@@ -6690,6 +7072,10 @@ } } dlrDestroy(&dlReader); @@ -1890,7 +1879,7 @@ Index: ext/fts3/fts3.c assert( dump.nData>0 ); dump.nData--; /* Overwrite trailing space. */ -@@ -6701,6 +7085,7 @@ +@@ -6701,6 +7087,7 @@ sqlite3_result_text(pContext, dump.pData, dump.nData, sqlite3_free); dump.pData = NULL; dump.nData = dump.nCapacity = 0; @@ -1898,7 +1887,7 @@ Index: ext/fts3/fts3.c } /* Implements dump_doclist() for use in inspecting the fts3 index from -@@ -6987,7 +7372,11 @@ +@@ -6987,7 +7374,11 @@ ** module with sqlite. */ if( SQLITE_OK==rc @@ -1912,7 +1901,7 @@ Index: ext/fts3/fts3.c && SQLITE_OK==(rc = sqlite3_overload_function(db, "optimize", -1)) Index: ext/fts3/fts3_icu.c =================================================================== ---- ext/fts3/fts3_icu.c (revision 48758) +--- ext/fts3/fts3_icu.c (revision 48811) +++ ext/fts3/fts3_icu.c (working copy) @@ -198,7 +198,7 @@ @@ -1923,3 +1912,15 @@ Index: ext/fts3/fts3_icu.c if( u_isspace(c) ){ iStart = iWhite; }else{ +Index: ext/fts3/fts3_tokenizer.c +=================================================================== +--- ext/fts3/fts3_tokenizer.c (revision 48811) ++++ ext/fts3/fts3_tokenizer.c (working copy) +@@ -33,6 +33,7 @@ + #include "fts3_hash.h" + #include "fts3_tokenizer.h" + #include <assert.h> ++#include <stddef.h> + + /* + ** Implementation of the SQL scalar function for accessing the underlying |