diff --git a/ext/fts3/fts3_snippet.c b/ext/fts3/fts3_snippet.c index 54371db1c8..6b74535079 100644 --- a/ext/fts3/fts3_snippet.c +++ b/ext/fts3/fts3_snippet.c @@ -880,13 +880,13 @@ static int fts3ExprLocalHitsCb( void *pCtx /* Pointer to MatchInfo structure */ ){ MatchInfo *p = (MatchInfo *)pCtx; + int iStart = iPhrase * p->nCol * 3; + int i; + + for(i=0; inCol; i++) p->aMatchinfo[iStart+i*3] = 0; if( pExpr->aDoclist ){ char *pCsr; - int iStart = iPhrase * p->nCol * 3; - int i; - - for(i=0; inCol; i++) p->aMatchinfo[iStart+i*3] = 0; pCsr = sqlite3Fts3FindPositions(pExpr, p->pCursor->iPrevId, -1); if( pCsr ){ diff --git a/ext/rtree/rtree.c b/ext/rtree/rtree.c index d47c1092ef..13e5ea241c 100644 --- a/ext/rtree/rtree.c +++ b/ext/rtree/rtree.c @@ -1353,7 +1353,7 @@ static int rtreeFilter( */ static int rtreeBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ int rc = SQLITE_OK; - int ii, cCol; + int ii; int iIdx = 0; char zIdxStr[RTREE_MAX_DIMENSIONS*8+1]; @@ -1361,7 +1361,7 @@ static int rtreeBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ UNUSED_PARAMETER(tab); assert( pIdxInfo->idxStr==0 ); - for(ii=0; iinConstraint; ii++){ + for(ii=0; iinConstraint && iIdx<(sizeof(zIdxStr)-1); ii++){ struct sqlite3_index_constraint *p = &pIdxInfo->aConstraint[ii]; if( p->usable && p->iColumn==0 && p->op==SQLITE_INDEX_CONSTRAINT_EQ ){ @@ -1385,9 +1385,7 @@ static int rtreeBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ } if( p->usable && (p->iColumn>0 || p->op==SQLITE_INDEX_CONSTRAINT_MATCH) ){ - int j, opmsk; - static const unsigned char compatible[] = { 0, 0, 1, 1, 2, 2 }; - u8 op = 0; + u8 op; switch( p->op ){ case SQLITE_INDEX_CONSTRAINT_EQ: op = RTREE_EQ; break; case SQLITE_INDEX_CONSTRAINT_GT: op = RTREE_GT; break; @@ -1399,37 +1397,10 @@ static int rtreeBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ op = RTREE_MATCH; break; } - assert( op!=0 ); - - /* Make sure this particular constraint has not been used before. - ** If it has been used before, ignore it. - ** - ** A <= or < can be used if there is a prior >= or >. - ** A >= or > can be used if there is a prior < or <=. - ** A <= or < is disqualified if there is a prior <=, <, or ==. - ** A >= or > is disqualified if there is a prior >=, >, or ==. - ** A == is disqualifed if there is any prior constraint. - */ - assert( compatible[RTREE_EQ & 7]==0 ); - assert( compatible[RTREE_LT & 7]==1 ); - assert( compatible[RTREE_LE & 7]==1 ); - assert( compatible[RTREE_GT & 7]==2 ); - assert( compatible[RTREE_GE & 7]==2 ); - cCol = p->iColumn - 1 + 'a'; - opmsk = compatible[op & 7]; - for(j=0; jaConstraintUsage[ii].argvIndex = (iIdx/2); - pIdxInfo->aConstraintUsage[ii].omit = 1; - } + zIdxStr[iIdx++] = op; + zIdxStr[iIdx++] = p->iColumn - 1 + 'a'; + pIdxInfo->aConstraintUsage[ii].argvIndex = (iIdx/2); + pIdxInfo->aConstraintUsage[ii].omit = 1; } } diff --git a/ext/rtree/rtree6.test b/ext/rtree/rtree6.test index 0a29f44165..ba0e53c994 100644 --- a/ext/rtree/rtree6.test +++ b/ext/rtree/rtree6.test @@ -106,4 +106,51 @@ do_eqp_test rtree6.2.5 { 0 1 1 {SEARCH TABLE t2 USING INTEGER PRIMARY KEY (rowid=?) (~1 rows)} } +do_execsql_test rtree6-3.1 { + CREATE VIRTUAL TABLE t3 USING rtree(id, x1, x2, y1, y2); + INSERT INTO t3 VALUES(NULL, 1, 1, 2, 2); + SELECT * FROM t3 WHERE + x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND + x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND + x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND + x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND + x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND + x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5; +} {1 1.0 1.0 2.0 2.0} + +do_test rtree6.3.2 { + rtree_strategy { + SELECT * FROM t3 WHERE + x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND + x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND + x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND + x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 + } +} {EaEaEaEaEaEaEaEaEaEaEaEaEaEaEaEaEaEaEaEa} +do_test rtree6.3.3 { + rtree_strategy { + SELECT * FROM t3 WHERE + x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND + x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND + x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND + x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND + x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND + x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 + } +} {EaEaEaEaEaEaEaEaEaEaEaEaEaEaEaEaEaEaEaEa} + +do_execsql_test rtree6-3.4 { + SELECT * FROM t3 WHERE x1>0.5 AND x1>0.8 AND x1>1.1 +} {} +do_execsql_test rtree6-3.5 { + SELECT * FROM t3 WHERE + x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND + x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND + x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND + x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND + x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND + x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>0.5 AND x1>1.1 +} {} + + finish_test diff --git a/manifest b/manifest index 1178e77cb3..0f7a903c77 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,8 @@ -C Add\sthe\s"indirect\sflag"\sto\sthe\schangeset\sblob\sformat.\sAlso\sthe\ssqlite3session_indirect()\sAPI. -D 2011-03-23T16:03:12 +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA1 + +C Merge\sin\sall\sthe\slatest\schanges\sfrom\sthe\strunk,\sand\sespecially\sthe\sinterface\nchanges\sto\sthe\sSystemCall\smethods\sof\sthe\sVFS. +D 2011-03-23T22:48:46.969 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 27701a1653595a1f2187dc61c8117e00a6c1d50f F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -70,7 +73,7 @@ F ext/fts3/fts3_hash.c 3c8f6387a4a7f5305588b203fa7c887d753e1f1c F ext/fts3/fts3_hash.h 8331fb2206c609f9fc4c4735b9ab5ad6137c88ec F ext/fts3/fts3_icu.c ac494aed69835008185299315403044664bda295 F ext/fts3/fts3_porter.c d61cfd81fb0fd8fbcb25adcaee0ba671aefaa5c2 -F ext/fts3/fts3_snippet.c bfefb42b5debf8725a30fd5122572aaeedc99397 +F ext/fts3/fts3_snippet.c e857c6a89d81d3b89df59f3b44b35c68d8ed5c62 F ext/fts3/fts3_tokenizer.c 055f3dc7369585350b28db1ee0f3b214dca6724d F ext/fts3/fts3_tokenizer.h 13ffd9fcb397fec32a05ef5cd9e0fa659bf3dbd3 F ext/fts3/fts3_tokenizer1.c 6e5cbaa588924ac578263a598e4fb9f5c9bb179d @@ -81,14 +84,14 @@ F ext/icu/README.txt bf8461d8cdc6b8f514c080e4e10dc3b2bbdfefa9 F ext/icu/icu.c 850e9a36567bbcce6bd85a4b68243cad8e3c2de2 F ext/icu/sqliteicu.h 728867a802baa5a96de7495e9689a8e01715ef37 F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761 -F ext/rtree/rtree.c 115b499415ddef9be75615ced99b11232826e64d +F ext/rtree/rtree.c 48705ee892c30cc05cd40006d2509ad192530907 F ext/rtree/rtree.h 834dbcb82dc85b2481cde6a07cdadfddc99e9b9e F ext/rtree/rtree1.test dbd4250ac0ad367a262eb9676f7e3080b0368206 F ext/rtree/rtree2.test acbb3a4ce0f4fbc2c304d2b4b784cfa161856bba F ext/rtree/rtree3.test a494da55c30ee0bc9b01a91c80c81b387b22d2dc F ext/rtree/rtree4.test 0061e6f464fd3dc6a79f82454c5a1c3dadbe42af F ext/rtree/rtree5.test ce3d7ccae2cfd9d2e1052b462424964c9bdcda12 -F ext/rtree/rtree6.test 309806a2a27ef5897d4dd6aee2e8006bf754cc22 +F ext/rtree/rtree6.test 0b380bd9af93f3bc496eef42502a336f58949c1b F ext/rtree/rtree7.test bcb647b42920b3b5d025846689147778485cc318 F ext/rtree/rtree8.test 9772e16da71e17e02bdebf0a5188590f289ab37d F ext/rtree/rtree9.test df9843d1a9195249c8d3b4ea6aedda2d5c73e9c2 @@ -131,12 +134,12 @@ F src/btmutex.c 96a12f50f7a17475155971a241d85ec5171573ff F src/btree.c 43302cc4f3de6479b90fa6bb271b65d86333d00e F src/btree.h e2f2cd9933bf30724f53ffa12c4c5a3a864bbd6e F src/btreeInt.h 20f73dc93b1eeb83afd7259fbc6bd7dcf2df7fe4 -F src/build.c 3b86c8efc0cbe716d82c510463f448b9cdee0619 +F src/build.c 821d4b3c6b1da068a4eb1e9c8c414b75612d34c2 F src/callback.c 5069f224882cbdccd559f591271d28d7f37745bc F src/complete.c dc1d136c0feee03c2f7550bafc0d29075e36deac F src/ctime.c 52ff72f966cee3087e0138a3ec69371c22be3c01 F src/date.c 1548fdac51377e4e7833251de878b4058c148e1b -F src/delete.c 122c1a767883c439ad6393d32920152ecb560429 +F src/delete.c c55748a1628b54c8785de0ff4bd9cbe27fe111cb F src/expr.c 00817c672af554321fd67c44325afd7cef0e4648 F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb F src/fkey.c 418b840007c873975fd0d071746d952f8bca20ce @@ -150,7 +153,7 @@ F src/journal.c 552839e54d1bf76fb8f7abe51868b66acacf6a0e F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f F src/lempar.c 7f026423f4d71d989e719a743f98a1cbd4e6d99e F src/loadext.c 8af9fcc75708d60b88636ccba38b4a7b3c155c3e -F src/main.c 22e0f75c17164d4109644e8d623ccaa48a186632 +F src/main.c 2563bd9ca8430c7677d375c566b54b890aaf508f F src/malloc.c 92d59a007d7a42857d4e9454aa25b6b703286be1 F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c 00bd8265c81abb665c48fea1e0c234eb3b922206 @@ -169,7 +172,7 @@ F src/os.c 22ac61d06e72a0dac900400147333b07b13d8e1d F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9 F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f F src/os_os2.c 2596fd2d5d0976c6c0c628d0c3c7c4e7a724f4cf -F src/os_unix.c 919972244dd7267815f9fc176b662390ff0b2348 +F src/os_unix.c 942a9dca5d17c599300127c88a48413e6d55666f F src/os_win.c 24d72407a90551969744cf9bcbb1b4c72c5fa845 F src/pager.c 6aa906b60a59664ba58d3f746164bb010d407ce1 F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1 @@ -184,10 +187,10 @@ F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50 F src/resolve.c 1c0f32b64f8e3f555fe1f732f9d6f501a7f05706 F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697 F src/select.c d24406c45dd2442eb2eeaac413439066b149c944 -F src/shell.c 4a5e0ad845475c84881f0b25b1abba2ddaab0a72 -F src/sqlite.h.in 6b93765e048e0023e23c1d9827a561d7ead7100a +F src/shell.c 9dc0b4bb59290c0a35256d278cab0f314987ad6a +F src/sqlite.h.in 846a91e163497b596b5bbebd26477eaf234eb1c0 F src/sqlite3ext.h c90bd5507099f62043832d73f6425d8d5c5da754 -F src/sqliteInt.h 10707dc735a0077741e1b4b1550891abc26d7582 +F src/sqliteInt.h 7c11f9a648cf82e87330fd2185fcaa1f7c46dfba F src/sqliteLimit.h a17dcd3fb775d63b64a43a55c54cb282f9726f44 F src/status.c 4997380fbb915426fef9e500b4872e79c99267fc F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e @@ -234,15 +237,15 @@ F src/test_vfstrace.c f5c3b3b893d81a580d0f577e6d9bcfc1fd496136 F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9 F src/tokenize.c 604607d6813e9551cf5189d899e0a25c12681080 F src/trigger.c ec4813709e990a169b6923293e839fa5dfd64282 -F src/update.c ca6d4ad2d87e743d22c47f1a6715cc5abf5cda05 +F src/update.c f81e9b326cafba3fbe493141e396f3bbfba1d99b F src/utf.c 1baeeac91707a4df97ccc6141ec0f808278af685 F src/util.c cd997077bad039efc0597eb027c929658f93c018 F src/vacuum.c 924bd1bcee2dfb05376f79845bd3b4cec7b54b2f F src/vdbe.c c90edafd941481506f001b17cd8523683fdac853 F src/vdbe.h edef9c4f0be83e1f1dccd049da37b40e021b63d9 -F src/vdbeInt.h 2cf77c1d151a4a54facd596d52be6d60c1cb26e8 +F src/vdbeInt.h b6748a8ac9be169d83585a0f5daf747863c6b8db F src/vdbeapi.c e472b3e5985175e948e70025cb3bffa8a2e185c8 -F src/vdbeaux.c 0216b2c37509a44c3833b297765bee7bdd04fa2f +F src/vdbeaux.c af3be34b1980e428972ea11ef3a1d88acf8f2b9d F src/vdbeblob.c c3ccb7c8732858c680f442932e66ad06bb036562 F src/vdbemem.c 0498796b6ffbe45e32960d6a1f5adfb6e419883b F src/vdbetrace.c 3ba13bc32bdf16d2bdea523245fd16736bed67b5 @@ -270,7 +273,7 @@ F test/async2.test bf5e2ca2c96763b4cba3d016249ad7259a5603b6 F test/async3.test 93edaa9122f498e56ea98c36c72abc407f4fb11e F test/async4.test 1787e3952128aa10238bf39945126de7ca23685a F test/async5.test f3592d79c84d6e83a5f50d3fd500445f7d97dfdf -F test/attach.test f2b4ac6931f45695082b9f02be959c9c262e4f4d +F test/attach.test 2bb09073d7d5499127db00f50780766dcea913e1 F test/attach2.test a295d2d7061adcee5884ef4a93c7c96a82765437 F test/attach3.test bd9830bc3a0d22ed1310c9bff6896927937017dc F test/attachmalloc.test 1d5b821a676f7bf0b00d87cc106b78966789ba57 @@ -459,7 +462,7 @@ F test/fts3corrupt2.test 6d96efae2f8a6af3eeaf283aba437e6d0e5447ba F test/fts3cov.test e0fb00d8b715ddae4a94c305992dfc3ef70353d7 F test/fts3d.test 95fb3c862cbc4297c93fceb9a635543744e9ef52 F test/fts3defer.test d6cb0db9b5997ecf863d96ff419f83f8f2c87f4f -F test/fts3defer2.test da840efaedebfdd54293d04b36098e2d9872caa6 +F test/fts3defer2.test 288bef6de15557319b8c12d476ebdc83688ef96c F test/fts3e.test 1f6c6ac9cc8b772ca256e6b22aaeed50c9350851 F test/fts3expr.test 5e745b2b6348499d9ef8d59015de3182072c564c F test/fts3expr2.test 18da930352e5693eaa163a3eacf96233b7290d1a @@ -923,7 +926,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P bdea70895c2c686a4dd3f4bf0a475fd1501d9551 -R c02abbe676895f559af6fe54b071c0da -U dan -Z 27e4954529d298836a72824c8b085018 +P 1feaf2d35fd9ec777319717ae2c2929d66fe7baa e059152adce3a8fb693f082b82b5669a238c8d6f +R b36ce5552543fc5931a9682eb2d51184 +U drh +Z 274ed2e4f92b071af1545dccfb5f4fc3 +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.6 (GNU/Linux) + +iD8DBQFNinjSoxKgR168RlERAnfoAJ4yQL1bxQ/2pBGeyDlRWD9l+4WVNwCfXQdV +nYGZvp774EBPS1/20z/kF+M= +=eCFJ +-----END PGP SIGNATURE----- diff --git a/manifest.uuid b/manifest.uuid index f85c8efaad..928103a89f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1feaf2d35fd9ec777319717ae2c2929d66fe7baa \ No newline at end of file +9c3a6e479988e96086bef00c79dbce508a14da0d \ No newline at end of file diff --git a/src/build.c b/src/build.c index 79ac436f07..e7c56c9ab0 100644 --- a/src/build.c +++ b/src/build.c @@ -148,7 +148,7 @@ void sqlite3FinishCoding(Parse *pParse){ ** on each used database. */ if( pParse->cookieGoto>0 ){ - u32 mask; + tAttachMask mask; int iDb; sqlite3VdbeJumpHere(v, pParse->cookieGoto-1); for(iDb=0, mask=1; iDbnDb; mask<<=1, iDb++){ @@ -3444,12 +3444,12 @@ void sqlite3CodeVerifySchema(Parse *pParse, int iDb){ } if( iDb>=0 ){ sqlite3 *db = pToplevel->db; - int mask; + tAttachMask mask; assert( iDbnDb ); assert( db->aDb[iDb].pBt!=0 || iDb==1 ); assert( iDbcookieMask & mask)==0 ){ pToplevel->cookieMask |= mask; pToplevel->cookieValue[iDb] = db->aDb[iDb].pSchema->schema_cookie; @@ -3476,7 +3476,7 @@ void sqlite3CodeVerifySchema(Parse *pParse, int iDb){ void sqlite3BeginWriteOperation(Parse *pParse, int setStatement, int iDb){ Parse *pToplevel = sqlite3ParseToplevel(pParse); sqlite3CodeVerifySchema(pParse, iDb); - pToplevel->writeMask |= 1<writeMask |= ((tAttachMask)1)<isMultiWrite |= setStatement; } diff --git a/src/delete.c b/src/delete.c index 3075df05fc..a5d00263b5 100644 --- a/src/delete.c +++ b/src/delete.c @@ -391,7 +391,7 @@ void sqlite3DeleteFrom( if( IsVirtual(pTab) ){ const char *pVTab = (const char *)sqlite3GetVTable(db, pTab); sqlite3VtabMakeWritable(pParse, pTab); - sqlite3VdbeAddOp4(v, OP_VUpdate, 0, 1, iRowid, pVTab, P4_VTAB); + sqlite3VdbeAddOp4(v, OP_VUpdate, 0, 1, iRowid, (char*)pVTab, P4_VTAB); sqlite3MayAbort(pParse); }else #endif @@ -542,7 +542,7 @@ void sqlite3GenerateRowDelete( if( pTab->pSelect==0 ){ sqlite3GenerateRowIndexDelete(pParse, pTab, iCur, 0); sqlite3VdbeAddOp2(v, OP_Delete, iCur, (count?OPFLAG_NCHANGE:0)); - sqlite3VdbeChangeP4(v, -1, pTab, P4_TABLE); + sqlite3VdbeChangeP4(v, -1, (char*)pTab, P4_TABLE); } /* Do any ON CASCADE, SET NULL or SET DEFAULT operations required to diff --git a/src/main.c b/src/main.c index 7457877a70..9ccd657e79 100644 --- a/src/main.c +++ b/src/main.c @@ -529,13 +529,13 @@ int sqlite3_db_config(sqlite3 *db, int op, ...){ { SQLITE_DBCONFIG_ENABLE_FKEY, SQLITE_ForeignKeys }, { SQLITE_DBCONFIG_ENABLE_TRIGGER, SQLITE_EnableTrigger }, }; - int i; + unsigned int i; rc = SQLITE_ERROR; /* IMP: R-42790-23372 */ for(i=0; iflags; + int oldFlags = db->flags; if( onoff>0 ){ db->flags |= aFlagOp[i].mask; }else if( onoff==0 ){ @@ -1742,8 +1742,8 @@ static const int aHardLimit[] = { #if SQLITE_MAX_FUNCTION_ARG<0 || SQLITE_MAX_FUNCTION_ARG>1000 # error SQLITE_MAX_FUNCTION_ARG must be between 0 and 1000 #endif -#if SQLITE_MAX_ATTACHED<0 || SQLITE_MAX_ATTACHED>30 -# error SQLITE_MAX_ATTACHED must be between 0 and 30 +#if SQLITE_MAX_ATTACHED<0 || SQLITE_MAX_ATTACHED>62 +# error SQLITE_MAX_ATTACHED must be between 0 and 62 #endif #if SQLITE_MAX_LIKE_PATTERN_LENGTH<1 # error SQLITE_MAX_LIKE_PATTERN_LENGTH must be at least 1 diff --git a/src/os_unix.c b/src/os_unix.c index f771efdad5..f4e689fa9f 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -288,23 +288,23 @@ struct unixFile { ** to all overrideable system calls. */ static struct unix_syscall { - const char *zName; /* Name of the sytem call */ - void *pCurrent; /* Current value of the system call */ - void *pDefault; /* Default value */ + const char *zName; /* Name of the sytem call */ + sqlite3_syscall_ptr pCurrent; /* Current value of the system call */ + sqlite3_syscall_ptr pDefault; /* Default value */ } aSyscall[] = { - { "open", (void*)open, 0 }, + { "open", (sqlite3_syscall_ptr)open, 0 }, #define osOpen ((int(*)(const char*,int,int))aSyscall[0].pCurrent) - { "close", (void*)close, 0 }, + { "close", (sqlite3_syscall_ptr)close, 0 }, #define osClose ((int(*)(int))aSyscall[1].pCurrent) - { "access", (void*)access, 0 }, + { "access", (sqlite3_syscall_ptr)access, 0 }, #define osAccess ((int(*)(const char*,int))aSyscall[2].pCurrent) - { "getcwd", (void*)getcwd, 0 }, + { "getcwd", (sqlite3_syscall_ptr)getcwd, 0 }, #define osGetcwd ((char*(*)(char*,size_t))aSyscall[3].pCurrent) - { "stat", (void*)stat, 0 }, + { "stat", (sqlite3_syscall_ptr)stat, 0 }, #define osStat ((int(*)(const char*,struct stat*))aSyscall[4].pCurrent) /* @@ -317,59 +317,59 @@ static struct unix_syscall { { "fstat", 0, 0 }, #define osFstat(a,b,c) 0 #else - { "fstat", (void*)fstat, 0 }, + { "fstat", (sqlite3_syscall_ptr)fstat, 0 }, #define osFstat ((int(*)(int,struct stat*))aSyscall[5].pCurrent) #endif - { "ftruncate", (void*)ftruncate, 0 }, + { "ftruncate", (sqlite3_syscall_ptr)ftruncate, 0 }, #define osFtruncate ((int(*)(int,off_t))aSyscall[6].pCurrent) - { "fcntl", (void*)fcntl, 0 }, + { "fcntl", (sqlite3_syscall_ptr)fcntl, 0 }, #define osFcntl ((int(*)(int,int,...))aSyscall[7].pCurrent) - { "read", (void*)read, 0 }, + { "read", (sqlite3_syscall_ptr)read, 0 }, #define osRead ((ssize_t(*)(int,void*,size_t))aSyscall[8].pCurrent) #if defined(USE_PREAD) || defined(SQLITE_ENABLE_LOCKING_STYLE) - { "pread", (void*)pread, 0 }, + { "pread", (sqlite3_syscall_ptr)pread, 0 }, #else - { "pread", (void*)0, 0 }, + { "pread", (sqlite3_syscall_ptr)0, 0 }, #endif #define osPread ((ssize_t(*)(int,void*,size_t,off_t))aSyscall[9].pCurrent) #if defined(USE_PREAD64) - { "pread64", (void*)pread64, 0 }, + { "pread64", (sqlite3_syscall_ptr)pread64, 0 }, #else - { "pread64", (void*)0, 0 }, + { "pread64", (sqlite3_syscall_ptr)0, 0 }, #endif #define osPread64 ((ssize_t(*)(int,void*,size_t,off_t))aSyscall[10].pCurrent) - { "write", (void*)write, 0 }, + { "write", (sqlite3_syscall_ptr)write, 0 }, #define osWrite ((ssize_t(*)(int,const void*,size_t))aSyscall[11].pCurrent) #if defined(USE_PREAD) || defined(SQLITE_ENABLE_LOCKING_STYLE) - { "pwrite", (void*)pwrite, 0 }, + { "pwrite", (sqlite3_syscall_ptr)pwrite, 0 }, #else - { "pwrite", (void*)0, 0 }, + { "pwrite", (sqlite3_syscall_ptr)0, 0 }, #endif #define osPwrite ((ssize_t(*)(int,const void*,size_t,off_t))\ aSyscall[12].pCurrent) #if defined(USE_PREAD64) - { "pwrite64", (void*)pwrite64, 0 }, + { "pwrite64", (sqlite3_syscall_ptr)pwrite64, 0 }, #else - { "pwrite64", (void*)0, 0 }, + { "pwrite64", (sqlite3_syscall_ptr)0, 0 }, #endif #define osPwrite64 ((ssize_t(*)(int,const void*,size_t,off_t))\ aSyscall[13].pCurrent) - { "fchmod", (void*)fchmod, 0 }, + { "fchmod", (sqlite3_syscall_ptr)fchmod, 0 }, #define osFchmod ((int(*)(int,mode_t))aSyscall[14].pCurrent) #if defined(HAVE_POSIX_FALLOCATE) && HAVE_POSIX_FALLOCATE - { "fallocate", (void*)posix_fallocate, 0 }, + { "fallocate", (sqlite3_syscall_ptr)posix_fallocate, 0 }, #else - { "fallocate", (void*)0, 0 }, + { "fallocate", (sqlite3_syscall_ptr)0, 0 }, #endif #define osFallocate ((int(*)(int,off_t,off_t)aSyscall[15].pCurrent) @@ -382,12 +382,14 @@ static struct unix_syscall { ** system call named zName. */ static int unixSetSystemCall( - sqlite3_vfs *pNotUsed, /* The VFS pointer. Not used */ - const char *zName, /* Name of system call to override */ - void *pNewFunc /* Pointer to new system call value */ + sqlite3_vfs *pNotUsed, /* The VFS pointer. Not used */ + const char *zName, /* Name of system call to override */ + sqlite3_syscall_ptr pNewFunc /* Pointer to new system call value */ ){ - int i; + unsigned int i; int rc = SQLITE_NOTFOUND; + + UNUSED_PARAMETER(pNotUsed); if( zName==0 ){ /* If no zName is given, restore all system calls to their default ** settings and return NULL @@ -422,8 +424,13 @@ static int unixSetSystemCall( ** recognized system call name. NULL is also returned if the system call ** is currently undefined. */ -static void *unixGetSystemCall(sqlite3_vfs *pNotUsed, const char *zName){ - int i; +static sqlite3_syscall_ptr unixGetSystemCall( + sqlite3_vfs *pNotUsed, + const char *zName +){ + unsigned int i; + + UNUSED_PARAMETER(pNotUsed); for(i=0; i=1 ){ + if( c=='l' && strncmp(azArg[0], "log", n)==0 && nArg>=2 ){ const char *zFile = azArg[1]; if( p->pLog && p->pLog!=stdout && p->pLog!=stderr ){ fclose(p->pLog); diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 2ee63f24f1..f3393da01e 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -907,6 +907,7 @@ typedef struct sqlite3_mutex sqlite3_mutex; ** any of these methods if the iVersion of the VFS is less than 3. */ typedef struct sqlite3_vfs sqlite3_vfs; +typedef void (*sqlite3_syscall_ptr)(void); struct sqlite3_vfs { int iVersion; /* Structure version number (currently 3) */ int szOsFile; /* Size of subclassed sqlite3_file */ @@ -936,8 +937,8 @@ struct sqlite3_vfs { ** The methods above are in versions 1 and 2 of the sqlite_vfs object. ** Those below are for version 3 and greater. */ - int (*xSetSystemCall)(sqlite3_vfs*, const char *zName, void *pFunc); - void *(*xGetSystemCall)(sqlite3_vfs*, const char *zName); + int (*xSetSystemCall)(sqlite3_vfs*, const char *zName, sqlite3_syscall_ptr); + sqlite3_syscall_ptr (*xGetSystemCall)(sqlite3_vfs*, const char *zName); const char *(*xNextSystemCall)(sqlite3_vfs*, const char *zName); /* ** The methods above are in versions 1 through 3 of the sqlite_vfs object. diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 790a796799..a15b8bff1c 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -2131,6 +2131,13 @@ struct TriggerPrg { TriggerPrg *pNext; /* Next entry in Parse.pTriggerPrg list */ }; +/* Datatype for the bitmask of all attached databases */ +#if SQLITE_MAX_ATTACHED>30 + typedef sqlite3_uint64 tAttachMask; +#else + typedef unsigned int tAttachMask; +#endif + /* ** An SQL parser context. A copy of this structure is passed through ** the parser and down into all the parser action routine in order to @@ -2179,8 +2186,8 @@ struct Parse { int iReg; /* Reg with value of this column. 0 means none. */ int lru; /* Least recently used entry has the smallest value */ } aColCache[SQLITE_N_COLCACHE]; /* One for each column cache entry */ - u32 writeMask; /* Start a write transaction on these databases */ - u32 cookieMask; /* Bitmask of schema verified databases */ + tAttachMask writeMask; /* Start a write transaction on these databases */ + tAttachMask cookieMask; /* Bitmask of schema verified databases */ u8 isMultiWrite; /* True if statement may affect/insert multiple rows */ u8 mayAbort; /* True if statement may throw an ABORT exception */ int cookieGoto; /* Address of OP_Goto to cookie verifier subroutine */ diff --git a/src/update.c b/src/update.c index b67c76f5fe..fd310fb307 100644 --- a/src/update.c +++ b/src/update.c @@ -503,7 +503,7 @@ void sqlite3Update( regNewRowid ); if( !pParse->nested ){ - sqlite3VdbeChangeP4(v, -1, pTab, P4_TABLE); + sqlite3VdbeChangeP4(v, -1, (char*)pTab, P4_TABLE); } sqlite3VdbeJumpHere(v, j1); diff --git a/src/vdbeInt.h b/src/vdbeInt.h index cac88af71e..911c29faf5 100644 --- a/src/vdbeInt.h +++ b/src/vdbeInt.h @@ -302,7 +302,7 @@ struct Vdbe { u8 readOnly; /* True for read-only statements */ u8 isPrepareV2; /* True if prepared with prepare_v2() */ int nChange; /* Number of db changes made since last reset */ - int btreeMask; /* Bitmask of db->aDb[] entries referenced */ + tAttachMask btreeMask; /* Bitmask of db->aDb[] entries referenced */ int iStatement; /* Statement number (or 0 if has not opened stmt) */ int aCounter[3]; /* Counters used by sqlite3_stmt_status() */ BtreeMutexArray aMutex; /* An array of Btree used here and needing locks */ diff --git a/src/vdbeaux.c b/src/vdbeaux.c index a2526ace20..28acaea316 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -951,8 +951,8 @@ static char *displayP4(Op *pOp, char *zTemp, int nTemp){ ** in order (and released in reverse order) to avoid deadlocks. */ void sqlite3VdbeUsesBtree(Vdbe *p, int i){ - int mask; - assert( i>=0 && idb->nDb && i=0 && idb->nDb && ibtreeMask)*8 ); mask = ((u32)1)<btreeMask & mask)==0 ){ diff --git a/test/attach.test b/test/attach.test index a5af8f751d..1bb596cb90 100644 --- a/test/attach.test +++ b/test/attach.test @@ -152,14 +152,16 @@ do_test attach-1.18 { ATTACH 'test.db' as db11; } } {0 {}} -do_test attach-1.19 { - catchsql { - ATTACH 'test.db' as db12; - } -} {1 {too many attached databases - max 10}} -do_test attach-1.19.1 { - db errorcode -} {1} +if {$SQLITE_MAX_ATTACHED==10} { + do_test attach-1.19 { + catchsql { + ATTACH 'test.db' as db12; + } + } {1 {too many attached databases - max 10}} + do_test attach-1.19.1 { + db errorcode + } {1} +} do_test attach-1.20.1 { execsql { DETACH db5; @@ -179,14 +181,16 @@ do_test attach-1.21 { ATTACH 'test.db' as db12; } } {0 {}} -do_test attach-1.22 { - catchsql { - ATTACH 'test.db' as db13; - } -} {1 {too many attached databases - max 10}} -do_test attach-1.22.1 { - db errorcode -} {1} +if {$SQLITE_MAX_ATTACHED==10} { + do_test attach-1.22 { + catchsql { + ATTACH 'test.db' as db13; + } + } {1 {too many attached databases - max 10}} + do_test attach-1.22.1 { + db errorcode + } {1} +} do_test attach-1.23 { catchsql { DETACH "db14"; diff --git a/test/fts3defer2.test b/test/fts3defer2.test index 142c92a9dd..8441803300 100644 --- a/test/fts3defer2.test +++ b/test/fts3defer2.test @@ -80,7 +80,7 @@ do_execsql_test 2.1.2 "INSERT INTO t2 VALUES('[string repeat {a } 10000]')" do_execsql_test 2.1.3 "INSERT INTO t2 VALUES('b [string repeat {z } 10000]')" do_execsql_test 2.1.4 [string repeat "INSERT INTO t2 VALUES('x');" 50] do_execsql_test 2.1.5 { - INSERT INTO t2 VALUES('a b c d e f g'); + INSERT INTO t2 VALUES('a b c d e f g z'); INSERT INTO t2 VALUES('a b c d e f g'); } foreach {tn sql} { @@ -92,12 +92,21 @@ foreach {tn sql} { } { execsql $sql - do_execsql_test 2.2.$tn { + do_execsql_test 2.2.$tn.1 { SELECT mit(matchinfo(t2, 'pcxnal')) FROM t2 WHERE t2 MATCH 'a b'; } [list \ - [list 2 1 1 54 54 1 3 3 54 372 7] \ + [list 2 1 1 54 54 1 3 3 54 372 8] \ [list 2 1 1 54 54 1 3 3 54 372 7] \ ] + + set sqlite_fts3_enable_parentheses 1 + do_execsql_test 2.2.$tn.2 { + SELECT mit(matchinfo(t2, 'x')) FROM t2 WHERE t2 MATCH 'g OR (g z)'; + } [list \ + [list 1 2 2 1 2 2 1 54 54] \ + [list 1 2 2 1 2 2 0 54 54] \ + ] + set sqlite_fts3_enable_parentheses 0 } do_execsql_test 2.3.1 {