From 87dd60cd8dc7e4e83b160b77ff7c7ca351b344d3 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 26 Mar 2010 21:53:11 +0000 Subject: [PATCH] Pull in other fixes from the trunk: check-ins [bea9258643], [f186b6a619], and [bb591802ff]. FossilOrigin-Name: b1f342a6643829020beef542a0700d90822e6467 --- ext/fts3/fts3.c | 31 +++++++++++++++++++++++++------ manifest | 26 +++++++++++++------------- manifest.uuid | 2 +- src/ctime.c | 2 -- test/fts3ag.test | 2 +- test/fts3expr.test | 28 ++++++++++++++-------------- tool/mksqlite3c.tcl | 2 +- 7 files changed, 55 insertions(+), 38 deletions(-) diff --git a/ext/fts3/fts3.c b/ext/fts3/fts3.c index bb61578487..3b09bf3d23 100644 --- a/ext/fts3/fts3.c +++ b/ext/fts3/fts3.c @@ -600,6 +600,14 @@ static int fts3CreateTables(Fts3Table *p){ return rc; } +/* +** An sqlite3_exec() callback for fts3TableExists. +*/ +static int fts3TableExistsCallback(void *pArg, int n, char **pp1, char **pp2){ + *(int*)pArg = 1; + return 1; +} + /* ** Determine if a table currently exists in the database. */ @@ -612,10 +620,17 @@ static void fts3TableExists( u8 *pResult /* Write results here */ ){ int rc = SQLITE_OK; + int res = 0; + char *zSql; if( *pRc ) return; - fts3DbExec(&rc, db, "SELECT 1 FROM %Q.'%q%s'", zDb, zName, zSuffix); - *pResult = (rc==SQLITE_OK) ? 1 : 0; - if( rc!=SQLITE_ERROR ) *pRc = rc; + zSql = sqlite3_mprintf( + "SELECT 1 FROM %Q.sqlite_master WHERE name='%q%s'", + zDb, zName, zSuffix + ); + rc = sqlite3_exec(db, zSql, fts3TableExistsCallback, &res, 0); + sqlite3_free(zSql); + *pResult = res & 0xff; + if( rc!=SQLITE_ABORT ) *pRc = rc; } /* @@ -2033,7 +2048,13 @@ static int fts3FilterMethod( rc = sqlite3Fts3ExprParse(p->pTokenizer, p->azColumn, p->nColumn, iCol, zQuery, -1, &pCsr->pExpr ); - if( rc!=SQLITE_OK ) return rc; + if( rc!=SQLITE_OK ){ + if( rc==SQLITE_ERROR ){ + p->base.zErrMsg = sqlite3_mprintf("malformed MATCH expression: [%s]", + zQuery); + } + return rc; + } rc = evalFts3Expr(p, pCsr->pExpr, &pCsr->aDoclist, &pCsr->nDoclist, 0); pCsr->pNextId = pCsr->aDoclist; @@ -2553,13 +2574,11 @@ int sqlite3Fts3Init(sqlite3 *db){ rc = sqlite3_create_module_v2( db, "fts3", &fts3Module, (void *)pHash, hashDestroy ); -#if 0 /* FTS4 is disabled in 3.6.23 since it is not yet ready for publication */ if( rc==SQLITE_OK ){ rc = sqlite3_create_module_v2( db, "fts4", &fts3Module, (void *)pHash, 0 ); } -#endif /* disable FTS4 */ return rc; } diff --git a/manifest b/manifest index 4014f94293..5dc0742a79 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,8 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 -C Fix\sto\sthe\scrash8.test\stest\sscript. -D 2010-03-26T21:48:00 +C Pull\sin\sother\sfixes\sfrom\sthe\strunk:\s\scheck-ins\s[bea9258643],\n[f186b6a619],\sand\s[bb591802ff]. +D 2010-03-26T21:53:12 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in 4f2f967b7e58a35bb74fb7ec8ae90e0f4ca7868b F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -59,7 +59,7 @@ F ext/fts2/mkfts2amal.tcl 974d5d438cb3f7c4a652639262f82418c1e4cff0 F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a F ext/fts3/README.tokenizers 998756696647400de63d5ba60e9655036cb966e9 F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d -F ext/fts3/fts3.c dea6740e642a71f32cce37935b7bab95fb29f4ac +F ext/fts3/fts3.c 2bb2045d1412184e9eea71eb151b159168be5131 F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe F ext/fts3/fts3Int.h df812ef35f1b47a44ec68a44ec0c2a769c973d85 F ext/fts3/fts3_expr.c f4ff02ebe854e97ac03ff00b38b728a9ab57fd4b @@ -118,7 +118,7 @@ F src/btreeInt.h 71ed5e7f009caf17b7dc304350b3cb64b5970135 F src/build.c 11100b66fb97638d2d874c1d34d8db90650bb1d7 F src/callback.c 908f3e0172c3d4058f4ca0acd42c637c52e9669f F src/complete.c dc1d136c0feee03c2f7550bafc0d29075e36deac -F src/ctime.c 675186d89e0e6c028390b6c75d5356beffb669d4 +F src/ctime.c ceb247eb31620bba66a94c3f697db489a1652353 F src/date.c 485a4409a384310e6d93fd1104a9d0a8658becd9 F src/delete.c 610dc008e88a9599f905f5cbe9577ac9c36e0581 F src/expr.c 6baed2a0448d494233d9c0a610eea018ab386a32 @@ -391,7 +391,7 @@ F test/fts3ac.test 636ed7486043055d4f126a0e385f2d5a82ebbf63 F test/fts3ad.test e40570cb6f74f059129ad48bcef3d7cbc20dda49 F test/fts3ae.test ce32a13b34b0260928e4213b4481acf801533bda F test/fts3af.test d394978c534eabf22dd0837e718b913fd66b499c -F test/fts3ag.test 38d9c7dd4b607929498e8e0b32299af5665da1ab +F test/fts3ag.test 0b7d303f61ae5d620c4efb5e825713ea34ff9441 F test/fts3ah.test ba181d6a3dee0c929f0d69df67cac9c47cda6bff F test/fts3ai.test d29cee6ed653e30de478066881cec8aa766531b2 F test/fts3aj.test 584facbc9ac4381a7ec624bfde677340ffc2a5a4 @@ -406,7 +406,7 @@ F test/fts3c.test fc723a9cf10b397fdfc2b32e73c53c8b1ec02958 F test/fts3cov.test 3a9d8618a3107166530c447e808f8992372e0415 F test/fts3d.test 95fb3c862cbc4297c93fceb9a635543744e9ef52 F test/fts3e.test 1f6c6ac9cc8b772ca256e6b22aaeed50c9350851 -F test/fts3expr.test 05dab77387801e4900009917bb18f556037d82da +F test/fts3expr.test 5e745b2b6348499d9ef8d59015de3182072c564c F test/fts3expr2.test 18da930352e5693eaa163a3eacf96233b7290d1a F test/fts3malloc.test 059592c4f37ccd30138bbf8e3e5b7982cb5c8f2e F test/fts3near.test 2e318ee434d32babd27c167142e2b94ddbab4844 @@ -775,7 +775,7 @@ F tool/lempar.c 01ca97f87610d1dac6d8cd96ab109ab1130e76dc F tool/mkkeywordhash.c d2e6b4a5965e23afb80fbe74bb54648cd371f309 F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97 -F tool/mksqlite3c.tcl e1245579315f821e83e06934e93732b4c60a0375 +F tool/mksqlite3c.tcl 4c6924c7e877defa8f9a12ef1e6867de614acf3f F tool/mksqlite3h.tcl eb100dce83f24b501b325b340f8b5eb8e5106b3b F tool/mksqlite3internalh.tcl 7b43894e21bcb1bb39e11547ce7e38a063357e87 F tool/omittest.tcl 27d6f6e3b1e95aeb26a1c140e6eb57771c6d794a @@ -795,14 +795,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 4b65b4805100852a2b6a834aa6efc0bbf25b539f -R a755efe13753ddfb8b64e15f01c7c347 +P f18a129a7aab09a1e0d34155e82bcbf7479a401d +R 50e3bd42226db594509d5c3a819815bc U drh -Z 15714eb3b682e0860693a6dec30052f8 +Z 9156d1cd66a381c14ff2bf7b510593f1 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) -iD8DBQFLrSuUoxKgR168RlERAk+uAJ4pKuBwrql8qOB6ZZKBWs6HVSh+zgCaA+k1 -zY2vWc36upmIx4nv3E9OOJA= -=ma5f +iD8DBQFLrS32oxKgR168RlERArweAJ9P9PRYQdSH+sU4s0FqXbAyz4Sp9gCeOz5i +/CzXSHa4yQ1+MihNxx/d1mo= +=e9s1 -----END PGP SIGNATURE----- diff --git a/manifest.uuid b/manifest.uuid index bf189900c2..af6ccd7858 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f18a129a7aab09a1e0d34155e82bcbf7479a401d \ No newline at end of file +b1f342a6643829020beef542a0700d90822e6467 \ No newline at end of file diff --git a/src/ctime.c b/src/ctime.c index ed91ddf663..dacdc5883c 100644 --- a/src/ctime.c +++ b/src/ctime.c @@ -84,11 +84,9 @@ static const char * const azCompileOpt[] = { #ifdef SQLITE_ENABLE_FTS3_PARENTHESIS "ENABLE_FTS3_PARENTHESIS", #endif -#if 0 /* Disabled because FTS4 is not ready for publication */ #ifdef SQLITE_ENABLE_FTS4 "ENABLE_FTS4", #endif -#endif #ifdef SQLITE_ENABLE_ICU "ENABLE_ICU", #endif diff --git a/test/fts3ag.test b/test/fts3ag.test index 34ef9497ed..18ed5ae31f 100644 --- a/test/fts3ag.test +++ b/test/fts3ag.test @@ -73,7 +73,7 @@ do_test fts3ag-1.9 { # No support for all-except queries. do_test fts3ag-1.10 { catchsql {SELECT rowid FROM t1 WHERE t1 MATCH '-this -something'} -} {1 {SQL logic error or missing database}} +} {1 {malformed MATCH expression: [-this -something]}} # Test that docListOrMerge() correctly handles reaching the end of one # doclist before it reaches the end of the other. diff --git a/test/fts3expr.test b/test/fts3expr.test index 4cedecb2d9..e7c4f65598 100644 --- a/test/fts3expr.test +++ b/test/fts3expr.test @@ -336,53 +336,53 @@ do_test fts3expr-4.1 { # Mismatched parenthesis: do_test fts3expr-4.2.1 { catchsql { SELECT * FROM t1 WHERE t1 MATCH 'example AND (hello OR world))' } -} {1 {SQL logic error or missing database}} +} {1 {malformed MATCH expression: [example AND (hello OR world))]}} do_test fts3expr-4.2.2 { catchsql { SELECT * FROM t1 WHERE t1 MATCH 'example AND (hello OR world' } -} {1 {SQL logic error or missing database}} +} {1 {malformed MATCH expression: [example AND (hello OR world]}} do_test fts3expr-4.2.3 { catchsql { SELECT * FROM t1 WHERE t1 MATCH '(hello' } -} {1 {SQL logic error or missing database}} +} {1 {malformed MATCH expression: [(hello]}} do_test fts3expr-4.2.4 { catchsql { SELECT * FROM t1 WHERE t1 MATCH '(' } -} {1 {SQL logic error or missing database}} +} {1 {malformed MATCH expression: [(]}} do_test fts3expr-4.2.5 { catchsql { SELECT * FROM t1 WHERE t1 MATCH ')' } -} {1 {SQL logic error or missing database}} +} {1 {malformed MATCH expression: [)]}} do_test fts3expr-4.2.6 { catchsql { SELECT * FROM t1 WHERE t1 MATCH 'example (hello world' } -} {1 {SQL logic error or missing database}} +} {1 {malformed MATCH expression: [example (hello world]}} # Unterminated quotation marks: do_test fts3expr-4.3.1 { catchsql { SELECT * FROM t1 WHERE t1 MATCH 'example OR "hello world' } -} {1 {SQL logic error or missing database}} +} {1 {malformed MATCH expression: [example OR "hello world]}} do_test fts3expr-4.3.2 { catchsql { SELECT * FROM t1 WHERE t1 MATCH 'example OR hello world"' } -} {1 {SQL logic error or missing database}} +} {1 {malformed MATCH expression: [example OR hello world"]}} # Binary operators without the required operands. do_test fts3expr-4.4.1 { catchsql { SELECT * FROM t1 WHERE t1 MATCH 'OR hello world' } -} {1 {SQL logic error or missing database}} +} {1 {malformed MATCH expression: [OR hello world]}} do_test fts3expr-4.4.2 { catchsql { SELECT * FROM t1 WHERE t1 MATCH 'hello world OR' } -} {1 {SQL logic error or missing database}} +} {1 {malformed MATCH expression: [hello world OR]}} do_test fts3expr-4.4.3 { catchsql { SELECT * FROM t1 WHERE t1 MATCH 'one (hello world OR) two' } -} {1 {SQL logic error or missing database}} +} {1 {malformed MATCH expression: [one (hello world OR) two]}} do_test fts3expr-4.4.4 { catchsql { SELECT * FROM t1 WHERE t1 MATCH 'one (OR hello world) two' } -} {1 {SQL logic error or missing database}} +} {1 {malformed MATCH expression: [one (OR hello world) two]}} # NEAR operators with something other than phrases as arguments. do_test fts3expr-4.5.1 { catchsql { SELECT * FROM t1 WHERE t1 MATCH '(hello OR world) NEAR one' } -} {1 {SQL logic error or missing database}} +} {1 {malformed MATCH expression: [(hello OR world) NEAR one]}} do_test fts3expr-4.5.2 { catchsql { SELECT * FROM t1 WHERE t1 MATCH 'one NEAR (hello OR world)' } -} {1 {SQL logic error or missing database}} +} {1 {malformed MATCH expression: [one NEAR (hello OR world)]}} #------------------------------------------------------------------------ # The following OOM tests are designed to cover cases in fts3_expr.c. diff --git a/tool/mksqlite3c.tcl b/tool/mksqlite3c.tcl index bda08bc4ab..38cee50ec2 100644 --- a/tool/mksqlite3c.tcl +++ b/tool/mksqlite3c.tcl @@ -211,6 +211,7 @@ foreach file { sqliteInt.h global.c + ctime.c status.c date.c os.c @@ -266,7 +267,6 @@ foreach file { auth.c build.c callback.c - ctime.c delete.c func.c fkey.c -- 2.47.2