1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Merge latest trunk changes with this branch.

FossilOrigin-Name: 5ec933c257884019484db7f533ce920012e47a1c
This commit is contained in:
dan
2015-07-27 10:46:48 +00:00
63 changed files with 2120 additions and 1705 deletions

View File

@ -60,7 +60,7 @@ struct Fts5ExprNode {
/* Child nodes. For a NOT node, this array always contains 2 entries. For
** AND or OR nodes, it contains 2 or more entries. */
int nChild; /* Number of child nodes */
Fts5ExprNode *apChild[0]; /* Array of child nodes */
Fts5ExprNode *apChild[1]; /* Array of child nodes */
};
#define Fts5NodeIsString(p) ((p)->eType==FTS5_TERM || (p)->eType==FTS5_STRING)
@ -1619,7 +1619,7 @@ Fts5ExprNode *sqlite3Fts5ParseNode(
if( pRight->eType==eType ) nChild += pRight->nChild-1;
}
nByte = sizeof(Fts5ExprNode) + sizeof(Fts5ExprNode*)*nChild;
nByte = sizeof(Fts5ExprNode) + sizeof(Fts5ExprNode*)*(nChild-1);
pRet = (Fts5ExprNode*)sqlite3Fts5MallocZero(&pParse->rc, nByte);
if( pRet ){

View File

@ -3690,13 +3690,13 @@ static void fts5IndexMergeLevel(
fts5MultiIterEof(p, pIter)==0;
fts5MultiIterNext(p, pIter, 0, 0)
){
Fts5SegIter *pSeg = &pIter->aSeg[ pIter->aFirst[1].iFirst ];
Fts5SegIter *pSegIter = &pIter->aSeg[ pIter->aFirst[1].iFirst ];
int nPos; /* position-list size field value */
int nTerm;
const u8 *pTerm;
/* Check for key annihilation. */
if( pSeg->nPos==0 && (bOldest || pSeg->bDel==0) ) continue;
if( pSegIter->nPos==0 && (bOldest || pSegIter->bDel==0) ) continue;
pTerm = fts5MultiIterTerm(pIter, &nTerm);
if( nTerm!=term.n || memcmp(pTerm, term.p, nTerm) ){
@ -3715,11 +3715,11 @@ static void fts5IndexMergeLevel(
/* Append the rowid to the output */
/* WRITEPOSLISTSIZE */
nPos = pSeg->nPos*2 + pSeg->bDel;
nPos = pSegIter->nPos*2 + pSegIter->bDel;
fts5WriteAppendRowid(p, &writer, fts5MultiIterRowid(pIter), nPos);
/* Append the position-list data to the output */
fts5ChunkIterate(p, pSeg, (void*)&writer, fts5MergeChunkCallback);
fts5ChunkIterate(p, pSegIter, (void*)&writer, fts5MergeChunkCallback);
}
/* Flush the last leaf page to disk. Set the output segment b-tree height