Merge updates from trunk.
FossilOrigin-Name: 224c65e4a5c6ede076c364c93933cedd17f1e70b
This commit is contained in:
commit
4ec0100f35
121
ext/fts3/fts3.c
121
ext/fts3/fts3.c
@ -3945,7 +3945,7 @@ void sqlite3Fts3DoclistPrev(
|
||||
int nDoclist, /* Length of aDoclist in bytes */
|
||||
char **ppIter, /* IN/OUT: Iterator pointer */
|
||||
sqlite3_int64 *piDocid, /* IN/OUT: Docid pointer */
|
||||
int *pnList, /* IN/OUT: List length pointer */
|
||||
int *pnList, /* OUT: List length pointer */
|
||||
u8 *pbEof /* OUT: End-of-file flag */
|
||||
){
|
||||
char *p = *ppIter;
|
||||
@ -3992,6 +3992,41 @@ void sqlite3Fts3DoclistPrev(
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Iterate forwards through a doclist.
|
||||
*/
|
||||
void sqlite3Fts3DoclistNext(
|
||||
int bDescIdx, /* True if the doclist is desc */
|
||||
char *aDoclist, /* Pointer to entire doclist */
|
||||
int nDoclist, /* Length of aDoclist in bytes */
|
||||
char **ppIter, /* IN/OUT: Iterator pointer */
|
||||
sqlite3_int64 *piDocid, /* IN/OUT: Docid pointer */
|
||||
u8 *pbEof /* OUT: End-of-file flag */
|
||||
){
|
||||
char *p = *ppIter;
|
||||
|
||||
assert( nDoclist>0 );
|
||||
assert( *pbEof==0 );
|
||||
assert( p || *piDocid==0 );
|
||||
assert( !p || (p>=aDoclist && p<=&aDoclist[nDoclist]) );
|
||||
|
||||
if( p==0 ){
|
||||
p = aDoclist;
|
||||
p += sqlite3Fts3GetVarint(p, piDocid);
|
||||
}else{
|
||||
fts3PoslistCopy(0, &p);
|
||||
if( p>=&aDoclist[nDoclist] ){
|
||||
*pbEof = 1;
|
||||
}else{
|
||||
sqlite3_int64 iVar;
|
||||
p += sqlite3Fts3GetVarint(p, &iVar);
|
||||
*piDocid += ((bDescIdx ? -1 : 1) * iVar);
|
||||
}
|
||||
}
|
||||
|
||||
*ppIter = p;
|
||||
}
|
||||
|
||||
/*
|
||||
** Attempt to move the phrase iterator to point to the next matching docid.
|
||||
** If an error occurs, return an SQLite error code. Otherwise, return
|
||||
@ -5147,26 +5182,87 @@ int sqlite3Fts3EvalPhraseStats(
|
||||
** This function works regardless of whether or not the phrase is deferred,
|
||||
** incremental, or neither.
|
||||
*/
|
||||
char *sqlite3Fts3EvalPhrasePoslist(
|
||||
int sqlite3Fts3EvalPhrasePoslist(
|
||||
Fts3Cursor *pCsr, /* FTS3 cursor object */
|
||||
Fts3Expr *pExpr, /* Phrase to return doclist for */
|
||||
int iCol /* Column to return position list for */
|
||||
int iCol, /* Column to return position list for */
|
||||
char **ppOut /* OUT: Pointer to position list */
|
||||
){
|
||||
Fts3Phrase *pPhrase = pExpr->pPhrase;
|
||||
Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;
|
||||
char *pIter = pPhrase->doclist.pList;
|
||||
char *pIter;
|
||||
int iThis;
|
||||
sqlite3_int64 iDocid;
|
||||
|
||||
/* If this phrase is applies specifically to some column other than
|
||||
** column iCol, return a NULL pointer. */
|
||||
*ppOut = 0;
|
||||
assert( iCol>=0 && iCol<pTab->nColumn );
|
||||
if( !pIter
|
||||
|| pExpr->bEof
|
||||
|| pExpr->iDocid!=pCsr->iPrevId
|
||||
|| (pPhrase->iColumn<pTab->nColumn && pPhrase->iColumn!=iCol)
|
||||
){
|
||||
return 0;
|
||||
if( (pPhrase->iColumn<pTab->nColumn && pPhrase->iColumn!=iCol) ){
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
assert( pPhrase->doclist.nList>0 );
|
||||
iDocid = pExpr->iDocid;
|
||||
pIter = pPhrase->doclist.pList;
|
||||
if( iDocid!=pCsr->iPrevId || pExpr->bEof ){
|
||||
int bDescDoclist = pTab->bDescIdx; /* For DOCID_CMP macro */
|
||||
int bOr = 0;
|
||||
u8 bEof = 0;
|
||||
Fts3Expr *p;
|
||||
|
||||
/* Check if this phrase descends from an OR expression node. If not,
|
||||
** return NULL. Otherwise, the entry that corresponds to docid
|
||||
** pCsr->iPrevId may lie earlier in the doclist buffer. */
|
||||
for(p=pExpr->pParent; p; p=p->pParent){
|
||||
if( p->eType==FTSQUERY_OR ) bOr = 1;
|
||||
}
|
||||
if( bOr==0 ) return SQLITE_OK;
|
||||
|
||||
/* This is the descendent of an OR node. In this case we cannot use
|
||||
** an incremental phrase. Load the entire doclist for the phrase
|
||||
** into memory in this case. */
|
||||
if( pPhrase->bIncr ){
|
||||
int rc = SQLITE_OK;
|
||||
int bEofSave = pExpr->bEof;
|
||||
fts3EvalRestart(pCsr, pExpr, &rc);
|
||||
while( rc==SQLITE_OK && !pExpr->bEof ){
|
||||
fts3EvalNextRow(pCsr, pExpr, &rc);
|
||||
if( bEofSave==0 && pExpr->iDocid==iDocid ) break;
|
||||
}
|
||||
pIter = pPhrase->doclist.pList;
|
||||
assert( rc!=SQLITE_OK || pPhrase->bIncr==0 );
|
||||
if( rc!=SQLITE_OK ) return rc;
|
||||
}
|
||||
|
||||
if( pExpr->bEof ){
|
||||
pIter = 0;
|
||||
iDocid = 0;
|
||||
}
|
||||
bEof = (pPhrase->doclist.nAll==0);
|
||||
assert( bDescDoclist==0 || bDescDoclist==1 );
|
||||
assert( pCsr->bDesc==0 || pCsr->bDesc==1 );
|
||||
|
||||
if( pCsr->bDesc==bDescDoclist ){
|
||||
int dummy;
|
||||
while( (pIter==0 || DOCID_CMP(iDocid, pCsr->iPrevId)>0 ) && bEof==0 ){
|
||||
sqlite3Fts3DoclistPrev(
|
||||
bDescDoclist, pPhrase->doclist.aAll, pPhrase->doclist.nAll,
|
||||
&pIter, &iDocid, &dummy, &bEof
|
||||
);
|
||||
}
|
||||
}else{
|
||||
while( (pIter==0 || DOCID_CMP(iDocid, pCsr->iPrevId)<0 ) && bEof==0 ){
|
||||
sqlite3Fts3DoclistNext(
|
||||
bDescDoclist, pPhrase->doclist.aAll, pPhrase->doclist.nAll,
|
||||
&pIter, &iDocid, &bEof
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if( bEof || iDocid!=pCsr->iPrevId ) pIter = 0;
|
||||
}
|
||||
if( pIter==0 ) return SQLITE_OK;
|
||||
|
||||
if( *pIter==0x01 ){
|
||||
pIter++;
|
||||
pIter += sqlite3Fts3GetVarint32(pIter, &iThis);
|
||||
@ -5180,7 +5276,8 @@ char *sqlite3Fts3EvalPhrasePoslist(
|
||||
pIter += sqlite3Fts3GetVarint32(pIter, &iThis);
|
||||
}
|
||||
|
||||
return ((iCol==iThis)?pIter:0);
|
||||
*ppOut = ((iCol==iThis)?pIter:0);
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -535,7 +535,7 @@ int sqlite3Fts3MsrIncrStart(
|
||||
Fts3Table*, Fts3MultiSegReader*, int, const char*, int);
|
||||
int sqlite3Fts3MsrIncrNext(
|
||||
Fts3Table *, Fts3MultiSegReader *, sqlite3_int64 *, char **, int *);
|
||||
char *sqlite3Fts3EvalPhrasePoslist(Fts3Cursor *, Fts3Expr *, int iCol);
|
||||
int sqlite3Fts3EvalPhrasePoslist(Fts3Cursor *, Fts3Expr *, int iCol, char **);
|
||||
int sqlite3Fts3MsrOvfl(Fts3Cursor *, Fts3MultiSegReader *, int *);
|
||||
int sqlite3Fts3MsrIncrRestart(Fts3MultiSegReader *pCsr);
|
||||
|
||||
|
@ -360,10 +360,11 @@ static int fts3SnippetFindPositions(Fts3Expr *pExpr, int iPhrase, void *ctx){
|
||||
SnippetIter *p = (SnippetIter *)ctx;
|
||||
SnippetPhrase *pPhrase = &p->aPhrase[iPhrase];
|
||||
char *pCsr;
|
||||
int rc;
|
||||
|
||||
pPhrase->nToken = pExpr->pPhrase->nToken;
|
||||
|
||||
pCsr = sqlite3Fts3EvalPhrasePoslist(p->pCsr, pExpr, p->iCol);
|
||||
rc = sqlite3Fts3EvalPhrasePoslist(p->pCsr, pExpr, p->iCol, &pCsr);
|
||||
assert( rc==SQLITE_OK || pCsr==0 );
|
||||
if( pCsr ){
|
||||
int iFirst = 0;
|
||||
pPhrase->pList = pCsr;
|
||||
@ -374,10 +375,12 @@ static int fts3SnippetFindPositions(Fts3Expr *pExpr, int iPhrase, void *ctx){
|
||||
pPhrase->iHead = iFirst;
|
||||
pPhrase->iTail = iFirst;
|
||||
}else{
|
||||
assert( pPhrase->pList==0 && pPhrase->pHead==0 && pPhrase->pTail==0 );
|
||||
assert( rc!=SQLITE_OK || (
|
||||
pPhrase->pList==0 && pPhrase->pHead==0 && pPhrase->pTail==0
|
||||
));
|
||||
}
|
||||
|
||||
return SQLITE_OK;
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -770,13 +773,14 @@ static int fts3ExprLocalHitsCb(
|
||||
int iPhrase, /* Phrase number */
|
||||
void *pCtx /* Pointer to MatchInfo structure */
|
||||
){
|
||||
int rc = SQLITE_OK;
|
||||
MatchInfo *p = (MatchInfo *)pCtx;
|
||||
int iStart = iPhrase * p->nCol * 3;
|
||||
int i;
|
||||
|
||||
for(i=0; i<p->nCol; i++){
|
||||
for(i=0; i<p->nCol && rc==SQLITE_OK; i++){
|
||||
char *pCsr;
|
||||
pCsr = sqlite3Fts3EvalPhrasePoslist(p->pCursor, pExpr, i);
|
||||
rc = sqlite3Fts3EvalPhrasePoslist(p->pCursor, pExpr, i, &pCsr);
|
||||
if( pCsr ){
|
||||
p->aMatchinfo[iStart+i*3] = fts3ColumnlistCount(&pCsr);
|
||||
}else{
|
||||
@ -784,7 +788,7 @@ static int fts3ExprLocalHitsCb(
|
||||
}
|
||||
}
|
||||
|
||||
return SQLITE_OK;
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int fts3MatchinfoCheck(
|
||||
@ -945,8 +949,10 @@ static int fts3MatchinfoLcs(Fts3Cursor *pCsr, MatchInfo *pInfo){
|
||||
int nLive = 0; /* Number of iterators in aIter not at EOF */
|
||||
|
||||
for(i=0; i<pInfo->nPhrase; i++){
|
||||
int rc;
|
||||
LcsIterator *pIt = &aIter[i];
|
||||
pIt->pRead = sqlite3Fts3EvalPhrasePoslist(pCsr, pIt->pExpr, iCol);
|
||||
rc = sqlite3Fts3EvalPhrasePoslist(pCsr, pIt->pExpr, iCol, &pIt->pRead);
|
||||
if( rc!=SQLITE_OK ) return rc;
|
||||
if( pIt->pRead ){
|
||||
pIt->iPos = pIt->iPosOffset;
|
||||
fts3LcsIteratorAdvance(&aIter[i]);
|
||||
@ -1298,9 +1304,10 @@ static int fts3ExprTermOffsetInit(Fts3Expr *pExpr, int iPhrase, void *ctx){
|
||||
int iTerm; /* For looping through nTerm phrase terms */
|
||||
char *pList; /* Pointer to position list for phrase */
|
||||
int iPos = 0; /* First position in position-list */
|
||||
int rc;
|
||||
|
||||
UNUSED_PARAMETER(iPhrase);
|
||||
pList = sqlite3Fts3EvalPhrasePoslist(p->pCsr, pExpr, p->iCol);
|
||||
rc = sqlite3Fts3EvalPhrasePoslist(p->pCsr, pExpr, p->iCol, &pList);
|
||||
nTerm = pExpr->pPhrase->nToken;
|
||||
if( pList ){
|
||||
fts3GetDeltaPosition(&pList, &iPos);
|
||||
@ -1314,7 +1321,7 @@ static int fts3ExprTermOffsetInit(Fts3Expr *pExpr, int iPhrase, void *ctx){
|
||||
pT->iPos = iPos;
|
||||
}
|
||||
|
||||
return SQLITE_OK;
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
|
49
manifest
49
manifest
@ -1,5 +1,5 @@
|
||||
C Merge\sthe\stable\sconstraint\sparser\sfixes\sfrom\strunk.
|
||||
D 2012-05-10T13:03:28.296
|
||||
C Merge\supdates\sfrom\strunk.
|
||||
D 2012-05-17T21:04:26.516
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in 2f37e468503dbe79d35c9f6dffcf3fae1ae9ec20
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
@ -55,16 +55,16 @@ F ext/fts3/README.content fdc666a70d5257a64fee209f97cf89e0e6e32b51
|
||||
F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a
|
||||
F ext/fts3/README.tokenizers 998756696647400de63d5ba60e9655036cb966e9
|
||||
F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d
|
||||
F ext/fts3/fts3.c 111626ce72b0df93f509ebd14ce31804fed24be0
|
||||
F ext/fts3/fts3.c a7adf6747d1fdd627ecd421c1709996741ca6693
|
||||
F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe
|
||||
F ext/fts3/fts3Int.h 5fd2ec4e47faf17bf4a508d6b8ec5fc0f2c80bff
|
||||
F ext/fts3/fts3Int.h aca752b99c15ee738f5bcf0910eafb9e4aeb1b97
|
||||
F ext/fts3/fts3_aux.c 5205182bd8f372782597888156404766edf5781e
|
||||
F ext/fts3/fts3_expr.c dbc7ba4c3a6061adde0f38ed8e9b349568299551
|
||||
F ext/fts3/fts3_hash.c 8dd2d06b66c72c628c2732555a32bc0943114914
|
||||
F ext/fts3/fts3_hash.h 8331fb2206c609f9fc4c4735b9ab5ad6137c88ec
|
||||
F ext/fts3/fts3_icu.c 62ec177c55f6a5c6e994dd3e5fd3194b4045c347
|
||||
F ext/fts3/fts3_porter.c a465b49fcb8249a755792f87516eff182efa42b3
|
||||
F ext/fts3/fts3_snippet.c 51a3a34c217e24678a133782c1dfb6f2f70fe559
|
||||
F ext/fts3/fts3_snippet.c bf67520ae9d2352a65368ed101729ff701c08808
|
||||
F ext/fts3/fts3_term.c a521f75132f9a495bdca1bdd45949b3191c52763
|
||||
F ext/fts3/fts3_test.c 348f7d08cae05285794e23dc4fe8b8fdf66e264a
|
||||
F ext/fts3/fts3_tokenizer.c 3da7254a9881f7e270ab28e2004e0d22b3212bce
|
||||
@ -121,7 +121,7 @@ F src/btmutex.c 976f45a12e37293e32cae0281b15a21d48a8aaa7
|
||||
F src/btree.c df800f10896bc2ddaa1125c532d6e7a7b9efc532
|
||||
F src/btree.h 48a013f8964f12d944d90e4700df47b72dd6d923
|
||||
F src/btreeInt.h 38a639c0542c29fe8331a221c4aed0cb8686249e
|
||||
F src/build.c 987c6933ea170e443dc6a79d52f8d2506206b12b
|
||||
F src/build.c 95fd8aa1bf81acf15e9ef46b07d1f70111ea88d0
|
||||
F src/callback.c 0cb4228cdcd827dcc5def98fb099edcc9142dbcd
|
||||
F src/complete.c dc1d136c0feee03c2f7550bafc0d29075e36deac
|
||||
F src/ctime.c 500d019da966631ad957c37705642be87524463b
|
||||
@ -160,22 +160,22 @@ F src/os.h 38aabd5e3ecd4162332076f55bb09cec02165cca
|
||||
F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
|
||||
F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440
|
||||
F src/os_unix.c 424d46e0edab969293c2223f09923b2178171f47
|
||||
F src/os_win.c ce348d158b43883c5b1495f68be3f654b7d0c503
|
||||
F src/os_win.c 37e1b92f0fa5edf1955bcd6b04d3e4d8be68ede2
|
||||
F src/pager.c bb5635dde0b152797836d1c72275284724bb563c
|
||||
F src/pager.h ef1eaf8593e78f73885c1dfac27ad83bee23bdc5
|
||||
F src/parse.y de06f412a4b3a2978071215f657fd1cd70700444
|
||||
F src/parse.y f29df90bd3adc64b33114ab1de9fb7768fcf2099
|
||||
F src/pcache.c f8043b433a57aba85384a531e3937a804432a346
|
||||
F src/pcache.h 1b5dcc3dc8103d03e625b177023ee67764fa6b7c
|
||||
F src/pcache1.c b30b1c35908346ecc43d8d9d17f2ddf6817f8f60
|
||||
F src/pragma.c 149d8400ff783741d41389176832241cbff8f856
|
||||
F src/prepare.c ec4989f7f480544bdc4192fe663470d2a2d7d61e
|
||||
F src/prepare.c 9a00a9612ebf80203fbb41f8a29ab8cb27a05f40
|
||||
F src/printf.c 7ffb4ebb8b341f67e049695ba031da717b3d2699
|
||||
F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50
|
||||
F src/resolve.c 748e75299faff345f34f0e5bd02a2bac8aa69fcd
|
||||
F src/rowset.c f6a49f3e9579428024662f6e2931832511f831a1
|
||||
F src/select.c d7b9018b7dd2e821183d69477ab55c39b8272335
|
||||
F src/shell.c 04399b2f9942bd02ed5ffee3b84bcdb39c52a1e6
|
||||
F src/sqlite.h.in 457e6fb1eef84fbd97864c086499b1de64a05aa5
|
||||
F src/sqlite.h.in 51b406bc156dcdfbb2af45ba11555256f23937be
|
||||
F src/sqlite3ext.h 6904f4aadf976f95241311fbffb00823075d9477
|
||||
F src/sqliteInt.h c5e917c4f1453f3972b1fd0c81105dfe4f09cc32
|
||||
F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
|
||||
@ -219,7 +219,7 @@ F src/test_rtree.c aba603c949766c4193f1068b91c787f57274e0d9
|
||||
F src/test_schema.c 8c06ef9ddb240c7a0fcd31bc221a6a2aade58bf0
|
||||
F src/test_server.c 2f99eb2837dfa06a4aacf24af24c6affdf66a84f
|
||||
F src/test_spellfix.c 495535f3eb57acdc384572da570e869bb1834bf4
|
||||
F src/test_stat.c d7035cfcc0ff1f93c000b621f36524318e004e11
|
||||
F src/test_stat.c d1569c7a4839f13e80187e2c26b2ab4da2d03935
|
||||
F src/test_superlock.c 2b97936ca127d13962c3605dbc9a4ef269c424cd
|
||||
F src/test_syscall.c a992d8c80ea91fbf21fb2dd570db40e77dd7e6ae
|
||||
F src/test_tclvar.c f4dc67d5f780707210d6bb0eb6016a431c04c7fa
|
||||
@ -247,7 +247,7 @@ F src/vtab.c ae657b1c22cff43863458e768a44f915c07bc0e4
|
||||
F src/wal.c 7bb3ad807afc7973406c805d5157ec7a2f65e146
|
||||
F src/wal.h 29c197540b19044e6cd73487017e5e47a1d3dac6
|
||||
F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f
|
||||
F src/where.c 8e9f01cd1604aa21cfa8e0258b7101e05082fa98
|
||||
F src/where.c 24c7494d8875ead994b4dfe5461340c27fd424ca
|
||||
F test/8_3_names.test 631ea964a3edb091cf73c3b540f6bcfdb36ce823
|
||||
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
||||
F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87
|
||||
@ -282,7 +282,7 @@ F test/autoindex1.test 058d0b331ae6840a61bbee910d8cbae27bfd5991
|
||||
F test/autovacuum.test fcaf4616ae5bb18098db1cb36262565e5c841c3c
|
||||
F test/autovacuum_ioerr2.test 8a367b224183ad801e0e24dcb7d1501f45f244b4
|
||||
F test/avtrans.test 0252654f4295ddda3b2cce0e894812259e655a85
|
||||
F test/backcompat.test 94778872ed9f6158ba1b8534264d3413ae7e27f8
|
||||
F test/backcompat.test bccbc64769d9c755ad65ee7c2f7336b86e3cc0c8
|
||||
F test/backup.test 717346db953e9e435c2a94916e4af177330d60d3
|
||||
F test/backup2.test 34986ef926ea522911a51dfdb2f8e99b7b75ebcf
|
||||
F test/backup_ioerr.test 40d208bc9224b666ee3ed423f49bc9062a36a9d0
|
||||
@ -460,7 +460,7 @@ F test/fts3am.test 218aa6ba0dfc50c7c16b2022aac5c6be593d08d8
|
||||
F test/fts3an.test a49ccadc07a2f7d646ec1b81bc09da2d85a85b18
|
||||
F test/fts3ao.test e7b80272efcced57d1d087a9da5c690dd7c21fd9
|
||||
F test/fts3atoken.test 402ef2f7c2fb4b3d4fa0587df6441c1447e799b3
|
||||
F test/fts3auto.test 868a2afea308d7d8b45ef29fcf022644a9e6d662
|
||||
F test/fts3auto.test b39f3f51227aea145eae6638690355dbdf9abf18
|
||||
F test/fts3aux1.test 0b02743955d56fc0d4d66236a26177bd1b726de0
|
||||
F test/fts3b.test e93bbb653e52afde110ad53bbd793f14fe7a8984
|
||||
F test/fts3c.test fc723a9cf10b397fdfc2b32e73c53c8b1ec02958
|
||||
@ -625,7 +625,7 @@ F test/notnull.test cc7c78340328e6112a13c3e311a9ab3127114347
|
||||
F test/null.test a8b09b8ed87852742343b33441a9240022108993
|
||||
F test/openv2.test 0d3040974bf402e19b7df4b783e447289d7ab394
|
||||
F test/oserror.test 50417780d0e0d7cd23cf12a8277bb44024765df3
|
||||
F test/pager1.test 819a0ecc0ecf4850155cf18dcd2754121d1018b3
|
||||
F test/pager1.test 2163c6ef119f497a71a84137c957c63763e640ab
|
||||
F test/pager2.test 745b911dde3d1f24ae0870bd433dfa83d7c658c1
|
||||
F test/pager3.test 3856d9c80839be0668efee1b74811b1b7f7fc95f
|
||||
F test/pagerfault.test 452f2cc23e3bfcfa935f4442aec1da4fe1dc0442
|
||||
@ -667,7 +667,7 @@ F test/schema.test 8f7999be894260f151adf15c2c7540f1c6d6a481
|
||||
F test/schema2.test 906408621ea881fdb496d878b1822572a34e32c5
|
||||
F test/schema3.test 1bc1008e1f8cb5654b248c55f27249366eb7ed38
|
||||
F test/schema4.test e6a66e20cc69f0e306667c08be7fda3d11707dc5
|
||||
F test/schema5.test b583e6e24adef3dce804bed040f24dd5fe789159
|
||||
F test/schema5.test 0103e4c0313b3725b5ae5600bdca53006ab53db3
|
||||
F test/securedel.test 87a2561151af1f1e349071a89fdd77059f50113c
|
||||
F test/select1.test deba017eed9daa5af33de868676c997e7eebb931
|
||||
F test/select2.test 352480e0e9c66eda9c3044e412abdf5be0215b56
|
||||
@ -690,7 +690,7 @@ F test/shared6.test 866bb4982c45ce216c61ded5e8fde4e7e2f3ffa9
|
||||
F test/shared7.test 960760bc8d03e1419e70dea69cf41db62853616e
|
||||
F test/shared_err.test 91e26ec4f3fbe07951967955585137e2f18993de
|
||||
F test/sharedlock.test ffa0a3c4ac192145b310f1254f8afca4d553eabf
|
||||
F test/shell1.test 7dcd612b0018ddad783647d984fffa76791ffd3d
|
||||
F test/shell1.test cd9f846702d1d471225a988fee590a153be8192c
|
||||
F test/shell2.test 037d6ad16e873354195d30bb2dc4b5321788154a
|
||||
F test/shell3.test 9196c42772d575685e722c92b4b39053c6ebba59
|
||||
F test/shell4.test aa4eef8118b412d1a01477a53426ece169ea86a9
|
||||
@ -726,7 +726,7 @@ F test/tclsqlite.test 1597d353308531527583481d14d9da52ea8ed0af
|
||||
F test/tempdb.test 19d0f66e2e3eeffd68661a11c83ba5e6ace9128c
|
||||
F test/temptable.test 51edd31c65ed1560dd600b1796e8325df96318e2
|
||||
F test/temptrigger.test 26670ed7a39cf2296a7f0a9e0a1d7bdb7abe936d
|
||||
F test/tester.tcl e1e5d5bc3453338ec7fded894614e059a5ce2c6a
|
||||
F test/tester.tcl 2665f64c9ce71944b4d41269114e658fb81bda05
|
||||
F test/thread001.test 7cc2ce08f9cde95964736d11e91f9ab610f82f91
|
||||
F test/thread002.test e630504f8a06c00bf8bbe68528774dd96aeb2e58
|
||||
F test/thread003.test ee4c9efc3b86a6a2767516a37bd64251272560a7
|
||||
@ -768,6 +768,7 @@ F test/tkt-b1d3a2e531.test 610ef582413171b379652663111b1f996d9f8f78
|
||||
F test/tkt-b351d95f9.test d14a503c414c5c58fdde3e80f9a3cfef986498c0
|
||||
F test/tkt-b72787b1.test a95e8cdad0b98af1853ac7f0afd4ab27b77bf5f3
|
||||
F test/tkt-bd484a090c.test 60460bf946f79a79712b71f202eda501ca99b898
|
||||
F test/tkt-bdc6bbbb38.test fc38bb09bdd440e3513a1f5f98fc60a075182d7d
|
||||
F test/tkt-c48d99d690.test bed446e3513ae10eec1b86fdd186ef750226c408
|
||||
F test/tkt-cbd054fa6b.test bd9fb546f63bc0c79d1776978d059fa51c5b1c63
|
||||
F test/tkt-d11f09d36e.test fb44f7961aa6d4b632fb7b9768239832210b5fc7
|
||||
@ -916,8 +917,8 @@ F test/vtabF.test fd5ad376f5a34fe0891df1f3cddb4fe7c3eb077e
|
||||
F test/vtab_alter.test 9e374885248f69e251bdaacf480b04a197f125e5
|
||||
F test/vtab_err.test 0d4d8eb4def1d053ac7c5050df3024fd47a3fbd8
|
||||
F test/vtab_shared.test 82f463886e18d7f8395a4b6167c91815efe54839
|
||||
F test/wal.test 99394a4c0310a1a44693512ce620f1b73dafd3ec
|
||||
F test/wal2.test 8871e7fd2c86711ff415a5817d68ea3101a15312
|
||||
F test/wal.test a040047d7f2b9f34bc4d597964e5e7c09609c635
|
||||
F test/wal2.test d5021064bebfc717fe2bf4db2536ea030b76a773
|
||||
F test/wal3.test 6504bbf348b2d6dfade64a064f1050fd617e8706
|
||||
F test/wal4.test 4744e155cd6299c6bd99d3eab1c82f77db9cdb3c
|
||||
F test/wal5.test f58ed4b8b542f71c7441da12fbd769d99b362437
|
||||
@ -996,7 +997,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06
|
||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||
F tool/warnings-clang.sh a8a0a3babda96dfb1ff51adda3cbbf3dfb7266c2
|
||||
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
|
||||
P 0d8b920b2c195f3735608e7a08f5d23724cdf806 38bf90af1ede6ee64ef7be66392e895e60c9126e
|
||||
R 81f25e7b03bf459323ea9dac500cee2e
|
||||
U drh
|
||||
Z ac42bf5c0e1cb57eb129f61107981da1
|
||||
P 12bb31dd6f0d8544406710d6f02f0b7c0fe6c537 736d6ea677f58e4aa2914fa79a3156b775c5a3f5
|
||||
R fe82a7de8d73461a6ba87765ea326828
|
||||
U mistachkin
|
||||
Z 229fa5a08bef71b3184983513b25255b
|
||||
|
@ -1 +1 @@
|
||||
12bb31dd6f0d8544406710d6f02f0b7c0fe6c537
|
||||
224c65e4a5c6ede076c364c93933cedd17f1e70b
|
16
src/build.c
16
src/build.c
@ -502,9 +502,16 @@ static void sqliteDeleteColumnNames(sqlite3 *db, Table *pTable){
|
||||
** the table data structure from the hash table. But it does destroy
|
||||
** memory structures of the indices and foreign keys associated with
|
||||
** the table.
|
||||
**
|
||||
** The db parameter is optional. It is needed if the Table object
|
||||
** contains lookaside memory. (Table objects in the schema do not use
|
||||
** lookaside memory, but some ephemeral Table objects do.) Or the
|
||||
** db parameter can be used with db->pnBytesFreed to measure the memory
|
||||
** used by the Table object.
|
||||
*/
|
||||
void sqlite3DeleteTable(sqlite3 *db, Table *pTable){
|
||||
Index *pIndex, *pNext;
|
||||
TESTONLY( int nLookaside; ) /* Used to verify lookaside not used for schema */
|
||||
|
||||
assert( !pTable || pTable->nRef>0 );
|
||||
|
||||
@ -512,6 +519,12 @@ void sqlite3DeleteTable(sqlite3 *db, Table *pTable){
|
||||
if( !pTable ) return;
|
||||
if( ((!db || db->pnBytesFreed==0) && (--pTable->nRef)>0) ) return;
|
||||
|
||||
/* Record the number of outstanding lookaside allocations in schema Tables
|
||||
** prior to doing any free() operations. Since schema Tables do not use
|
||||
** lookaside, this number should not change. */
|
||||
TESTONLY( nLookaside = (db && (pTable->tabFlags & TF_Ephemeral)==0) ?
|
||||
db->lookaside.nOut : 0 );
|
||||
|
||||
/* Delete all indices associated with this table. */
|
||||
for(pIndex = pTable->pIndex; pIndex; pIndex=pNext){
|
||||
pNext = pIndex->pNext;
|
||||
@ -543,6 +556,9 @@ void sqlite3DeleteTable(sqlite3 *db, Table *pTable){
|
||||
sqlite3VtabClear(db, pTable);
|
||||
#endif
|
||||
sqlite3DbFree(db, pTable);
|
||||
|
||||
/* Verify that no lookaside memory was used by schema tables */
|
||||
assert( nLookaside==0 || nLookaside==db->lookaside.nOut );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -684,7 +684,7 @@ static struct win_syscall {
|
||||
#define osWriteFile ((BOOL(WINAPI*)(HANDLE,LPCVOID,DWORD,LPDWORD, \
|
||||
LPOVERLAPPED))aSyscall[58].pCurrent)
|
||||
|
||||
#if !SQLITE_OS_WINCE
|
||||
#if SQLITE_OS_WINRT
|
||||
{ "CreateEventExW", (SYSCALL)CreateEventExW, 0 },
|
||||
#else
|
||||
{ "CreateEventExW", (SYSCALL)0, 0 },
|
||||
@ -720,7 +720,7 @@ static struct win_syscall {
|
||||
#define osSetFilePointerEx ((BOOL(WINAPI*)(HANDLE,LARGE_INTEGER, \
|
||||
PLARGE_INTEGER,DWORD))aSyscall[62].pCurrent)
|
||||
|
||||
#if !SQLITE_OS_WINCE
|
||||
#if SQLITE_OS_WINRT
|
||||
{ "GetFileInformationByHandleEx", (SYSCALL)GetFileInformationByHandleEx, 0 },
|
||||
#else
|
||||
{ "GetFileInformationByHandleEx", (SYSCALL)0, 0 },
|
||||
|
12
src/parse.y
12
src/parse.y
@ -340,12 +340,12 @@ init_deferred_pred_opt(A) ::= INITIALLY DEFERRED. {A = 1;}
|
||||
init_deferred_pred_opt(A) ::= INITIALLY IMMEDIATE. {A = 0;}
|
||||
|
||||
conslist_opt(A) ::= . {A.n = 0; A.z = 0;}
|
||||
conslist_opt(A) ::= COMMA(X) conslist cname. {A = X;}
|
||||
conslist ::= conslist COMMA cname tcons.
|
||||
conslist ::= conslist cname tcons.
|
||||
conslist ::= cname tcons.
|
||||
cname ::= . {pParse->constraintName.n = 0;}
|
||||
cname ::= CONSTRAINT nm(X). {pParse->constraintName = X;}
|
||||
conslist_opt(A) ::= COMMA(X) conslist. {A = X;}
|
||||
conslist ::= conslist tconscomma tcons.
|
||||
conslist ::= tcons.
|
||||
tconscomma ::= COMMA. {pParse->constraintName.n = 0;}
|
||||
tconscomma ::= .
|
||||
tcons ::= CONSTRAINT nm(X). {pParse->constraintName = X;}
|
||||
tcons ::= PRIMARY KEY LP idxlist(X) autoinc(I) RP onconf(R).
|
||||
{sqlite3AddPrimaryKey(pParse,X,R,I,0);}
|
||||
tcons ::= UNIQUE LP idxlist(X) RP onconf(R).
|
||||
|
@ -706,6 +706,7 @@ static int sqlite3LockAndPrepare(
|
||||
}
|
||||
sqlite3BtreeLeaveAll(db);
|
||||
sqlite3_mutex_leave(db->mutex);
|
||||
assert( rc==SQLITE_OK || *ppStmt==0 );
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -767,7 +767,7 @@ struct sqlite3_io_methods {
|
||||
**
|
||||
** <li>[[SQLITE_FCNTL_PERSIST_WAL]]
|
||||
** ^The [SQLITE_FCNTL_PERSIST_WAL] opcode is used to set or query the
|
||||
** persistent [WAL | Write AHead Log] setting. By default, the auxiliary
|
||||
** persistent [WAL | Write Ahead Log] setting. By default, the auxiliary
|
||||
** write ahead log and shared memory files used for transaction control
|
||||
** are automatically deleted when the latest connection to the database
|
||||
** closes. Setting persistent WAL mode causes those files to persist after
|
||||
@ -6046,7 +6046,7 @@ int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);
|
||||
** database file in rollback mode databases. Any pages written as part of
|
||||
** transaction rollback or database recovery operations are not included.
|
||||
** If an IO or other error occurs while writing a page to disk, the effect
|
||||
** on subsequent SQLITE_DBSTATUS_CACHE_WRITE requests is undefined). ^The
|
||||
** on subsequent SQLITE_DBSTATUS_CACHE_WRITE requests is undefined.)^ ^The
|
||||
** highwater mark associated with SQLITE_DBSTATUS_CACHE_WRITE is always 0.
|
||||
** </dd>
|
||||
** </dl>
|
||||
|
@ -328,7 +328,7 @@ static int statDecodePage(Btree *pBt, StatPage *p){
|
||||
getLocalPayload(nUsable, p->flags, nPayload, &nLocal);
|
||||
pCell->nLocal = nLocal;
|
||||
assert( nLocal>=0 );
|
||||
assert( nPayload>=nLocal );
|
||||
assert( nPayload>=(u32)nLocal );
|
||||
assert( nLocal<=(nUsable-35) );
|
||||
if( nPayload>(u32)nLocal ){
|
||||
int j;
|
||||
|
@ -1725,7 +1725,6 @@ static int isSortingIndex(
|
||||
&& !referencesOtherTables(pOrderBy, pMaskSet, j, base)
|
||||
){
|
||||
Column *aCol = pIdx->pTable->aCol;
|
||||
int i;
|
||||
|
||||
/* All terms of this index match some prefix of the ORDER BY clause,
|
||||
** the index is UNIQUE, and no terms on the tail of the ORDER BY
|
||||
|
@ -251,96 +251,98 @@ do_allbackcompat_test {
|
||||
# Test that FTS3 tables may be read/written by different versions of
|
||||
# SQLite.
|
||||
#
|
||||
set contents {
|
||||
CREATE VIRTUAL TABLE t1 USING fts3(a, b);
|
||||
}
|
||||
foreach {num doc} {
|
||||
one "jk zm jk eczkjblu urvysbnykk sk gnl jk ttvgf hmjf"
|
||||
two "jk bnhc jjrxpjkb mjpavjuhw fibokdry igju jk zm zm xh"
|
||||
three "wxe ogttbykvt uhzq xr iaf zf urvysbnykk aayxpmve oacaxgjoo mjpavjuhw"
|
||||
four "gazrt jk ephknonq myjp uenvbm wuvajhwqz jk zm xnxhf nvfasfh"
|
||||
five "zm aayxpmve csjqxhgj xnxhf xr jk aayxpmve xnxhf zm zm"
|
||||
six "sokcyf zm ogyavjvv jk zm fibokdry zm jk igju igju"
|
||||
seven "vgsld bvgimjik xuprtlyle jk akmikrqyt jk aayxpmve hkfoudzftq ddjj"
|
||||
eight "zm uhzq ovkyevlgv zk uenvbm csjqxhgj jk vgsld pgybs jk"
|
||||
nine "zm agmckuiu zexh fibokdry jk uhzq bu tugflixoex xnxhf sk"
|
||||
} {
|
||||
append contents "INSERT INTO t1 VALUES('$num', '$doc');"
|
||||
}
|
||||
do_allbackcompat_test {
|
||||
if {[code1 {set ::sqlite_options(fts3)}]
|
||||
&& [code2 {set ::sqlite_options(fts3)}]
|
||||
ifcapable fts3 {
|
||||
set contents {
|
||||
CREATE VIRTUAL TABLE t1 USING fts3(a, b);
|
||||
}
|
||||
foreach {num doc} {
|
||||
one "jk zm jk eczkjblu urvysbnykk sk gnl jk ttvgf hmjf"
|
||||
two "jk bnhc jjrxpjkb mjpavjuhw fibokdry igju jk zm zm xh"
|
||||
three "wxe ogttbykvt uhzq xr iaf zf urvysbnykk aayxpmve oacaxgjoo mjpavjuhw"
|
||||
four "gazrt jk ephknonq myjp uenvbm wuvajhwqz jk zm xnxhf nvfasfh"
|
||||
five "zm aayxpmve csjqxhgj xnxhf xr jk aayxpmve xnxhf zm zm"
|
||||
six "sokcyf zm ogyavjvv jk zm fibokdry zm jk igju igju"
|
||||
seven "vgsld bvgimjik xuprtlyle jk akmikrqyt jk aayxpmve hkfoudzftq ddjj"
|
||||
eight "zm uhzq ovkyevlgv zk uenvbm csjqxhgj jk vgsld pgybs jk"
|
||||
nine "zm agmckuiu zexh fibokdry jk uhzq bu tugflixoex xnxhf sk"
|
||||
} {
|
||||
|
||||
do_test backcompat-3.1 { sql1 $contents } {}
|
||||
|
||||
foreach {n q} {
|
||||
1 "SELECT * FROM t1 ORDER BY a, b"
|
||||
2 "SELECT rowid FROM t1 WHERE a MATCH 'five'"
|
||||
3 "SELECT * FROM t1 WHERE a MATCH 'five'"
|
||||
4 "SELECT offsets(t1) FROM t1 WHERE t1 MATCH 'jk'"
|
||||
5 "SELECT offsets(t1) FROM t1 WHERE t1 MATCH 'tug* OR eight'"
|
||||
append contents "INSERT INTO t1 VALUES('$num', '$doc');"
|
||||
}
|
||||
do_allbackcompat_test {
|
||||
if {[code1 {set ::sqlite_options(fts3)}]
|
||||
&& [code2 {set ::sqlite_options(fts3)}]
|
||||
} {
|
||||
do_test backcompat-3.2 [list sql1 $q] [sql2 $q]
|
||||
}
|
||||
|
||||
do_test backcompat-3.3 { sql1 {
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
} } {}
|
||||
|
||||
foreach {n q} {
|
||||
1 "SELECT * FROM t1 ORDER BY a, b"
|
||||
2 "SELECT rowid FROM t1 WHERE a MATCH 'five'"
|
||||
3 "SELECT * FROM t1 WHERE a MATCH 'five'"
|
||||
4 "SELECT offsets(t1) FROM t1 WHERE t1 MATCH 'jk'"
|
||||
5 "SELECT offsets(t1) FROM t1 WHERE t1 MATCH 'tug* OR eight'"
|
||||
} {
|
||||
do_test backcompat-3.4 [list sql1 $q] [sql2 $q]
|
||||
}
|
||||
|
||||
set alphabet "a b c d e f g h i j k l m n o p q r s t u v w x y z 1 2 3 4"
|
||||
for {set i 0} {$i < 900} {incr i} {
|
||||
set term "[lindex $alphabet [expr $i/30]][lindex $alphabet [expr $i%30]] "
|
||||
sql1 "INSERT INTO t1 VALUES($i, '[string repeat $term 14]')"
|
||||
}
|
||||
|
||||
foreach {n q} {
|
||||
1 "SELECT * FROM t1 ORDER BY a, b"
|
||||
2 "SELECT rowid FROM t1 WHERE a MATCH 'five'"
|
||||
3 "SELECT * FROM t1 WHERE a MATCH 'five'"
|
||||
4 "SELECT offsets(t1) FROM t1 WHERE t1 MATCH 'jk'"
|
||||
5 "SELECT offsets(t1) FROM t1 WHERE t1 MATCH 'tug* OR eight'"
|
||||
|
||||
6 "SELECT offsets(t1) FROM t1 WHERE t1 MATCH 'aa'"
|
||||
7 "SELECT offsets(t1) FROM t1 WHERE t1 MATCH '44'"
|
||||
8 "SELECT offsets(t1) FROM t1 WHERE t1 MATCH 'a*'"
|
||||
} {
|
||||
do_test backcompat-3.5 [list sql1 $q] [sql2 $q]
|
||||
}
|
||||
|
||||
do_test backcompat-3.6 {
|
||||
sql1 "SELECT optimize(t1) FROM t1 LIMIT 1"
|
||||
} {{Index optimized}}
|
||||
|
||||
foreach {n q} {
|
||||
1 "SELECT * FROM t1 ORDER BY a, b"
|
||||
2 "SELECT rowid FROM t1 WHERE a MATCH 'five'"
|
||||
3 "SELECT * FROM t1 WHERE a MATCH 'five'"
|
||||
4 "SELECT offsets(t1) FROM t1 WHERE t1 MATCH 'jk'"
|
||||
5 "SELECT offsets(t1) FROM t1 WHERE t1 MATCH 'tug* OR eight'"
|
||||
|
||||
6 "SELECT offsets(t1) FROM t1 WHERE t1 MATCH 'aa'"
|
||||
7 "SELECT offsets(t1) FROM t1 WHERE t1 MATCH '44'"
|
||||
8 "SELECT offsets(t1) FROM t1 WHERE t1 MATCH 'a*'"
|
||||
} {
|
||||
do_test backcompat-3.7 [list sql1 $q] [sql2 $q]
|
||||
|
||||
do_test backcompat-3.1 { sql1 $contents } {}
|
||||
|
||||
foreach {n q} {
|
||||
1 "SELECT * FROM t1 ORDER BY a, b"
|
||||
2 "SELECT rowid FROM t1 WHERE a MATCH 'five'"
|
||||
3 "SELECT * FROM t1 WHERE a MATCH 'five'"
|
||||
4 "SELECT offsets(t1) FROM t1 WHERE t1 MATCH 'jk'"
|
||||
5 "SELECT offsets(t1) FROM t1 WHERE t1 MATCH 'tug* OR eight'"
|
||||
} {
|
||||
do_test backcompat-3.2 [list sql1 $q] [sql2 $q]
|
||||
}
|
||||
|
||||
do_test backcompat-3.3 { sql1 {
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
} } {}
|
||||
|
||||
foreach {n q} {
|
||||
1 "SELECT * FROM t1 ORDER BY a, b"
|
||||
2 "SELECT rowid FROM t1 WHERE a MATCH 'five'"
|
||||
3 "SELECT * FROM t1 WHERE a MATCH 'five'"
|
||||
4 "SELECT offsets(t1) FROM t1 WHERE t1 MATCH 'jk'"
|
||||
5 "SELECT offsets(t1) FROM t1 WHERE t1 MATCH 'tug* OR eight'"
|
||||
} {
|
||||
do_test backcompat-3.4 [list sql1 $q] [sql2 $q]
|
||||
}
|
||||
|
||||
set alphabet "a b c d e f g h i j k l m n o p q r s t u v w x y z 1 2 3 4"
|
||||
for {set i 0} {$i < 900} {incr i} {
|
||||
set term "[lindex $alphabet [expr $i/30]][lindex $alphabet [expr $i%30]] "
|
||||
sql1 "INSERT INTO t1 VALUES($i, '[string repeat $term 14]')"
|
||||
}
|
||||
|
||||
foreach {n q} {
|
||||
1 "SELECT * FROM t1 ORDER BY a, b"
|
||||
2 "SELECT rowid FROM t1 WHERE a MATCH 'five'"
|
||||
3 "SELECT * FROM t1 WHERE a MATCH 'five'"
|
||||
4 "SELECT offsets(t1) FROM t1 WHERE t1 MATCH 'jk'"
|
||||
5 "SELECT offsets(t1) FROM t1 WHERE t1 MATCH 'tug* OR eight'"
|
||||
|
||||
6 "SELECT offsets(t1) FROM t1 WHERE t1 MATCH 'aa'"
|
||||
7 "SELECT offsets(t1) FROM t1 WHERE t1 MATCH '44'"
|
||||
8 "SELECT offsets(t1) FROM t1 WHERE t1 MATCH 'a*'"
|
||||
} {
|
||||
do_test backcompat-3.5 [list sql1 $q] [sql2 $q]
|
||||
}
|
||||
|
||||
do_test backcompat-3.6 {
|
||||
sql1 "SELECT optimize(t1) FROM t1 LIMIT 1"
|
||||
} {{Index optimized}}
|
||||
|
||||
foreach {n q} {
|
||||
1 "SELECT * FROM t1 ORDER BY a, b"
|
||||
2 "SELECT rowid FROM t1 WHERE a MATCH 'five'"
|
||||
3 "SELECT * FROM t1 WHERE a MATCH 'five'"
|
||||
4 "SELECT offsets(t1) FROM t1 WHERE t1 MATCH 'jk'"
|
||||
5 "SELECT offsets(t1) FROM t1 WHERE t1 MATCH 'tug* OR eight'"
|
||||
|
||||
6 "SELECT offsets(t1) FROM t1 WHERE t1 MATCH 'aa'"
|
||||
7 "SELECT offsets(t1) FROM t1 WHERE t1 MATCH '44'"
|
||||
8 "SELECT offsets(t1) FROM t1 WHERE t1 MATCH 'a*'"
|
||||
} {
|
||||
do_test backcompat-3.7 [list sql1 $q] [sql2 $q]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -349,72 +351,74 @@ do_allbackcompat_test {
|
||||
# Test that Rtree tables may be read/written by different versions of
|
||||
# SQLite.
|
||||
#
|
||||
set contents {
|
||||
CREATE VIRTUAL TABLE t1 USING rtree(id, x1, x2, y1, y2);
|
||||
}
|
||||
foreach {id x1 x2 y1 y2} {
|
||||
1 -47.64 43.87 33.86 34.42 2 -21.51 17.32 2.05 31.04
|
||||
3 -43.67 -38.33 -19.79 3.43 4 32.41 35.16 9.12 19.82
|
||||
5 33.28 34.87 14.78 28.26 6 49.31 116.59 -9.87 75.09
|
||||
7 -14.93 34.51 -17.64 64.09 8 -43.05 23.43 -1.19 69.44
|
||||
9 44.79 133.56 28.09 80.30 10 -2.66 81.47 -41.38 -10.46
|
||||
11 -42.89 -3.54 15.76 71.63 12 -3.50 84.96 -11.64 64.95
|
||||
13 -45.69 26.25 11.14 55.06 14 -44.09 11.23 17.52 44.45
|
||||
15 36.23 133.49 -19.38 53.67 16 -17.89 81.54 14.64 50.61
|
||||
17 -41.97 -24.04 -39.43 28.95 18 -5.85 7.76 -6.38 47.02
|
||||
19 18.82 27.10 42.82 100.09 20 39.17 113.45 26.14 73.47
|
||||
21 22.31 103.17 49.92 106.05 22 -43.06 40.38 -1.75 76.08
|
||||
23 2.43 57.27 -14.19 -3.83 24 -47.57 -4.35 8.93 100.06
|
||||
25 -37.47 49.14 -29.11 8.81 26 -7.86 75.72 49.34 107.42
|
||||
27 1.53 45.49 20.36 49.74 28 -48.48 32.54 28.81 54.45
|
||||
29 2.67 39.77 -4.05 13.67 30 4.11 62.88 -47.44 -5.72
|
||||
31 -21.47 51.75 37.25 116.09 32 45.59 111.37 -6.43 43.64
|
||||
33 35.23 48.29 23.54 113.33 34 16.61 68.35 -14.69 65.97
|
||||
35 13.98 16.60 48.66 102.87 36 19.74 23.84 31.15 77.27
|
||||
37 -27.61 24.43 7.96 94.91 38 -34.77 12.05 -22.60 -6.29
|
||||
39 -25.83 8.71 -13.48 -12.53 40 -17.11 -1.01 18.06 67.89
|
||||
41 14.13 71.72 -3.78 39.25 42 23.75 76.00 -16.30 8.23
|
||||
43 -39.15 28.63 38.12 125.88 44 48.62 86.09 36.49 102.95
|
||||
45 -31.39 -21.98 2.52 89.78 46 5.65 56.04 15.94 89.10
|
||||
47 18.28 95.81 46.46 143.08 48 30.93 102.82 -20.08 37.36
|
||||
49 -20.78 -3.48 -5.58 35.46 50 49.85 90.58 -24.48 46.29
|
||||
} {
|
||||
if {$x1 >= $x2 || $y1 >= $y2} { error "$x1 $x2 $y1 $y2" }
|
||||
append contents "INSERT INTO t1 VALUES($id, $x1, $x2, $y1, $y2);"
|
||||
}
|
||||
set queries {
|
||||
1 "SELECT id FROM t1 WHERE x1>10 AND x2<44"
|
||||
2 "SELECT id FROM t1 WHERE y1<100"
|
||||
3 "SELECT id FROM t1 WHERE y1<100 AND x1>0"
|
||||
4 "SELECT id FROM t1 WHERE y1>10 AND x1>0 AND x2<50 AND y2<550"
|
||||
}
|
||||
do_allbackcompat_test {
|
||||
if {[code1 {set ::sqlite_options(fts3)}]
|
||||
&& [code2 {set ::sqlite_options(fts3)}]
|
||||
ifcapable rtree {
|
||||
set contents {
|
||||
CREATE VIRTUAL TABLE t1 USING rtree(id, x1, x2, y1, y2);
|
||||
}
|
||||
foreach {id x1 x2 y1 y2} {
|
||||
1 -47.64 43.87 33.86 34.42 2 -21.51 17.32 2.05 31.04
|
||||
3 -43.67 -38.33 -19.79 3.43 4 32.41 35.16 9.12 19.82
|
||||
5 33.28 34.87 14.78 28.26 6 49.31 116.59 -9.87 75.09
|
||||
7 -14.93 34.51 -17.64 64.09 8 -43.05 23.43 -1.19 69.44
|
||||
9 44.79 133.56 28.09 80.30 10 -2.66 81.47 -41.38 -10.46
|
||||
11 -42.89 -3.54 15.76 71.63 12 -3.50 84.96 -11.64 64.95
|
||||
13 -45.69 26.25 11.14 55.06 14 -44.09 11.23 17.52 44.45
|
||||
15 36.23 133.49 -19.38 53.67 16 -17.89 81.54 14.64 50.61
|
||||
17 -41.97 -24.04 -39.43 28.95 18 -5.85 7.76 -6.38 47.02
|
||||
19 18.82 27.10 42.82 100.09 20 39.17 113.45 26.14 73.47
|
||||
21 22.31 103.17 49.92 106.05 22 -43.06 40.38 -1.75 76.08
|
||||
23 2.43 57.27 -14.19 -3.83 24 -47.57 -4.35 8.93 100.06
|
||||
25 -37.47 49.14 -29.11 8.81 26 -7.86 75.72 49.34 107.42
|
||||
27 1.53 45.49 20.36 49.74 28 -48.48 32.54 28.81 54.45
|
||||
29 2.67 39.77 -4.05 13.67 30 4.11 62.88 -47.44 -5.72
|
||||
31 -21.47 51.75 37.25 116.09 32 45.59 111.37 -6.43 43.64
|
||||
33 35.23 48.29 23.54 113.33 34 16.61 68.35 -14.69 65.97
|
||||
35 13.98 16.60 48.66 102.87 36 19.74 23.84 31.15 77.27
|
||||
37 -27.61 24.43 7.96 94.91 38 -34.77 12.05 -22.60 -6.29
|
||||
39 -25.83 8.71 -13.48 -12.53 40 -17.11 -1.01 18.06 67.89
|
||||
41 14.13 71.72 -3.78 39.25 42 23.75 76.00 -16.30 8.23
|
||||
43 -39.15 28.63 38.12 125.88 44 48.62 86.09 36.49 102.95
|
||||
45 -31.39 -21.98 2.52 89.78 46 5.65 56.04 15.94 89.10
|
||||
47 18.28 95.81 46.46 143.08 48 30.93 102.82 -20.08 37.36
|
||||
49 -20.78 -3.48 -5.58 35.46 50 49.85 90.58 -24.48 46.29
|
||||
} {
|
||||
|
||||
do_test backcompat-4.1 { sql1 $contents } {}
|
||||
|
||||
foreach {n q} $::queries {
|
||||
do_test backcompat-4.2.$n [list sql1 $q] [sql2 $q]
|
||||
if {$x1 >= $x2 || $y1 >= $y2} { error "$x1 $x2 $y1 $y2" }
|
||||
append contents "INSERT INTO t1 VALUES($id, $x1, $x2, $y1, $y2);"
|
||||
}
|
||||
set queries {
|
||||
1 "SELECT id FROM t1 WHERE x1>10 AND x2<44"
|
||||
2 "SELECT id FROM t1 WHERE y1<100"
|
||||
3 "SELECT id FROM t1 WHERE y1<100 AND x1>0"
|
||||
4 "SELECT id FROM t1 WHERE y1>10 AND x1>0 AND x2<50 AND y2<550"
|
||||
}
|
||||
do_allbackcompat_test {
|
||||
if {[code1 {set ::sqlite_options(fts3)}]
|
||||
&& [code2 {set ::sqlite_options(fts3)}]
|
||||
} {
|
||||
|
||||
do_test backcompat-4.1 { sql1 $contents } {}
|
||||
|
||||
foreach {n q} $::queries {
|
||||
do_test backcompat-4.2.$n [list sql1 $q] [sql2 $q]
|
||||
}
|
||||
|
||||
do_test backcompat-4.3 { sql1 {
|
||||
INSERT INTO t1 SELECT id+100, x1+10.0, x2+10.0, y1-10.0, y2-10.0 FROM t1;
|
||||
} } {}
|
||||
|
||||
foreach {n q} $::queries {
|
||||
do_test backcompat-4.4.$n [list sql1 $q] [sql2 $q]
|
||||
}
|
||||
|
||||
do_test backcompat-4.5 { sql2 {
|
||||
INSERT INTO t1 SELECT id+200, x1+20.0, x2+20.0, y1-20.0, y2-20.0 FROM t1;
|
||||
} } {}
|
||||
|
||||
foreach {n q} $::queries {
|
||||
do_test backcompat-4.6.$n [list sql1 $q] [sql2 $q]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
do_test backcompat-4.3 { sql1 {
|
||||
INSERT INTO t1 SELECT id+100, x1+10.0, x2+10.0, y1-10.0, y2-10.0 FROM t1;
|
||||
} } {}
|
||||
|
||||
foreach {n q} $::queries {
|
||||
do_test backcompat-4.4.$n [list sql1 $q] [sql2 $q]
|
||||
}
|
||||
|
||||
do_test backcompat-4.5 { sql2 {
|
||||
INSERT INTO t1 SELECT id+200, x1+20.0, x2+20.0, y1-20.0, y2-20.0 FROM t1;
|
||||
} } {}
|
||||
|
||||
foreach {n q} $::queries {
|
||||
do_test backcompat-4.6.$n [list sql1 $q] [sql2 $q]
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,26 +75,27 @@ proc do_fts3query_test {tn args} {
|
||||
}
|
||||
}
|
||||
|
||||
get_near_results $tbl $match $deferred aMatchinfo
|
||||
get_near_results $tbl $match $deferred aHit
|
||||
get_near_results $tbl [string map {AND OR} $match] $deferred aMatchinfo
|
||||
|
||||
set matchinfo_asc [list]
|
||||
foreach docid [lsort -integer -incr [array names aMatchinfo]] {
|
||||
foreach docid [lsort -integer -incr [array names aHit]] {
|
||||
lappend matchinfo_asc $docid $aMatchinfo($docid)
|
||||
}
|
||||
set matchinfo_desc [list]
|
||||
foreach docid [lsort -integer -decr [array names aMatchinfo]] {
|
||||
foreach docid [lsort -integer -decr [array names aHit]] {
|
||||
lappend matchinfo_desc $docid $aMatchinfo($docid)
|
||||
}
|
||||
|
||||
set title "(\"$match\" -> [llength [array names aMatchinfo]] rows)"
|
||||
set title "(\"$match\" -> [llength [array names aHit]] rows)"
|
||||
|
||||
do_execsql_test $tn$title.1 "
|
||||
SELECT docid FROM $tbl WHERE $tbl MATCH '$match' ORDER BY docid ASC
|
||||
" [lsort -integer -incr [array names aMatchinfo]]
|
||||
" [lsort -integer -incr [array names aHit]]
|
||||
|
||||
do_execsql_test $tn$title.2 "
|
||||
SELECT docid FROM $tbl WHERE $tbl MATCH '$match' ORDER BY docid DESC
|
||||
" [lsort -integer -decr [array names aMatchinfo]]
|
||||
" [lsort -integer -decr [array names aHit]]
|
||||
|
||||
do_execsql_test $tn$title.3 "
|
||||
SELECT docid, mit(matchinfo($tbl, 'x')) FROM $tbl
|
||||
@ -650,6 +651,7 @@ foreach {tn pending create} {
|
||||
do_fts3query_test 6.$tn.2 t1 {b:G AND c:I}
|
||||
do_fts3query_test 6.$tn.3 t1 {b:G NEAR c:I}
|
||||
do_fts3query_test 6.$tn.4 t1 {a:C OR b:G OR c:K OR d:C}
|
||||
|
||||
do_fts3query_test 6.$tn.5 t1 {a:G OR b:G}
|
||||
|
||||
catchsql { COMMIT }
|
||||
|
@ -462,7 +462,7 @@ do_test pager1.4.2.3 {
|
||||
} {64 ok}
|
||||
do_test pager1.4.2.4 {
|
||||
faultsim_restore_and_reopen
|
||||
hexio_write test.db-journal [expr [file size test.db-journal]-20] 123456
|
||||
hexio_write test.db-journal [expr [file size test.db-journal]-30] 123456
|
||||
execsql {
|
||||
SELECT count(*) FROM t1;
|
||||
PRAGMA integrity_check;
|
||||
@ -470,7 +470,7 @@ do_test pager1.4.2.4 {
|
||||
} {4 ok}
|
||||
do_test pager1.4.2.5 {
|
||||
faultsim_restore_and_reopen
|
||||
hexio_write test.db-journal [expr [file size test.db-journal]-20] 123456
|
||||
hexio_write test.db-journal [expr [file size test.db-journal]-30] 123456
|
||||
foreach f [glob test.db-mj*] { forcedelete $f }
|
||||
execsql {
|
||||
SELECT count(*) FROM t1;
|
||||
|
@ -45,6 +45,23 @@ do_test schema5-1.3 {
|
||||
do_test schema5-1.4 {
|
||||
catchsql {INSERT INTO t1 VALUES(10,11,12);}
|
||||
} {1 {constraint two failed}}
|
||||
do_test schema5-1.5 {
|
||||
db eval {
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(a,b,c,
|
||||
UNIQUE(a) CONSTRAINT one,
|
||||
PRIMARY KEY(b,c) CONSTRAINT two
|
||||
);
|
||||
INSERT INTO t1 VALUES(1,2,3);
|
||||
}
|
||||
} {}
|
||||
do_test schema5-1.6 {
|
||||
catchsql {INSERT INTO t1 VALUES(1,3,4)}
|
||||
} {1 {column a is not unique}}
|
||||
do_test schema5-1.7 {
|
||||
catchsql {INSERT INTO t1 VALUES(10,2,3)}
|
||||
} {1 {columns b, c are not unique}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -283,9 +283,8 @@ do_test shell1-3.2.4 {
|
||||
|
||||
# .databases List names and files of attached databases
|
||||
do_test shell1-3.3.1 {
|
||||
set res [catchcmd "test.db" ".databases"]
|
||||
regexp {0.*main.*test\.db} $res
|
||||
} {1}
|
||||
catchcmd "-csv test.db" ".databases"
|
||||
} {/0 +.*main +.*test.db.*/}
|
||||
do_test shell1-3.3.2 {
|
||||
# too many arguments
|
||||
catchcmd "test.db" ".databases BAD"
|
||||
|
@ -1644,5 +1644,8 @@ proc db_delete_and_reopen {{file test.db}} {
|
||||
# to non-zero, then set the global variable $AUTOVACUUM to 1.
|
||||
set AUTOVACUUM $sqlite_options(default_autovacuum)
|
||||
|
||||
# Make sure the FTS enhanced query syntax is disabled.
|
||||
set sqlite_fts3_enable_parentheses 0
|
||||
|
||||
source $testdir/thread_common.tcl
|
||||
source $testdir/malloc_common.tcl
|
||||
|
90
test/tkt-bdc6bbbb38.test
Normal file
90
test/tkt-bdc6bbbb38.test
Normal file
@ -0,0 +1,90 @@
|
||||
# 2012 May 11
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library.
|
||||
#
|
||||
# This file implements tests to verify that ticket [bdc6bbbb38] has been
|
||||
# fixed.
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
set testprefix tkt-bdc6bbbb38
|
||||
|
||||
# If SQLITE_ENABLE_FTS3 is defined, omit this file.
|
||||
ifcapable !fts3 { finish_test ; return }
|
||||
set sqlite_fts3_enable_parentheses 1
|
||||
|
||||
foreach {tn idxdir} {1 ASC 2 DESC} {
|
||||
execsql { DROP TABLE IF EXISTS t2 }
|
||||
|
||||
do_execsql_test $tn.1.1 "CREATE VIRTUAL TABLE t2 USING fts4(x, order=$idxdir)"
|
||||
do_execsql_test $tn.1.2 { INSERT INTO t2 VALUES('a b c') }
|
||||
|
||||
do_execsql_test $tn.1.3 {
|
||||
SELECT offsets(t2) FROM t2 WHERE t2 MATCH 'a AND d OR b' ORDER BY docid ASC
|
||||
} {
|
||||
{0 0 0 1 0 2 2 1}
|
||||
}
|
||||
do_execsql_test $tn.1.4 {
|
||||
SELECT snippet(t2,'[',']') FROM t2 WHERE t2 MATCH 'a AND d OR b'
|
||||
ORDER BY docid ASC
|
||||
} {
|
||||
{[a] [b] c}
|
||||
}
|
||||
do_execsql_test $tn.1.5 { INSERT INTO t2 VALUES('a c d') }
|
||||
do_execsql_test $tn.1.6 {
|
||||
SELECT offsets(t2) FROM t2 WHERE t2 MATCH 'a AND d OR b' ORDER BY docid ASC
|
||||
} {
|
||||
{0 0 0 1 0 2 2 1}
|
||||
{0 0 0 1 0 1 4 1}
|
||||
}
|
||||
do_execsql_test $tn.1.7 {
|
||||
SELECT snippet(t2,'[',']') FROM t2 WHERE t2 MATCH 'a AND d OR b'
|
||||
ORDER BY docid ASC
|
||||
} {
|
||||
{[a] [b] c}
|
||||
{[a] c [d]}
|
||||
}
|
||||
|
||||
execsql { DROP TABLE IF EXISTS t3 }
|
||||
do_execsql_test $tn.2.1 "CREATE VIRTUAL TABLE t3 USING fts4(x, order=$idxdir)"
|
||||
do_execsql_test $tn.2.2 { INSERT INTO t3 VALUES('a c d') }
|
||||
do_execsql_test $tn.2.3 {
|
||||
SELECT offsets(t3) FROM t3 WHERE t3 MATCH 'a AND d OR b' ORDER BY docid DESC
|
||||
} {
|
||||
{0 0 0 1 0 1 4 1}
|
||||
}
|
||||
do_execsql_test $tn.2.4 {
|
||||
SELECT snippet(t3,'[',']') FROM t3 WHERE t3 MATCH 'a AND d OR b'
|
||||
ORDER BY docid DESC
|
||||
} {
|
||||
{[a] c [d]}
|
||||
}
|
||||
do_execsql_test $tn.2.5 {
|
||||
INSERT INTO t3 VALUES('a b c');
|
||||
}
|
||||
do_execsql_test $tn.2.6 {
|
||||
SELECT offsets(t3) FROM t3 WHERE t3 MATCH 'a AND d OR b' ORDER BY docid DESC
|
||||
} {
|
||||
{0 0 0 1 0 2 2 1}
|
||||
{0 0 0 1 0 1 4 1}
|
||||
}
|
||||
do_execsql_test $tn.2.7 {
|
||||
SELECT snippet(t3,'[',']') FROM t3 WHERE t3 MATCH 'a AND d OR b'
|
||||
ORDER BY docid DESC
|
||||
} {
|
||||
{[a] [b] c}
|
||||
{[a] c [d]}
|
||||
}
|
||||
}
|
||||
|
||||
set sqlite_fts3_enable_parentheses 0
|
||||
finish_test
|
@ -1223,10 +1223,11 @@ proc logcksum {ckv1 ckv2 blob} {
|
||||
upvar $ckv1 c1
|
||||
upvar $ckv2 c2
|
||||
|
||||
set scanpattern I*
|
||||
if {$::tcl_platform(byteOrder) eq "littleEndian"} {
|
||||
set scanpattern i*
|
||||
}
|
||||
# Since the magic number at the start of the -wal file header is
|
||||
# 931071618 that indicates that the content should always be read as
|
||||
# little-endian.
|
||||
#
|
||||
set scanpattern i*
|
||||
|
||||
binary scan $blob $scanpattern values
|
||||
foreach {v1 v2} $values {
|
||||
|
@ -46,6 +46,7 @@ proc set_tvfs_hdr {file args} {
|
||||
}
|
||||
|
||||
set blob [tvfs shm $file]
|
||||
if {$::tcl_platform(byteOrder)=="bigEndian"} {set fmt I} {set fmt i}
|
||||
|
||||
if {[llength $args]} {
|
||||
set ia [lindex $args 0]
|
||||
@ -54,11 +55,11 @@ proc set_tvfs_hdr {file args} {
|
||||
set ib [lindex $args 1]
|
||||
}
|
||||
binary scan $blob a[expr $nHdr*2]a* dummy tail
|
||||
set blob [binary format i${nInt}i${nInt}a* $ia $ib $tail]
|
||||
set blob [binary format ${fmt}${nInt}${fmt}${nInt}a* $ia $ib $tail]
|
||||
tvfs shm $file $blob
|
||||
}
|
||||
|
||||
binary scan $blob i${nInt} ints
|
||||
binary scan $blob ${fmt}${nInt} ints
|
||||
return $ints
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user