Fix straggler misspellings and tidy the custom dictionary. Also include pickups from [forum:/info/c61fb09afd|forum post c61fb09afd].

FossilOrigin-Name: 8c291d99946eb32b20b743921202f9c7cfb716268ff526817b27adbb7942e40b
This commit is contained in:
larrybr 2023-06-07 17:03:22 +00:00
commit 55be21647e
62 changed files with 150 additions and 30076 deletions

View File

@ -1528,6 +1528,7 @@ clean:
rm -f fts5.* fts5parse.*
rm -f threadtest5
rm -f src-verify
rm -f custom.rws
distclean: clean
rm -f sqlite_cfg.h config.log config.status libtool Makefile sqlite3.pc \

View File

@ -1,9 +1,9 @@
C Add\sa\sC-source\sspell-checking\sfacility.\smake\smisspell\s(on\sNix)
D 2023-06-07T08:40:31.431
C Fix\sstraggler\smisspellings\sand\stidy\sthe\scustom\sdictionary.\sAlso\sinclude\spickups\sfrom\s[forum:/info/c61fb09afd|forum\spost\sc61fb09afd].
D 2023-06-07T17:03:22.151
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
F Makefile.in 572a91092815e65bc8d5bfb53a12f31005320048f607fc05b20012ba48afe426
F Makefile.in bb4554cd186313a89f2e774698faa718350b3fc914386845c5ddb39710181cff
F Makefile.linux-gcc f609543700659711fbd230eced1f01353117621dccae7b9fb70daa64236c5241
F Makefile.msc 9c032cabd86fc0468167459b714478be7fe77e47ce43fdf1bfaf2e48e829a112
F README.md 6f942c2e542d53202dc75b114b0617e9e02f8a6a777508fc23c3d8297951c478
@ -557,7 +557,6 @@ F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0
F main.mk 14bdf404d42ffee34b637369afd305c8dbc283cab233ca5d27bb104024d7f5b7
F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83
F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271
F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504
F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421
@ -576,31 +575,31 @@ F src/auth.c 19b7ccacae3dfba23fc6f1d0af68134fa216e9040e53b0681b4715445ea030b4
F src/backup.c 5c97e8023aab1ce14a42387eb3ae00ba5a0644569e3476f38661fa6f824c3523
F src/bitvec.c 9eac5f42c11914d5ef00a75605bb205e934f435c579687f985f1f8b0995c8645
F src/btmutex.c 79a43670447eacc651519a429f6ece9fd638563cf95b469d6891185ddae2b522
F src/btree.c 148228f60581e5ecbe4b57d0ba1d0bbc0ff737c6581c841e2dedd58fa07689c0
F src/btree.c 030e6b7b6c3d6241a23a7e62200653cfabdfc08782f9d0d781c29a372efb8d64
F src/btree.h aa354b9bad4120af71e214666b35132712b8f2ec11869cb2315c52c81fad45cc
F src/btreeInt.h 3b4eff7155c0cea6971dc51f62e3529934a15a6640ec607dd42a767e379cb3a9
F src/build.c bf900f75fb241130fe59299e00ea07d522080eb7e75811b175f313dcb3ab3291
F src/build.c cb54df6fd018a18e940a251c5e31780ffba8bc6c7a01e670b96a489adcbfb3b4
F src/callback.c db3a45e376deff6a16c0058163fe0ae2b73a2945f3f408ca32cf74960b28d490
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
F src/ctime.c 20507cc0b0a6c19cd882fcd0eaeda32ae6a4229fb4b024cfdf3183043d9b703d
F src/date.c cb71f73d5df5303ec6630971b9c8b8c7df466fa3233dbdc643d613806e53e554
F src/date.c 6e9549239d08957ffeff481bb131d071c969833b230d1dbfb836cf9dab1501b8
F src/dbpage.c f3eea5f7ec47e09ee7da40f42b25092ecbe961fc59566b8e5f705f34335b2387
F src/dbstat.c ec92074baa61d883de58c945162d9e666c13cd7cf3a23bc38b4d1c4d0b2c2bef
F src/delete.c fe728a9ec79a719c2c2fb0c42822fc96a7cb457279eede8314e25d951b0e0dda
F src/expr.c db2e4870db1577415f796c22ee893175432bd61abce082c5905902257724ad24
F src/delete.c 1b00589aa4f2c50beba39f9da5166fc2161234580ea8c0d087b6d5c2c7a17c21
F src/expr.c b7dabf7f5ab42ed0b70437e9725aea25700eaff8a268cc42d682b1d67bb797f8
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
F src/fkey.c 03c134cc8bffe54835f742ddea0b72ebfc8f6b32773d175c71b8afeea6cb5c83
F src/func.c e20ad8a7cf1a8a8237e7cfc5b3b3c82598e40a05c980e3de30b5323a7f8927ab
F src/func.c 6303e1ccb80dbd0d9b52f902a01d3b105981486fdfd66f9e1ddfd74aaf3032fc
F src/global.c bd0892ade7289f6e20bff44c07d06371f2ff9b53cea359e7854b9b72f65adc30
F src/hash.c 9ee4269fb1d6632a6fecfb9479c93a1f29271bddbbaf215dd60420bcb80c7220
F src/hash.h 3340ab6e1d13e725571d7cee6d3e3135f0779a7d8e76a9ce0a85971fa3953c51
F src/hwtime.h f9c2dfb84dce7acf95ce6d289e46f5f9d3d1afd328e53da8f8e9008e3b3caae6
F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
F src/insert.c a38bbb944a4f2771d70140db9c5d57e36c37e28d5a366497b4f93272a6d2567e
F src/json.c 89170fc7a484073e84c0573b31c2878bdbf5210e9cc9539b9a74404153c6a779
F src/json.c 14c474fb1249a46eb44e878e2361f36abfe686b134039b0d1883d93d61505b4a
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
F src/loadext.c 176d6b2cb18a6ad73b133db17f6fc351c4d9a2d510deebdb76c22bde9cfd1465
F src/main.c 44a6b08c61b3256634767dd6b91f7c5ce9f9520d2fe4573300fea40b7c766114
F src/main.c 5fd4b65d61ae6155f36756ed508a39b38b49355b031188961e8d923f43f4bc49
F src/malloc.c 47b82c5daad557d9b963e3873e99c22570fb470719082c6658bf64e3012f7d23
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c 3bb59158c38e05f6270e761a9f435bf19827a264c13d1631c58b84bdc96d73b2
@ -624,22 +623,22 @@ F src/os_setup.h 6011ad7af5db4e05155f385eb3a9b4470688de6f65d6166b8956e58a3d87210
F src/os_unix.c 95b407307deb902a3bd9a5d5666c7838709cccb337baeee6ef0a53f512d3673e
F src/os_win.c 79ff2345aafe92be324e8d9062050c6c5ae714c2db6b4b5334d7d28e70ea81e6
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
F src/pager.c eeb41200c0d0d75b49e0c374eecb8f07f12f2c1deb0f1d3ca5573bcb300b9727
F src/pager.c 0dfe6a9c76ca8ad8eb91a3867dd20ba1f5c854bc5e9cd9cde62112bdee1822be
F src/pager.h f82e9844166e1585f5786837ddc7709966138ced17f568c16af7ccf946c2baa3
F src/parse.y 146f9a1db7db5ef4299c6897d335e5abed348c2626190d2877d45ffa210fd4ca
F src/parse.y 396bdbaa15c3a9b2e7ea693e2db19cab6c7bd4bdb64573b471f7ef0bdbbb5584
F src/pcache.c 4cd4a0043167da9ba7e19b4d179a0e6354e7fe32c16f781ecf9bf0a5ff63b40b
F src/pcache.h 1497ce1b823cf00094bb0cf3bac37b345937e6f910890c626b16512316d3abf5
F src/pcache1.c 602acb23c471bb8d557a6f0083cc2be641d6cafcafa19e481eba7ef4c9ca0f00
F src/pragma.c 02c8e7b47e88c2afb77fb1f6ebf2cd9331e4469ae97d4a774ce824e2875fbfcb
F src/pragma.c 37b8fb02d090262280c86e1e2654bf59d8dbfbfe8dc6733f2b968a11374c095a
F src/pragma.h e690a356c18e98414d2e870ea791c1be1545a714ba623719deb63f7f226d8bb7
F src/prepare.c d6c4354f8ea0dc06962fbabc4b68c4471a45276a2918c929be00f9f537f69eb1
F src/printf.c b9320cdbeca0b336c3f139fd36dd121e4167dd62b35fbe9ccaa9bab44c0af38d
F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
F src/resolve.c c1457b920aeb33ed106bf478fad31b7473a8950a755ea898980c428928f3a514
F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
F src/select.c d1d9e1e91098763573f15671323cc2fb869b199a889d51b1405b80161c6f6c24
F src/shell.c.in de1299f089fc8c316a17bfc8ebb1f0a038da894c09920dc0aecee5c850df7b12
F src/sqlite.h.in ddae9f672352c9e44e1acac99a401e6700752932fd4dc7f35e5569f7e0d609dc
F src/select.c 1ddfe4450101c3d4890ecb2d6b97ab80b78764d5a3e7022b171721df1620c419
F src/shell.c.in 0c420738cf95292c394c2451281f76f2638c9234943805375974a20d2a5be8c3
F src/sqlite.h.in 3076d78836b6dac53b3ab0875fc8fd15bca8077aad4d33c85336e05af6aef8c7
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h da473ce2b3d0ae407a6300c4a164589b9a6bfdbec9462688a8593ff16f3bb6e4
F src/sqliteInt.h 924ddd5bd9dad8a499005c2c02a492c67dbe784feafbd78fdd70d712cf839499
@ -647,7 +646,7 @@ F src/sqliteLimit.h 33b1c9baba578d34efe7dfdb43193b366111cdf41476b1e82699e14c11ee
F src/status.c 160c445d7d28c984a0eae38c144f6419311ed3eace59b44ac6dafc20db4af749
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
F src/tclsqlite.c 9952874a1f1bb9fa6406b334cadf748c273cd2f2d4501152022a95dd37dc7958
F src/test1.c f6076314e68b5803b962f94628a064aaf77850abed352999ec38db493294f2ae
F src/test1.c 8ae514d6a0d030f7953a99ff5dca6419cb7a5ad1a1c392d1fdf0f069e6ca792b
F src/test2.c 827446e259a3b7ab949da1542953edda7b5117982576d3e6f1c24a0dd20a5cef
F src/test3.c e5178558c41ff53236ae0271e9acb3d6885a94981d2eb939536ee6474598840e
F src/test4.c 4533b76419e7feb41b40582554663ed3cd77aaa54e135cf76b3205098cd6e664
@ -661,7 +660,7 @@ F src/test_backup.c bf5da90c9926df0a4b941f2d92825a01bbe090a0
F src/test_bestindex.c 68c62586d2ae9f032903fe53be743657d0c2aac0a850b880938b668e1161d516
F src/test_blob.c ae4a0620b478548afb67963095a7417cd06a4ec0a56adb453542203bfdcb31ce
F src/test_btree.c 8b2dc8b8848cf3a4db93f11578f075e82252a274
F src/test_config.c 8264637b06a3c1f0727c88d1ea32dcf7986b9e7e358a970cae87cdac8a5b2708
F src/test_config.c f0cc1f517deaa96dd384822ae2bb91534fa56aa458528b439830d709941d3932
F src/test_delete.c e2fe07646dff6300b48d49b2fee2fe192ed389e834dd635e3b3bac0ce0bf9f8f
F src/test_demovfs.c 38a459d1c78fd9afa770445b224c485e079018d6ac07332ff9bd07b54d2b8ce9
F src/test_devsym.c 649434ed34d0b03fbd5a6b42df80f0f9a7e53f94dd1710aad5dd8831e91c4e86
@ -677,7 +676,7 @@ F src/test_malloc.c 21121ea85b49ec0bdb69995847cef9036ef9beca3ce63bbb776e4ea2ecc4
F src/test_md5.c 0472c86d561f7f9e4ff94080100c2783196f50e583bb83375b759450c5b81802
F src/test_multiplex.c 70479161239d65af2a231550b270e9d11ece717ad7bf0e13ef42206586e9dd7f
F src/test_multiplex.h f0ff5b6f4462bfd46dac165d6375b9530d08089b7bcbe75e88e0926110db5363
F src/test_mutex.c abf486e91bd65e2448027d4bb505e7cce6ba110e1afb9bd348d1996961cadf0d
F src/test_mutex.c cd5bac43f2fd168f43c4326b1febe0966439217fac52afb270a6b8215f94cb40
F src/test_onefile.c f31e52e891c5fef6709b9fcef54ce660648a34172423a9cbdf4cbce3ba0049f4
F src/test_osinst.c d341f9d7613e007c8c3f7eba6cd307230047506aa8f97858c1fd21f5069616bd
F src/test_pcache.c 3960cd2c1350adc992c4bf7adcfb0d1ac0574733012bd1a5f94e195928577599
@ -702,7 +701,7 @@ F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c
F src/tokenize.c 1305797eab3542a0896b552c6e7669c972c1468e11e92b370533c1f37a37082b
F src/treeview.c 1d52fbc4e97161e65858d36e3424ea6e3fc045dd8a679c82b4b9593dc30de3bd
F src/trigger.c ad6ab9452715fa9a8075442e15196022275b414b9141b566af8cdb7a1605f2b0
F src/update.c 88f30d38409ddcd2d583bef1a1265a3e8c701e232096505183680b2027439a00
F src/update.c 9fa127b8f13d39440996fdfa2323eeb1b565aba7b09ef820114ad2e77c25bdf1
F src/upsert.c 5303dc6c518fa7d4b280ec65170f465c7a70b7ac2b22491598f6d0b4875b3145
F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0
F src/util.c 6f9d2f278dcc8d41c618980cd3cfe88e1bafc0626209b917c6773d8202d29ef6
@ -711,22 +710,22 @@ F src/vdbe.c c3b6d8d60f2bb89ae771326f48945b8549f68c8f9a573e026b77b444f3d7d32e
F src/vdbe.h 41485521f68e9437fdb7ec4a90f9d86ab294e9bb8281e33b235915e29122cfc0
F src/vdbeInt.h 7bd49eef8f89c1a271fbf12d80a206bf56c876814c5fc6bee340f4e1907095ae
F src/vdbeapi.c de9703f8705afc393cc2864669ce28cf9516983c8331d59aa2b978de01634365
F src/vdbeaux.c 998e84345fe712e4ab3f28556daefe174e106ae0439faa7bec9f0ca674b3b276
F src/vdbeaux.c 5a0950d8ebdfc948a016c2bc790e9c45f03c0f8db30cf8f2be011fe5e8a28899
F src/vdbeblob.c 2516697b3ee8154eb8915f29466fb5d4f1ae39ee8b755ea909cefaf57ec5e2ce
F src/vdbemem.c 1cac4028c0dabbf1f3259f107440e2780e05ac9fe419e9709e6eb4e166ba714b
F src/vdbesort.c a0d71c5eb15e4da6eae6eea69c482762266adaf34551827d1f77bb49aa90ffed
F src/vdbesort.c 0d40dca073c94e158ead752ef4225f4fee22dee84145e8c00ca2309afb489015
F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf823
F src/vdbevtab.c aae4bd769410eb7e1d02c42613eec961d514459b1c3c1c63cfc84e92a137daac
F src/vtab.c 1ecf8c3745d29275688d583e12822fa984d421e0286b5ef50c137bc3bf6d7a64
F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
F src/wal.c 7dbb27213acbc57819d97953e8434283b751cc5307a21b8847f664de45dc3307
F src/wal.c cbfeeb7415baa545efa244dd34bb5af4ae953a206fed720c6fa7f1ef763ec122
F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
F src/walker.c 1f1c4743e064873efff71509d8839d9f7509b8960699aa2eeb906dec41a0f667
F src/where.c efb828cc5f42634918902d352644bb3ddce672930e19859c80748810b29d4b8b
F src/where.c 2dc708cf8b6a691fb79f16bbc46567497ee6f991043318d421e294b2da114d93
F src/whereInt.h c7d19902863beadec1d04e66aca39c0bcd60b74f05f0eaa7422c7005dfc5d51a
F src/wherecode.c bff0bc56cb1a382de266c2db3a691135c18a4360b6ad5e069e5c415d57eb0c38
F src/whereexpr.c f0a29594a2c143e10af7adf513b32d11223d76c6981c7f428433ec1ccbc33f84
F src/window.c e25c9c675a56b65c05102f592b895e8b0931a888f88bc66ece7c73cbd2226259
F src/window.c b7ad9cff3ce8ae6f8cc25e18e1a258426cb6bd2999aace6f5248d781b2a74098
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
F test/affinity2.test ce1aafc86e110685b324e9a763eab4f2a73f737842ec3b687bd965867de90627
F test/affinity3.test f094773025eddf31135c7ad4cde722b7696f8eb07b97511f98585addf2a510a9
@ -1015,40 +1014,6 @@ F test/fkey_malloc.test 594a7ea1fbab553c036c70813cd8bd9407d63749
F test/fordelete.test ba98f14446b310f9c9d935b97ec748753d0144a28b356ba30d1f4f6958fdde5c
F test/format4.test eeae341953db8b6bda7f549044797c3278a6cc345d11ada81471671b654f8ef4
F test/fts-9fd058691.test 78b887e30ae6816df0e1fed6259de4b5a64ad33c
F test/fts1a.test 46090311f85da51bb33bd5ce84f7948359c6d8d7
F test/fts1b.test 5d8a01aefbecc8b7442b36c94c05eb7a845462d5
F test/fts1c.test 85a525ce7428907469b4cce13d5563ce542ce64c
F test/fts1d.test a73deace5c18df4a549b12908bade4f05dcf1a2f
F test/fts1e.test 77244843e925560b5a0b70069c3e7ab62f181ed2
F test/fts1f.test 2d6cb10d8b7a4e6edc321bbdb3982f1f48774714
F test/fts1i.test 6bfe08cdfdced063a39a50c8601da65e6274d879
F test/fts1j.test e3797475796043a161e348c46a309664cac83f7f
F test/fts1k.test 65d3b41487b9f738d11b0f00eca375c0ca6bd970
F test/fts1l.test 15c119ed2362b2b28d5300c0540a6a43eab66c36
F test/fts1m.test 2d9ca67b095d49f037a914087cc0a61e89da4f0c
F test/fts1n.test a2317dcd27b1d087ee3878b30e0a59c593c98b7a
F test/fts1o.test d1554caede42bba2c82fe613bcc921856c196b752449ead0470fac52a20fd3b8
F test/fts1porter.test d86e9c3e0c7f8ff95add6582b4b585fb4e02b96d
F test/fts2.test e3fb95f96a650411574efc136f3fb10eef479ed7
F test/fts2a.test 473a5c8b473a4e21a8e3fddaed1e59666e0c6ab7
F test/fts2b.test 964abc0236c849c07ca1ae496bb25c268ae94816
F test/fts2c.test ffb5a35230ac72c4354535c547965ce6824537c0
F test/fts2d.test b7eaa671ca9a16997f3e5b158ee777ae21052b0b
F test/fts2e.test 2da13dbc2d009105f42196845c1e1ce136c03d38
F test/fts2f.test cf84096235991709c1e61caa389632aa0a4f976d
F test/fts2g.test 3d26fe171bda6133ebf5a380731d70eaa2ef2f6f73d79769cf8946e622b6d597
F test/fts2h.test 223af921323b409d4b5b18ff4e51619541b174bb
F test/fts2i.test 1b22451d1f13f7c509baec620dc3a4a754885dd6
F test/fts2j.test 298fa1670aa21cd445b282d139b70c72e7ade12b
F test/fts2k.test c7ebf4a4937594aa07459e3e1bca1251c1be8659
F test/fts2l.test 3333336621524cf7d60bb62d6ef6ab69647866ed
F test/fts2m.test 4b30142ead6f3ed076e880a2a464064c5ad58c51
F test/fts2n.test 12b9c5352128cebd1c6b8395e43788d4b09087c2
F test/fts2o.test 4054ac7433eb5440f1b1d200cfa449342dc4aabd991759139813e17c73e5bf9a
F test/fts2p.test 4b48c35c91e6a7dbf5ac8d1e5691823cc999aafb
F test/fts2q.test b2fbbe038b7a31a52a6079b215e71226d8c6a682
F test/fts2r.test b154c30b63061d8725e320fba1a39e2201cadd5e
F test/fts2token.test d8070b241a15ff13592a9ae4a8b7c171af6f445a
F test/fts3.test 672a040ea57036fb4b6fdc09027c18d7d24ab654
F test/fts3_common.tcl dffad248f9ce090800e272017d2898005c28ee6314fc1dd5550643a02666907a
F test/fts3aa.test 814d60a1ba30b4a71d8f9306a6564bc7b636dd6efacd2ad80306f9b23ef3ebee
@ -1974,7 +1939,7 @@ F tool/build-all-msvc.bat c817b716e0edeecaf265a6775b63e5f45c34a6544f1d4114a22270
F tool/build-shell.sh 950f47c6174f1eea171319438b93ba67ff5bf367
F tool/cg_anno.tcl c1f875f5a4c9caca3d59937b16aff716f8b1883935f1b4c9ae23124705bc8099 x
F tool/checkSpacing.c 810e51703529a204fc4e1eb060e9ab663e3c06d2
F tool/custom.txt 7c5402073801047526d59d9ecd770e7bcd8f9e553bc7278ab2b0ac6fac96ad32
F tool/custom.txt 6cdf298f43e1db4bb91406d14777669b8fb1df790837823fa6754c4308decc27
F tool/dbhash.c 5da0c61032d23d74f2ab84ffc5740f0e8abec94f2c45c0b4306be7eb3ae96df0
F tool/dbtotxt.c ca48d34eaca6d6b6e4bd6a7be2b72caf34475869054240244c60fa7e69a518d6
F tool/dbtotxt.md c9a57af8739957ef36d2cfad5c4b1443ff3688ed33e4901ee200c8b651f43f3c
@ -2075,11 +2040,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 2d58c77448cfaaf12887b60bcfea039d3410a750ac8955a817c45be85c00eb9e
R 59cd5de4738b59306e8e563e728e2e6a
T *branch * spell-check
T *sym-spell-check *
T -sym-trunk *
P 26c1bb4bd9e9f56613c3aa87407a7f562fd4ebde5bfd6dece02078001d9a45f8 9a12bac5d24c7a8364d2127fd12c3409a53ef83e408d10f344ddd311cdba98af
R afa3749bf57be03443dd9fb9514c3cf7
U larrybr
Z 571f9428e6a0b3c7f2d392953641b395
Z 9fc49c02f88a65acb6e01a072053f268
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
26c1bb4bd9e9f56613c3aa87407a7f562fd4ebde5bfd6dece02078001d9a45f8
8c291d99946eb32b20b743921202f9c7cfb716268ff526817b27adbb7942e40b

32
mkso.sh
View File

@ -1,32 +0,0 @@
#!/bin/sh
#
# This script is used to compile SQLite into a shared library on Linux.
#
# Two separate shared libraries are generated. "sqlite3.so" is the core
# library. "tclsqlite3.so" contains the TCL bindings and is the
# library that is loaded into TCL in order to run SQLite.
#
make target_source
cd tsrc
rm shell.c
TCLDIR=/home/drh/tcltk/846/linux/846linux
TCLSTUBLIB=$TCLDIR/libtclstub8.4g.a
OPTS='-DUSE_TCL_STUBS=1 -DNDEBUG=1 -DHAVE_DLOPEN=1'
OPTS="$OPTS -DSQLITE_THREADSAFE=1"
OPTS="$OPTS -DSQLITE_ENABLE_FTS3=1"
OPTS="$OPTS -DSQLITE_ENABLE_COLUMN_METADATA=1"
for i in *.c; do
if test $i != 'keywordhash.c'; then
CMD="cc -fPIC $OPTS -O2 -I. -I$TCLDIR -c $i"
echo $CMD
$CMD
fi
done
echo gcc -shared *.o $TCLSTUBLIB -o tclsqlite3.so
gcc -shared *.o $TCLSTUBLIB -o tclsqlite3.so
strip tclsqlite3.so
rm tclsqlite.c tclsqlite.o
echo gcc -shared *.o -o sqlite3.so
gcc -shared *.o -o sqlite3.so
strip sqlite3.so
cd ..

View File

@ -9071,7 +9071,7 @@ static int btreeOverwriteContent(
){
int nData = pX->nData - iOffset;
if( nData<=0 ){
/* Overwritting with zeros */
/* Overwriting with zeros */
int i;
for(i=0; i<iAmt && pDest[i]==0; i++){}
if( i<iAmt ){
@ -9107,7 +9107,7 @@ static int btreeOverwriteContent(
** cell.
*/
static SQLITE_NOINLINE int btreeOverwriteOverflowCell(
BtCursor *pCur, /* Cursor pointing to cell to ovewrite */
BtCursor *pCur, /* Cursor pointing to cell to overwrite */
const BtreePayload *pX /* Content to write into the cell */
){
int iOffset; /* Next byte of pX->pData to write */

View File

@ -2082,7 +2082,7 @@ static int identLength(const char *z){
** to the specified offset in the buffer and updates *pIdx to refer
** to the first byte after the last byte written before returning.
**
** If the string zSignedIdent consists entirely of alpha-numeric
** If the string zSignedIdent consists entirely of alphanumeric
** characters, does not begin with a digit and is not an SQL keyword,
** then it is copied to the output buffer exactly as it is. Otherwise,
** it is quoted using double-quotes.

View File

@ -1238,7 +1238,7 @@ static void dateFunc(
** %M minute 00-59
** %s seconds since 1970-01-01
** %S seconds 00-59
** %w day of week 0-6 sunday==0
** %w day of week 0-6 Sunday==0
** %W week of year 00-53
** %Y year 0000-9999
** %% %

View File

@ -268,7 +268,7 @@ Expr *sqlite3LimitWhere(
pOrderBy,0,pLimit
);
/* now generate the new WHERE rowid IN clause for the DELETE/UDPATE */
/* now generate the new WHERE rowid IN clause for the DELETE/UPDATE */
pInClause = sqlite3PExpr(pParse, TK_IN, pLhs, 0);
sqlite3PExprAddSelect(pParse, pInClause, pSelect);
return pInClause;

View File

@ -2785,7 +2785,7 @@ static int sqlite3InRhsIsConstant(Expr *pIn){
** IN_INDEX_INDEX_ASC - The cursor was opened on an ascending index.
** IN_INDEX_INDEX_DESC - The cursor was opened on a descending index.
** IN_INDEX_EPH - The cursor was opened on a specially created and
** populated epheremal table.
** populated ephemeral table.
** IN_INDEX_NOOP - No cursor was allocated. The IN operator must be
** implemented as a sequence of comparisons.
**
@ -2810,12 +2810,12 @@ static int sqlite3InRhsIsConstant(Expr *pIn){
**
** When IN_INDEX_LOOP is used (and the b-tree will be used to iterate
** through the set members) then the b-tree must not contain duplicates.
** An epheremal table will be created unless the selected columns are guaranteed
** An ephemeral table will be created unless the selected columns are guaranteed
** to be unique - either because it is an INTEGER PRIMARY KEY or due to
** a UNIQUE constraint or index.
**
** When IN_INDEX_MEMBERSHIP is used (and the b-tree will be used
** for fast set membership tests) then an epheremal table must
** for fast set membership tests) then an ephemeral table must
** be used unless <columns> is a single INTEGER PRIMARY KEY column or an
** index can be found with the specified <columns> as its left-most.
**
@ -4307,7 +4307,7 @@ expr_code_doover:
if( ExprHasProperty(pExpr, EP_FixedCol) ){
/* This COLUMN expression is really a constant due to WHERE clause
** constraints, and that constant is coded by the pExpr->pLeft
** expresssion. However, make sure the constant has the correct
** expression. However, make sure the constant has the correct
** datatype by applying the Affinity of the table column to the
** constant.
*/
@ -5991,7 +5991,7 @@ int sqlite3ExprImpliesExpr(
return 0;
}
/* This is a helper functino to impliesNotNullRow(). In this routine,
/* This is a helper function to impliesNotNullRow(). In this routine,
** set pWalker->eCode to one only if *both* of the input expressions
** separately have the implies-not-null-row property.
*/

View File

@ -858,7 +858,7 @@ int sqlite3_like_count = 0;
/*
** Implementation of the like() SQL function. This function implements
** the build-in LIKE operator. The first argument to the function is the
** the built-in LIKE operator. The first argument to the function is the
** pattern and the second argument is the string. So, the SQL statements:
**
** A LIKE B
@ -1244,7 +1244,7 @@ static int strContainsChar(const u8 *zStr, int nStr, u32 ch){
** decoded and returned as a blob.
**
** If there is only a single argument, then it must consist only of an
** even number of hexadeximal digits. Otherwise, return NULL.
** even number of hexadecimal digits. Otherwise, return NULL.
**
** Or, if there is a second argument, then any character that appears in
** the second argument is also allowed to appear between pairs of hexadecimal

View File

@ -2700,7 +2700,7 @@ static void jsonGroupInverse(
pStr = (JsonString*)sqlite3_aggregate_context(ctx, 0);
#ifdef NEVER
/* pStr is always non-NULL since jsonArrayStep() or jsonObjectStep() will
** always have been called to initalize it */
** always have been called to initialize it */
if( NEVER(!pStr) ) return;
#endif
z = pStr->zBuf;

View File

@ -41,12 +41,6 @@ static int sqlite3TestExtInit(sqlite3 *db){
** Forward declarations of external module initializer functions
** for modules that need them.
*/
#ifdef SQLITE_ENABLE_FTS1
int sqlite3Fts1Init(sqlite3*);
#endif
#ifdef SQLITE_ENABLE_FTS2
int sqlite3Fts2Init(sqlite3*);
#endif
#ifdef SQLITE_ENABLE_FTS5
int sqlite3Fts5Init(sqlite3*);
#endif
@ -59,12 +53,6 @@ int sqlite3StmtVtabInit(sqlite3*);
** built-in extensions.
*/
static int (*const sqlite3BuiltinExtensions[])(sqlite3*) = {
#ifdef SQLITE_ENABLE_FTS1
sqlite3Fts1Init,
#endif
#ifdef SQLITE_ENABLE_FTS2
sqlite3Fts2Init,
#endif
#ifdef SQLITE_ENABLE_FTS3
sqlite3Fts3Init,
#endif

View File

@ -5021,7 +5021,7 @@ act_like_temp_file:
/*
** Return the sqlite3_file for the main database given the name
** of the corresonding WAL or Journal name as passed into
** of the corresponding WAL or Journal name as passed into
** xOpen.
*/
sqlite3_file *sqlite3_database_file_object(const char *zName){

View File

@ -15,7 +15,7 @@
** The canonical source code to this file ("parse.y") is a Lemon grammar
** file that specifies the input grammar and actions to take while parsing.
** That input file is processed by Lemon to generate a C-language
** implementation of a parser for the given grammer. You might be reading
** implementation of a parser for the given grammar. You might be reading
** this comment as part of the translated C-code. Edits should be made
** to the original parse.y sources.
*/
@ -267,7 +267,7 @@ columnname(A) ::= nm(A) typetoken(Y). {sqlite3AddColumn(pParse,A,Y);}
%wildcard ANY.
// Define operator precedence early so that this is the first occurrence
// of the operator tokens in the grammer. Keeping the operators together
// of the operator tokens in the grammar. Keeping the operators together
// causes them to be assigned integer values that are close together,
// which keeps parser tables smaller.
//

View File

@ -1632,7 +1632,7 @@ void sqlite3Pragma(
** The "quick_check" is reduced version of
** integrity_check designed to detect most database corruption
** without the overhead of cross-checking indexes. Quick_check
** is linear time wherease integrity_check is O(NlogN).
** is linear time whereas integrity_check is O(NlogN).
**
** The maximum number of errors is 100 by default. A different default
** can be specified using a numeric parameter N.

View File

@ -869,7 +869,7 @@ static void codeOffset(
** The returned value in this case is a copy of parameter iTab.
**
** WHERE_DISTINCT_ORDERED:
** In this case rows are being delivered sorted order. The ephermal
** In this case rows are being delivered sorted order. The ephemeral
** table is not required. Instead, the current set of values
** is compared against previous row. If they match, the new row
** is not distinct and control jumps to VM address addrRepeat. Otherwise,
@ -4723,8 +4723,7 @@ static int flattenSubquery(
}
}
/* Finially, delete what is left of the subquery and return
** success.
/* Finally, delete what is left of the subquery and return success.
*/
sqlite3AggInfoPersistWalkerInit(&w, pParse);
sqlite3WalkSelect(&w,pSub1);

View File

@ -1424,7 +1424,7 @@ struct ShellState {
u8 bSafeModePersist; /* The long-term value of bSafeMode */
ColModeOpts cmOpts; /* Option values affecting columnar mode output */
unsigned statsOn; /* True to display memory stats before each finalize */
unsigned mEqpLines; /* Mask of veritical lines in the EQP output graph */
unsigned mEqpLines; /* Mask of vertical lines in the EQP output graph */
int inputNesting; /* Track nesting level of .read and other redirects */
int outCount; /* Revert to stdout when reaching zero */
int cnt; /* Number of records displayed so far */
@ -3454,7 +3454,7 @@ static void explain_data_prepare(ShellState *p, sqlite3_stmt *pSql){
/* Grow the p->aiIndent array as required */
if( iOp>=nAlloc ){
if( iOp==0 ){
/* Do further verfication that this is explain output. Abort if
/* Do further verification that this is explain output. Abort if
** it is not */
static const char *explainCols[] = {
"addr", "opcode", "p1", "p2", "p3", "p4", "p5", "comment" };
@ -4023,7 +4023,7 @@ columnar_end:
*/
static void exec_prepared_stmt(
ShellState *pArg, /* Pointer to ShellState */
sqlite3_stmt *pStmt /* Statment to run */
sqlite3_stmt *pStmt /* Statement to run */
){
int rc;
sqlite3_uint64 nRow = 0;
@ -4282,7 +4282,7 @@ static int shell_exec(
if( zStmtSql==0 ) zStmtSql = "";
while( IsSpace(zStmtSql[0]) ) zStmtSql++;
/* save off the prepared statment handle and reset row count */
/* save off the prepared statement handle and reset row count */
if( pArg ){
pArg->pStmt = pStmt;
pArg->cnt = 0;

View File

@ -9632,7 +9632,7 @@ int sqlite3_vtab_config(sqlite3*, int op, ...);
** [[SQLITE_VTAB_DIRECTONLY]]<dt>SQLITE_VTAB_DIRECTONLY</dt>
** <dd>Calls of the form
** [sqlite3_vtab_config](db,SQLITE_VTAB_DIRECTONLY) from within the
** the [xConnect] or [xCreate] methods of a [virtual table] implmentation
** the [xConnect] or [xCreate] methods of a [virtual table] implementation
** prohibits that virtual table from being used from within triggers and
** views.
** </dd>

View File

@ -3459,10 +3459,10 @@ bad_args:
/*
** Usage: sqlite3_test_errstr <err code>
**
** Test that the english language string equivalents for sqlite error codes
** Test that the English language string equivalents for sqlite error codes
** are sane. The parameter is an integer representing an sqlite error code.
** The result is a list of two elements, the string representation of the
** error code and the english language explanation.
** error code and the English language explanation.
*/
static int SQLITE_TCLAPI test_errstr(
void * clientData,

View File

@ -408,18 +408,6 @@ static void set_options(Tcl_Interp *interp){
Tcl_SetVar2(interp, "sqlite_options", "foreignkey", "1", TCL_GLOBAL_ONLY);
#endif
#ifdef SQLITE_ENABLE_FTS1
Tcl_SetVar2(interp, "sqlite_options", "fts1", "1", TCL_GLOBAL_ONLY);
#else
Tcl_SetVar2(interp, "sqlite_options", "fts1", "0", TCL_GLOBAL_ONLY);
#endif
#ifdef SQLITE_ENABLE_FTS2
Tcl_SetVar2(interp, "sqlite_options", "fts2", "1", TCL_GLOBAL_ONLY);
#else
Tcl_SetVar2(interp, "sqlite_options", "fts2", "0", TCL_GLOBAL_ONLY);
#endif
#ifdef SQLITE_ENABLE_FTS3
Tcl_SetVar2(interp, "sqlite_options", "fts3", "1", TCL_GLOBAL_ONLY);
#else

View File

@ -45,7 +45,7 @@ struct sqlite3_mutex {
/* State variables */
static struct test_mutex_globals {
int isInstalled; /* True if installed */
int disableInit; /* True to cause sqlite3_initalize() to fail */
int disableInit; /* True to cause sqlite3_initialize() to fail */
int disableTry; /* True to force sqlite3_mutex_try() to fail */
int isInit; /* True if initialized */
sqlite3_mutex_methods m; /* Interface to "real" mutex system */

View File

@ -1211,7 +1211,7 @@ static void updateVirtualTable(
int nArg = 2 + pTab->nCol; /* Number of arguments to VUpdate */
int regArg; /* First register in VUpdate arg array */
int regRec; /* Register in which to assemble record */
int regRowid; /* Register for ephem table rowid */
int regRowid; /* Register for ephemeral table rowid */
int iCsr = pSrc->a[0].iCursor; /* Cursor used for virtual table scan */
int aDummy[2]; /* Unused arg for sqlite3WhereOkOnePass() */
int eOnePass; /* True to use onepass strategy */
@ -1332,7 +1332,7 @@ static void updateVirtualTable(
sqlite3WhereEnd(pWInfo);
}
/* Begin scannning through the ephemeral table. */
/* Begin scanning through the ephemeral table. */
addr = sqlite3VdbeAddOp1(v, OP_Rewind, ephemTab); VdbeCoverage(v);
/* Extract arguments from the current row of the ephemeral table and

View File

@ -1280,7 +1280,7 @@ void sqlite3VdbeJumpHereOrPopInst(Vdbe *p, int addr){
/*
** If the input FuncDef structure is ephemeral, then free it. If
** the FuncDef is not ephermal, then do nothing.
** the FuncDef is not ephemeral, then do nothing.
*/
static void freeEphemeralFunction(sqlite3 *db, FuncDef *pDef){
assert( db!=0 );

View File

@ -85,7 +85,7 @@
** The threshold for the amount of main memory to use before flushing
** records to a PMA is roughly the same as the limit configured for the
** page-cache of the main database. Specifically, the threshold is set to
** the value returned by "PRAGMA main.page_size" multipled by
** the value returned by "PRAGMA main.page_size" multiplied by
** that returned by "PRAGMA main.cache_size", in bytes.
**
** If the sorter is running in single-threaded mode, then all PMAs generated

View File

@ -2358,7 +2358,7 @@ static SQLITE_NO_TSAN int walIndexTryHdr(Wal *pWal, int *pChanged){
** give false-positive warnings about these accesses because the tools do not
** account for the double-read and the memory barrier. The use of mutexes
** here would be problematic as the memory being accessed is potentially
** shared among multiple processes and not all mutex implementions work
** shared among multiple processes and not all mutex implementations work
** reliably in that environment.
*/
aHdr = walIndexHdr(pWal);

View File

@ -2880,7 +2880,7 @@ static int whereLoopAddBtreeIndex(
Index *pProbe, /* An index on pSrc */
LogEst nInMul /* log(Number of iterations due to IN) */
){
WhereInfo *pWInfo = pBuilder->pWInfo; /* WHERE analyse context */
WhereInfo *pWInfo = pBuilder->pWInfo; /* WHERE analyze context */
Parse *pParse = pWInfo->pParse; /* Parsing context */
sqlite3 *db = pParse->db; /* Database connection malloc context */
WhereLoop *pNew; /* Template WhereLoop under construction */

View File

@ -1574,7 +1574,7 @@ struct WindowCsrAndReg {
**
** (ORDER BY a, b GROUPS BETWEEN 2 PRECEDING AND 2 FOLLOWING)
**
** The windows functions implmentation caches the input rows in a temp
** The windows functions implementation caches the input rows in a temp
** table, sorted by "a, b" (it actually populates the cache lazily, and
** aggressively removes rows once they are no longer required, but that's
** a mere detail). It keeps three cursors open on the temp table. One

View File

@ -1,186 +0,0 @@
# 2006 September 9
#
# 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. The
# focus of this script is testing the FTS1 module.
#
# $Id: fts1a.test,v 1.4 2006/09/28 19:43:32 drh Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If SQLITE_ENABLE_FTS1 is defined, omit this file.
ifcapable !fts1 {
finish_test
return
}
# Construct a full-text search table containing five keywords:
# one, two, three, four, and five, in various combinations. The
# rowid for each will be a bitmask for the elements it contains.
#
db eval {
CREATE VIRTUAL TABLE t1 USING fts1(content);
INSERT INTO t1(content) VALUES('one');
INSERT INTO t1(content) VALUES('two');
INSERT INTO t1(content) VALUES('one two');
INSERT INTO t1(content) VALUES('three');
INSERT INTO t1(content) VALUES('one three');
INSERT INTO t1(content) VALUES('two three');
INSERT INTO t1(content) VALUES('one two three');
INSERT INTO t1(content) VALUES('four');
INSERT INTO t1(content) VALUES('one four');
INSERT INTO t1(content) VALUES('two four');
INSERT INTO t1(content) VALUES('one two four');
INSERT INTO t1(content) VALUES('three four');
INSERT INTO t1(content) VALUES('one three four');
INSERT INTO t1(content) VALUES('two three four');
INSERT INTO t1(content) VALUES('one two three four');
INSERT INTO t1(content) VALUES('five');
INSERT INTO t1(content) VALUES('one five');
INSERT INTO t1(content) VALUES('two five');
INSERT INTO t1(content) VALUES('one two five');
INSERT INTO t1(content) VALUES('three five');
INSERT INTO t1(content) VALUES('one three five');
INSERT INTO t1(content) VALUES('two three five');
INSERT INTO t1(content) VALUES('one two three five');
INSERT INTO t1(content) VALUES('four five');
INSERT INTO t1(content) VALUES('one four five');
INSERT INTO t1(content) VALUES('two four five');
INSERT INTO t1(content) VALUES('one two four five');
INSERT INTO t1(content) VALUES('three four five');
INSERT INTO t1(content) VALUES('one three four five');
INSERT INTO t1(content) VALUES('two three four five');
INSERT INTO t1(content) VALUES('one two three four five');
}
do_test fts1a-1.1 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one'}
} {1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31}
do_test fts1a-1.2 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one two'}
} {3 7 11 15 19 23 27 31}
do_test fts1a-1.3 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'two one'}
} {3 7 11 15 19 23 27 31}
do_test fts1a-1.4 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one two three'}
} {7 15 23 31}
do_test fts1a-1.5 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one three two'}
} {7 15 23 31}
do_test fts1a-1.6 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'two three one'}
} {7 15 23 31}
do_test fts1a-1.7 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'two one three'}
} {7 15 23 31}
do_test fts1a-1.8 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'three one two'}
} {7 15 23 31}
do_test fts1a-1.9 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'three two one'}
} {7 15 23 31}
do_test fts1a-1.10 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one two THREE'}
} {7 15 23 31}
do_test fts1a-1.11 {
execsql {SELECT rowid FROM t1 WHERE content MATCH ' ONE Two three '}
} {7 15 23 31}
do_test fts1a-2.1 {
execsql {SELECT rowid FROM t1 WHERE content MATCH '"one"'}
} {1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31}
do_test fts1a-2.2 {
execsql {SELECT rowid FROM t1 WHERE content MATCH '"one two"'}
} {3 7 11 15 19 23 27 31}
do_test fts1a-2.3 {
execsql {SELECT rowid FROM t1 WHERE content MATCH '"two one"'}
} {}
do_test fts1a-2.4 {
execsql {SELECT rowid FROM t1 WHERE content MATCH '"one two three"'}
} {7 15 23 31}
do_test fts1a-2.5 {
execsql {SELECT rowid FROM t1 WHERE content MATCH '"one three two"'}
} {}
do_test fts1a-2.6 {
execsql {SELECT rowid FROM t1 WHERE content MATCH '"one two three four"'}
} {15 31}
do_test fts1a-2.7 {
execsql {SELECT rowid FROM t1 WHERE content MATCH '"one three two four"'}
} {}
do_test fts1a-2.8 {
execsql {SELECT rowid FROM t1 WHERE content MATCH '"one three five"'}
} {21}
do_test fts1a-2.9 {
execsql {SELECT rowid FROM t1 WHERE content MATCH '"one three" five'}
} {21 29}
do_test fts1a-2.10 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'five "one three"'}
} {21 29}
do_test fts1a-2.11 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'five "one three" four'}
} {29}
do_test fts1a-2.12 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'five four "one three"'}
} {29}
do_test fts1a-2.13 {
execsql {SELECT rowid FROM t1 WHERE content MATCH '"one three" four five'}
} {29}
do_test fts1a-3.1 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one'}
} {1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31}
do_test fts1a-3.2 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one -two'}
} {1 5 9 13 17 21 25 29}
do_test fts1a-3.3 {
execsql {SELECT rowid FROM t1 WHERE content MATCH '-two one'}
} {1 5 9 13 17 21 25 29}
do_test fts1a-4.1 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one OR two'}
} {1 2 3 5 6 7 9 10 11 13 14 15 17 18 19 21 22 23 25 26 27 29 30 31}
do_test fts1a-4.2 {
execsql {SELECT rowid FROM t1 WHERE content MATCH '"one two" OR three'}
} {3 4 5 6 7 11 12 13 14 15 19 20 21 22 23 27 28 29 30 31}
do_test fts1a-4.3 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'three OR "one two"'}
} {3 4 5 6 7 11 12 13 14 15 19 20 21 22 23 27 28 29 30 31}
do_test fts1a-4.4 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one two OR three'}
} {3 5 7 11 13 15 19 21 23 27 29 31}
do_test fts1a-4.5 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'three OR two one'}
} {3 5 7 11 13 15 19 21 23 27 29 31}
do_test fts1a-4.6 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one two OR three OR four'}
} {3 5 7 9 11 13 15 19 21 23 25 27 29 31}
do_test fts1a-4.7 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'two OR three OR four one'}
} {3 5 7 9 11 13 15 19 21 23 25 27 29 31}
# Test the ability to handle NULL content
#
do_test fts1a-5.1 {
execsql {INSERT INTO t1(content) VALUES(NULL)}
} {}
do_test fts1a-5.2 {
set rowid [db last_insert_rowid]
execsql {SELECT content FROM t1 WHERE rowid=$rowid}
} {{}}
do_test fts1a-5.3 {
execsql {SELECT rowid FROM t1 WHERE content MATCH NULL}
} {}
finish_test

View File

@ -1,147 +0,0 @@
# 2006 September 13
#
# 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. The
# focus of this script is testing the FTS1 module.
#
# $Id: fts1b.test,v 1.4 2006/09/18 02:12:48 drh Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If SQLITE_ENABLE_FTS1 is defined, omit this file.
ifcapable !fts1 {
finish_test
return
}
# Fill the full-text index "t1" with phrases in english, spanish,
# and german. For the i-th row, fill in the names for the bits
# that are set in the value of i. The least significant bit is
# 1. For example, the value 5 is 101 in binary which will be
# converted to "one three" in english.
#
proc fill_multilanguage_fulltext_t1 {} {
set english {one two three four five}
set spanish {un dos tres cuatro cinco}
set german {eine zwei drei vier funf}
for {set i 1} {$i<=31} {incr i} {
set cmd "INSERT INTO t1 VALUES"
set vset {}
foreach lang {english spanish german} {
set words {}
for {set j 0; set k 1} {$j<5} {incr j; incr k $k} {
if {$k&$i} {lappend words [lindex [set $lang] $j]}
}
lappend vset "'$words'"
}
set sql "INSERT INTO t1(english,spanish,german) VALUES([join $vset ,])"
# puts $sql
db eval $sql
}
}
# Construct a full-text search table containing five keywords:
# one, two, three, four, and five, in various combinations. The
# rowid for each will be a bitmask for the elements it contains.
#
db eval {
CREATE VIRTUAL TABLE t1 USING fts1(english,spanish,german);
}
fill_multilanguage_fulltext_t1
do_test fts1b-1.1 {
execsql {SELECT rowid FROM t1 WHERE english MATCH 'one'}
} {1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31}
do_test fts1b-1.2 {
execsql {SELECT rowid FROM t1 WHERE spanish MATCH 'one'}
} {}
do_test fts1b-1.3 {
execsql {SELECT rowid FROM t1 WHERE german MATCH 'one'}
} {}
do_test fts1b-1.4 {
execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'one'}
} {1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31}
do_test fts1b-1.5 {
execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'one dos drei'}
} {7 15 23 31}
do_test fts1b-1.6 {
execsql {SELECT english, spanish, german FROM t1 WHERE rowid=1}
} {one un eine}
do_test fts1b-1.7 {
execsql {SELECT rowid FROM t1 WHERE t1 MATCH '"one un"'}
} {}
do_test fts1b-2.1 {
execsql {
CREATE VIRTUAL TABLE t2 USING fts1(from,to);
INSERT INTO t2([from],[to]) VALUES ('one two three', 'four five six');
SELECT [from], [to] FROM t2
}
} {{one two three} {four five six}}
# Compute an SQL string that contains the words one, two, three,... to
# describe bits set in the value $i. Only the lower 5 bits are examined.
#
proc wordset {i} {
set x {}
for {set j 0; set k 1} {$j<5} {incr j; incr k $k} {
if {$k&$i} {lappend x [lindex {one two three four five} $j]}
}
return '$x'
}
# Create a new FTS table with three columns:
#
# norm: words for the bits of rowid
# plusone: words for the bits of rowid+1
# invert: words for the bits of ~rowid
#
db eval {
CREATE VIRTUAL TABLE t4 USING fts1([norm],'plusone',"invert");
}
for {set i 1} {$i<=15} {incr i} {
set vset [list [wordset $i] [wordset [expr {$i+1}]] [wordset [expr {~$i}]]]
db eval "INSERT INTO t4(norm,plusone,invert) VALUES([join $vset ,]);"
}
do_test fts1b-4.1 {
execsql {SELECT rowid FROM t4 WHERE t4 MATCH 'norm:one'}
} {1 3 5 7 9 11 13 15}
do_test fts1b-4.2 {
execsql {SELECT rowid FROM t4 WHERE norm MATCH 'one'}
} {1 3 5 7 9 11 13 15}
do_test fts1b-4.3 {
execsql {SELECT rowid FROM t4 WHERE t4 MATCH 'one'}
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15}
do_test fts1b-4.4 {
execsql {SELECT rowid FROM t4 WHERE t4 MATCH 'plusone:one'}
} {2 4 6 8 10 12 14}
do_test fts1b-4.5 {
execsql {SELECT rowid FROM t4 WHERE plusone MATCH 'one'}
} {2 4 6 8 10 12 14}
do_test fts1b-4.6 {
execsql {SELECT rowid FROM t4 WHERE t4 MATCH 'norm:one plusone:two'}
} {1 5 9 13}
do_test fts1b-4.7 {
execsql {SELECT rowid FROM t4 WHERE t4 MATCH 'norm:one two'}
} {1 3 5 7 9 11 13 15}
do_test fts1b-4.8 {
execsql {SELECT rowid FROM t4 WHERE t4 MATCH 'plusone:two norm:one'}
} {1 5 9 13}
do_test fts1b-4.9 {
execsql {SELECT rowid FROM t4 WHERE t4 MATCH 'two norm:one'}
} {1 3 5 7 9 11 13 15}
finish_test

File diff suppressed because it is too large Load Diff

View File

@ -1,65 +0,0 @@
# 2006 October 1
#
# 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. The
# focus of this script is testing the FTS1 module, and in particular
# the Porter stemmer.
#
# $Id: fts1d.test,v 1.1 2006/10/01 18:41:21 drh Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If SQLITE_ENABLE_FTS1 is defined, omit this file.
ifcapable !fts1 {
finish_test
return
}
do_test fts1d-1.1 {
execsql {
CREATE VIRTUAL TABLE t1 USING fts1(content, tokenize porter);
INSERT INTO t1(rowid, content) VALUES(1, 'running and jumping');
SELECT rowid FROM t1 WHERE content MATCH 'run jump';
}
} {1}
do_test fts1d-1.2 {
execsql {
SELECT snippet(t1) FROM t1 WHERE t1 MATCH 'run jump';
}
} {{<b>running</b> and <b>jumping</b>}}
do_test fts1d-1.3 {
execsql {
INSERT INTO t1(rowid, content)
VALUES(2, 'abcdefghijklmnopqrstuvwyxz');
SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH 'abcdefghijqrstuvwyxz'
}
} {2 <b>abcdefghijklmnopqrstuvwyxz</b>}
do_test fts1d-1.4 {
execsql {
SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH 'abcdefghijXXXXqrstuvwyxz'
}
} {2 <b>abcdefghijklmnopqrstuvwyxz</b>}
do_test fts1d-1.5 {
execsql {
INSERT INTO t1(rowid, content)
VALUES(3, 'The value is 123456789');
SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH '123789'
}
} {3 {The value is <b>123456789</b>}}
do_test fts1d-1.6 {
execsql {
SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH '123000000789'
}
} {3 {The value is <b>123456789</b>}}
finish_test

View File

@ -1,85 +0,0 @@
# 2006 October 19
#
# The author disclaims copyright to this source code.
#
#*************************************************************************
# This file implements regression tests for SQLite library. The
# focus of this script is testing deletions in the FTS1 module.
#
# $Id: fts1e.test,v 1.1 2006/10/19 23:28:35 shess Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If SQLITE_ENABLE_FTS1 is defined, omit this file.
ifcapable !fts1 {
finish_test
return
}
# Construct a full-text search table containing keywords which are the
# ordinal numbers of the bit positions set for a sequence of integers,
# which are used for the rowid. There are a total of 30 INSERT and
# DELETE statements, so that we'll test both the segmentMerge() merge
# (over the first 16) and the termSelect() merge (over the level-1
# segment and 14 level-0 segments).
db eval {
CREATE VIRTUAL TABLE t1 USING fts1(content);
INSERT INTO t1 (rowid, content) VALUES(1, 'one');
INSERT INTO t1 (rowid, content) VALUES(2, 'two');
INSERT INTO t1 (rowid, content) VALUES(3, 'one two');
INSERT INTO t1 (rowid, content) VALUES(4, 'three');
DELETE FROM t1 WHERE rowid = 1;
INSERT INTO t1 (rowid, content) VALUES(5, 'one three');
INSERT INTO t1 (rowid, content) VALUES(6, 'two three');
INSERT INTO t1 (rowid, content) VALUES(7, 'one two three');
DELETE FROM t1 WHERE rowid = 4;
INSERT INTO t1 (rowid, content) VALUES(8, 'four');
INSERT INTO t1 (rowid, content) VALUES(9, 'one four');
INSERT INTO t1 (rowid, content) VALUES(10, 'two four');
DELETE FROM t1 WHERE rowid = 7;
INSERT INTO t1 (rowid, content) VALUES(11, 'one two four');
INSERT INTO t1 (rowid, content) VALUES(12, 'three four');
INSERT INTO t1 (rowid, content) VALUES(13, 'one three four');
DELETE FROM t1 WHERE rowid = 10;
INSERT INTO t1 (rowid, content) VALUES(14, 'two three four');
INSERT INTO t1 (rowid, content) VALUES(15, 'one two three four');
INSERT INTO t1 (rowid, content) VALUES(16, 'five');
DELETE FROM t1 WHERE rowid = 13;
INSERT INTO t1 (rowid, content) VALUES(17, 'one five');
INSERT INTO t1 (rowid, content) VALUES(18, 'two five');
INSERT INTO t1 (rowid, content) VALUES(19, 'one two five');
DELETE FROM t1 WHERE rowid = 16;
INSERT INTO t1 (rowid, content) VALUES(20, 'three five');
INSERT INTO t1 (rowid, content) VALUES(21, 'one three five');
INSERT INTO t1 (rowid, content) VALUES(22, 'two three five');
DELETE FROM t1 WHERE rowid = 19;
DELETE FROM t1 WHERE rowid = 22;
}
do_test fts1f-1.1 {
execsql {SELECT COUNT(*) FROM t1}
} {14}
do_test fts1e-2.1 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one'}
} {3 5 9 11 15 17 21}
do_test fts1e-2.2 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'two'}
} {2 3 6 11 14 15 18}
do_test fts1e-2.3 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'three'}
} {5 6 12 14 15 20 21}
do_test fts1e-2.4 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'four'}
} {8 9 11 12 14 15}
do_test fts1e-2.5 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'five'}
} {17 18 20 21}
finish_test

View File

@ -1,90 +0,0 @@
# 2006 October 19
#
# The author disclaims copyright to this source code.
#
#*************************************************************************
# This file implements regression tests for SQLite library. The
# focus of this script is testing updates in the FTS1 module.
#
# $Id: fts1f.test,v 1.2 2007/02/23 00:14:06 shess Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If SQLITE_ENABLE_FTS1 is defined, omit this file.
ifcapable !fts1 {
finish_test
return
}
# Construct a full-text search table containing keywords which are the
# ordinal numbers of the bit positions set for a sequence of integers,
# which are used for the rowid. There are a total of 31 INSERT,
# UPDATE, and DELETE statements, so that we'll test both the
# segmentMerge() merge (over the first 16) and the termSelect() merge
# (over the level-1 segment and 15 level-0 segments).
db eval {
CREATE VIRTUAL TABLE t1 USING fts1(content);
INSERT INTO t1 (rowid, content) VALUES(1, 'one');
INSERT INTO t1 (rowid, content) VALUES(2, 'two');
INSERT INTO t1 (rowid, content) VALUES(3, 'one two');
INSERT INTO t1 (rowid, content) VALUES(4, 'three');
INSERT INTO t1 (rowid, content) VALUES(5, 'one three');
INSERT INTO t1 (rowid, content) VALUES(6, 'two three');
INSERT INTO t1 (rowid, content) VALUES(7, 'one two three');
DELETE FROM t1 WHERE rowid = 4;
INSERT INTO t1 (rowid, content) VALUES(8, 'four');
UPDATE t1 SET content = 'update one three' WHERE rowid = 1;
INSERT INTO t1 (rowid, content) VALUES(9, 'one four');
INSERT INTO t1 (rowid, content) VALUES(10, 'two four');
DELETE FROM t1 WHERE rowid = 7;
INSERT INTO t1 (rowid, content) VALUES(11, 'one two four');
INSERT INTO t1 (rowid, content) VALUES(12, 'three four');
INSERT INTO t1 (rowid, content) VALUES(13, 'one three four');
DELETE FROM t1 WHERE rowid = 10;
INSERT INTO t1 (rowid, content) VALUES(14, 'two three four');
INSERT INTO t1 (rowid, content) VALUES(15, 'one two three four');
UPDATE t1 SET content = 'update two five' WHERE rowid = 8;
INSERT INTO t1 (rowid, content) VALUES(16, 'five');
DELETE FROM t1 WHERE rowid = 13;
INSERT INTO t1 (rowid, content) VALUES(17, 'one five');
INSERT INTO t1 (rowid, content) VALUES(18, 'two five');
INSERT INTO t1 (rowid, content) VALUES(19, 'one two five');
DELETE FROM t1 WHERE rowid = 16;
INSERT INTO t1 (rowid, content) VALUES(20, 'three five');
INSERT INTO t1 (rowid, content) VALUES(21, 'one three five');
INSERT INTO t1 (rowid, content) VALUES(22, 'two three five');
DELETE FROM t1 WHERE rowid = 19;
UPDATE t1 SET content = 'update' WHERE rowid = 15;
}
do_test fts1f-1.1 {
execsql {SELECT COUNT(*) FROM t1}
} {16}
do_test fts1f-2.0 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'update'}
} {1 8 15}
do_test fts1f-2.1 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one'}
} {1 3 5 9 11 17 21}
do_test fts1f-2.2 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'two'}
} {2 3 6 8 11 14 18 22}
do_test fts1f-2.3 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'three'}
} {1 5 6 12 14 20 21 22}
do_test fts1f-2.4 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'four'}
} {9 11 12 14}
do_test fts1f-2.5 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'five'}
} {8 17 18 20 21 22}
finish_test

View File

@ -1,88 +0,0 @@
# 2007 January 17
#
# The author disclaims copyright to this source code.
#
#*************************************************************************
# This file implements regression tests for SQLite fts1 library. The
# focus here is testing handling of UPDATE when using UTF-16-encoded
# databases.
#
# $Id: fts1i.test,v 1.2 2007/01/24 03:43:20 drh Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If SQLITE_ENABLE_FTS1 is defined, omit this file.
ifcapable !fts1 {
finish_test
return
}
# Return the UTF-16 representation of the supplied UTF-8 string $str.
# If $nt is true, append two 0x00 bytes as a nul terminator.
# NOTE(shess) Copied from capi3.test.
proc utf16 {str {nt 1}} {
set r [encoding convertto unicode $str]
if {$nt} {
append r "\x00\x00"
}
return $r
}
db eval {
PRAGMA encoding = "UTF-16le";
CREATE VIRTUAL TABLE t1 USING fts1(content);
}
do_test fts1i-1.0 {
execsql {PRAGMA encoding}
} {UTF-16le}
do_test fts1i-1.1 {
execsql {INSERT INTO t1 (rowid, content) VALUES(1, 'one')}
execsql {SELECT content FROM t1 WHERE rowid = 1}
} {one}
do_test fts1i-1.2 {
set sql "INSERT INTO t1 (rowid, content) VALUES(2, 'two')"
set STMT [sqlite3_prepare $DB $sql -1 TAIL]
sqlite3_step $STMT
sqlite3_finalize $STMT
execsql {SELECT content FROM t1 WHERE rowid = 2}
} {two}
do_test fts1i-1.3 {
set sql "INSERT INTO t1 (rowid, content) VALUES(3, 'three')"
set STMT [sqlite3_prepare $DB $sql -1 TAIL]
sqlite3_step $STMT
sqlite3_finalize $STMT
set sql "UPDATE t1 SET content = 'trois' WHERE rowid = 3"
set STMT [sqlite3_prepare $DB $sql -1 TAIL]
sqlite3_step $STMT
sqlite3_finalize $STMT
execsql {SELECT content FROM t1 WHERE rowid = 3}
} {trois}
do_test fts1i-1.4 {
set sql16 [utf16 {INSERT INTO t1 (rowid, content) VALUES(4, 'four')}]
set STMT [sqlite3_prepare16 $DB $sql16 -1 TAIL]
sqlite3_step $STMT
sqlite3_finalize $STMT
execsql {SELECT content FROM t1 WHERE rowid = 4}
} {four}
do_test fts1i-1.5 {
set sql16 [utf16 {INSERT INTO t1 (rowid, content) VALUES(5, 'five')}]
set STMT [sqlite3_prepare16 $DB $sql16 -1 TAIL]
sqlite3_step $STMT
sqlite3_finalize $STMT
set sql "UPDATE t1 SET content = 'cinq' WHERE rowid = 5"
set STMT [sqlite3_prepare $DB $sql -1 TAIL]
sqlite3_step $STMT
sqlite3_finalize $STMT
execsql {SELECT content FROM t1 WHERE rowid = 5}
} {cinq}
finish_test

View File

@ -1,89 +0,0 @@
# 2007 February 6
#
# The author disclaims copyright to this source code.
#
#*************************************************************************
# This file implements regression tests for SQLite library. This
# tests creating fts1 tables in an attached database.
#
# $Id: fts1j.test,v 1.1 2007/02/07 01:01:18 shess Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If SQLITE_ENABLE_FTS1 is defined, omit this file.
ifcapable !fts1 {
finish_test
return
}
# Clean up anything left over from a previous pass.
forcedelete test2.db
forcedelete test2.db-journal
sqlite3 db2 test2.db
db eval {
CREATE VIRTUAL TABLE t3 USING fts1(content);
INSERT INTO t3 (rowid, content) VALUES(1, "hello world");
}
db2 eval {
CREATE VIRTUAL TABLE t1 USING fts1(content);
INSERT INTO t1 (rowid, content) VALUES(1, "hello world");
INSERT INTO t1 (rowid, content) VALUES(2, "hello there");
INSERT INTO t1 (rowid, content) VALUES(3, "cruel world");
}
# This has always worked because the t1_* tables used by fts1 will be
# the defaults.
do_test fts1j-1.1 {
execsql {
ATTACH DATABASE 'test2.db' AS two;
SELECT rowid FROM t1 WHERE t1 MATCH 'hello';
DETACH DATABASE two;
}
} {1 2}
# Make certain we're detached if there was an error.
catch {db eval {DETACH DATABASE two}}
# In older code, this appears to work fine, but the t2_* tables used
# by fts1 will be created in database 'main' instead of database
# 'two'. It appears to work fine because the tables end up being the
# defaults, but obviously is badly broken if you hope to use things
# other than in the exact same ATTACH setup.
do_test fts1j-1.2 {
execsql {
ATTACH DATABASE 'test2.db' AS two;
CREATE VIRTUAL TABLE two.t2 USING fts1(content);
INSERT INTO t2 (rowid, content) VALUES(1, "hello world");
INSERT INTO t2 (rowid, content) VALUES(2, "hello there");
INSERT INTO t2 (rowid, content) VALUES(3, "cruel world");
SELECT rowid FROM t2 WHERE t2 MATCH 'hello';
DETACH DATABASE two;
}
} {1 2}
catch {db eval {DETACH DATABASE two}}
# In older code, this broke because the fts1 code attempted to create
# t3_* tables in database 'main', but they already existed. Normally
# this wouldn't happen without t3 itself existing, in which case the
# fts1 code would never be called in the first place.
do_test fts1j-1.3 {
execsql {
ATTACH DATABASE 'test2.db' AS two;
CREATE VIRTUAL TABLE two.t3 USING fts1(content);
INSERT INTO two.t3 (rowid, content) VALUES(2, "hello there");
INSERT INTO two.t3 (rowid, content) VALUES(3, "cruel world");
SELECT rowid FROM two.t3 WHERE t3 MATCH 'hello';
DETACH DATABASE two;
} db2
} {2}
catch {db eval {DETACH DATABASE two}}
catch {db2 close}
forcedelete test2.db
finish_test

View File

@ -1,69 +0,0 @@
# 2007 March 28
#
# The author disclaims copyright to this source code.
#
#*************************************************************************
# This file implements regression tests for SQLite library. The focus
# of this script is testing isspace/isalnum/tolower problems with the
# FTS1 module. Unfortunately, this code isn't a really principled set
# of tests, because it is impossible to know where new uses of these
# functions might appear.
#
# $Id: fts1k.test,v 1.2 2007/12/13 21:54:11 drh Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If SQLITE_ENABLE_FTS1 is defined, omit this file.
ifcapable !fts1 {
finish_test
return
}
# Tests that startsWith() (calls isspace, tolower, isalnum) can handle
# hi-bit chars. parseSpec() also calls isalnum here.
do_test fts1k-1.1 {
execsql "CREATE VIRTUAL TABLE t1 USING fts1(content, \x80)"
} {}
# Additionally tests isspace() call in getToken(), and isalnum() call
# in tokenListToIdList().
do_test fts1k-1.2 {
catch {
execsql "CREATE VIRTUAL TABLE t2 USING fts1(content, tokenize \x80)"
}
sqlite3_errmsg $DB
} "unknown tokenizer: \x80"
# Additionally test final isalnum() in startsWith().
do_test fts1k-1.3 {
execsql "CREATE VIRTUAL TABLE t3 USING fts1(content, tokenize\x80)"
} {}
# The snippet-generation code has calls to isspace() which are sort of
# hard to get to. It finds convenient breakpoints by starting ~40
# chars before and after the matched term, and scanning ~10 chars
# around that position for isspace() characters. The long word with
# embedded hi-bit chars causes one of these isspace() calls to be
# exercised. The version with a couple extra spaces should cause the
# other isspace() call to be exercised. [Both cases have been tested
# in the debugger, but I'm hoping to continue to catch it if simple
# constant changes change things slightly.
#
# The trailing and leading hi-bit chars help with code which tests for
# isspace() to coalesce multiple spaces.
set word "\x80xxxxx\x80xxxxx\x80xxxxx\x80xxxxx\x80xxxxx\x80xxxxx\x80"
set phrase1 "$word $word $word target $word $word $word"
set phrase2 "$word $word $word target $word $word $word"
db eval {CREATE VIRTUAL TABLE t4 USING fts1(content)}
db eval "INSERT INTO t4 (content) VALUES ('$phrase1')"
db eval "INSERT INTO t4 (content) VALUES ('$phrase2')"
do_test fts1k-1.4 {
execsql {SELECT rowid, length(snippet(t4)) FROM t4 WHERE t4 MATCH 'target'}
} {1 111 2 117}
finish_test

View File

@ -1,65 +0,0 @@
# 2007 April 9
#
# The author disclaims copyright to this source code.
#
#*************************************************************************
# This file implements regression tests for SQLite library. fts1
# DELETE handling assumed all fields were non-null. This was not
# the intention at all.
#
# $Id: fts1l.test,v 1.1 2007/04/09 20:45:42 shess Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If SQLITE_ENABLE_FTS1 is defined, omit this file.
ifcapable !fts1 {
finish_test
return
}
db eval {
CREATE VIRTUAL TABLE t1 USING fts1(col_a, col_b);
INSERT INTO t1(rowid, col_a, col_b) VALUES(1, 'testing', 'testing');
INSERT INTO t1(rowid, col_a, col_b) VALUES(2, 'only a', null);
INSERT INTO t1(rowid, col_a, col_b) VALUES(3, null, 'only b');
INSERT INTO t1(rowid, col_a, col_b) VALUES(4, null, null);
}
do_test fts1m-1.0 {
execsql {
SELECT COUNT(col_a), COUNT(col_b), COUNT(*) FROM t1;
}
} {2 2 4}
do_test fts1m-1.1 {
execsql {
DELETE FROM t1 WHERE rowid = 1;
SELECT COUNT(col_a), COUNT(col_b), COUNT(*) FROM t1;
}
} {1 1 3}
do_test fts1m-1.2 {
execsql {
DELETE FROM t1 WHERE rowid = 2;
SELECT COUNT(col_a), COUNT(col_b), COUNT(*) FROM t1;
}
} {0 1 2}
do_test fts1m-1.3 {
execsql {
DELETE FROM t1 WHERE rowid = 3;
SELECT COUNT(col_a), COUNT(col_b), COUNT(*) FROM t1;
}
} {0 0 1}
do_test fts1m-1.4 {
execsql {
DELETE FROM t1 WHERE rowid = 4;
SELECT COUNT(col_a), COUNT(col_b), COUNT(*) FROM t1;
}
} {0 0 0}
finish_test

View File

@ -1,50 +0,0 @@
# 2007 July 27
#
# 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. The focus
# of this script is testing the FTS1 module, specifically snippet
# generation. Extracted from fts2o.test.
#
# $Id: fts1m.test,v 1.1 2007/07/25 00:25:20 shess Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If SQLITE_ENABLE_FTS1 is not defined, omit this file.
ifcapable !fts1 {
finish_test
return
}
#---------------------------------------------------------------------
# These tests, fts1m-1.*, test that ticket #2429 is fixed.
#
db eval {
CREATE VIRTUAL TABLE t1 USING fts1(a, b, c);
INSERT INTO t1(a, b, c) VALUES('one three four', 'one four', 'one four two');
}
do_test fts1m-1.1 {
execsql {
SELECT rowid, snippet(t1) FROM t1 WHERE c MATCH 'four';
}
} {1 {one <b>four</b> two}}
do_test fts1m-1.2 {
execsql {
SELECT rowid, snippet(t1) FROM t1 WHERE b MATCH 'four';
}
} {1 {one <b>four</b>}}
do_test fts1m-1.3 {
execsql {
SELECT rowid, snippet(t1) FROM t1 WHERE a MATCH 'four';
}
} {1 {one three <b>four</b>}}
finish_test

View File

@ -1,45 +0,0 @@
# 2007 July 24
#
# 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. The focus
# of this script is testing the FTS1 module for errors in the handling
# of SQLITE_SCHEMA.
#
# $Id: fts1n.test,v 1.1 2007/07/25 00:38:06 shess Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If SQLITE_ENABLE_FTS1 is not defined, omit this file.
ifcapable !fts1 {
finish_test
return
}
do_test fts1m-1.1 {
execsql {
CREATE VIRTUAL TABLE t1 USING fts1(a, b, c);
INSERT INTO t1(a, b, c) VALUES('one three four', 'one four', 'one two');
SELECT a, b, c FROM t1 WHERE c MATCH 'two';
}
} {{one three four} {one four} {one two}}
# This test was crashing at one point.
#
do_test fts1m-1.2 {
execsql {
SELECT a, b, c FROM t1 WHERE c MATCH 'two';
CREATE TABLE t3(a, b, c);
SELECT a, b, c FROM t1 WHERE c MATCH 'two';
}
} {{one three four} {one four} {one two} {one three four} {one four} {one two}}
finish_test

View File

@ -1,138 +0,0 @@
# 2007 July 24
#
# 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. The focus
# of this script is testing the FTS1 module rename functionality. Mostly
# copied from fts2o.test.
#
# $Id: fts1o.test,v 1.2 2007/08/30 20:01:33 shess Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If SQLITE_ENABLE_FTS1 is not defined, omit this file.
ifcapable !fts1 {
finish_test
return
}
db eval {
CREATE VIRTUAL TABLE t1 USING fts1(a, b, c);
INSERT INTO t1(a, b, c) VALUES('one three four', 'one four', 'one four two');
}
#---------------------------------------------------------------------
# Test that it is possible to rename an fts1 table.
#
do_test fts1o-1.1 {
execsql { SELECT tbl_name FROM sqlite_master WHERE type = 'table'}
} {t1 t1_content t1_term}
do_test fts1o-1.2 {
execsql { ALTER TABLE t1 RENAME to fts_t1; }
} {}
do_test fts1o-1.3 {
execsql { SELECT rowid, snippet(fts_t1) FROM fts_t1 WHERE a MATCH 'four'; }
} {1 {one three <b>four</b>}}
do_test fts1o-1.4 {
execsql { SELECT tbl_name FROM sqlite_master WHERE type = 'table'}
} {fts_t1 fts_t1_content fts_t1_term}
# See what happens when renaming the fts1 table fails.
#
do_test fts1o-2.1 {
catchsql {
CREATE TABLE t1_term(a, b, c);
ALTER TABLE fts_t1 RENAME to t1;
}
} {1 {SQL logic error}}
do_test fts1o-2.2 {
execsql { SELECT rowid, snippet(fts_t1) FROM fts_t1 WHERE a MATCH 'four'; }
} {1 {one three <b>four</b>}}
do_test fts1o-2.3 {
execsql { SELECT tbl_name FROM sqlite_master WHERE type = 'table'}
} {fts_t1 fts_t1_content fts_t1_term t1_term}
# See what happens when renaming the fts1 table fails inside a transaction.
#
do_test fts1o-3.1 {
execsql {
BEGIN;
INSERT INTO fts_t1(a, b, c) VALUES('one two three', 'one four', 'one two');
}
} {}
do_test fts1o-3.2 {
catchsql {
ALTER TABLE fts_t1 RENAME to t1;
}
} {1 {SQL logic error}}
# NOTE(shess) rowid AS rowid to defeat caching. Otherwise, this
# seg-faults, I suspect that there's something up with a stale
# virtual-table reference, but I'm not quite sure how it happens here
# but not for fts2o.test.
do_test fts1o-3.3 {
execsql { SELECT rowid AS rowid, snippet(fts_t1) FROM fts_t1 WHERE a MATCH 'four'; }
} {1 {one three <b>four</b>}}
do_test fts1o-3.4 {
execsql { SELECT tbl_name FROM sqlite_master WHERE type = 'table'}
} {fts_t1 fts_t1_content fts_t1_term t1_term}
do_test fts1o-3.5 {
execsql COMMIT
execsql {SELECT a FROM fts_t1}
} {{one three four} {one two three}}
do_test fts1o-3.6 {
execsql { SELECT a, b, c FROM fts_t1 WHERE c MATCH 'four'; }
} {{one three four} {one four} {one four two}}
#---------------------------------------------------------------------
# Test that it is possible to rename an fts1 table in an attached
# database.
#
forcedelete test2.db test2.db-journal
do_test fts1o-4.1 {
execsql {
DROP TABLE t1_term;
ALTER TABLE fts_t1 RENAME to t1;
SELECT a, b, c FROM t1 WHERE c MATCH 'two';
}
} {{one three four} {one four} {one four two} {one two three} {one four} {one two}}
do_test fts1o-4.2 {
execsql {
ATTACH 'test2.db' AS aux;
CREATE VIRTUAL TABLE aux.t1 USING fts1(a, b, c);
INSERT INTO aux.t1(a, b, c) VALUES(
'neung song sahm', 'neung see', 'neung see song'
);
}
} {}
do_test fts1o-4.3 {
execsql { SELECT a, b, c FROM aux.t1 WHERE a MATCH 'song'; }
} {{neung song sahm} {neung see} {neung see song}}
do_test fts1o-4.4 {
execsql { SELECT a, b, c FROM t1 WHERE c MATCH 'two'; }
} {{one three four} {one four} {one four two} {one two three} {one four} {one two}}
do_test fts1o-4.5 {
execsql { ALTER TABLE aux.t1 RENAME TO t2 }
} {}
do_test fts1o-4.6 {
execsql { SELECT a, b, c FROM t2 WHERE a MATCH 'song'; }
} {{neung song sahm} {neung see} {neung see song}}
do_test fts1o-4.7 {
execsql { SELECT a, b, c FROM t1 WHERE c MATCH 'two'; }
} {{one three four} {one four} {one four two} {one two three} {one four} {one two}}
finish_test

File diff suppressed because it is too large Load Diff

View File

@ -1,67 +0,0 @@
# 2008 July 22
#
# 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 runs all tests.
#
# $Id: fts2.test,v 1.2 2008/07/23 18:17:32 drh Exp $
proc lshift {lvar} {
upvar $lvar l
set ret [lindex $l 0]
set l [lrange $l 1 end]
return $ret
}
while {[set arg [lshift argv]] != ""} {
switch -- $arg {
-sharedpagercache {
sqlite3_enable_shared_cache 1
}
-soak {
set G(issoak) 1
}
default {
set argv [linsert $argv 0 $arg]
break
}
}
}
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If SQLITE_ENABLE_FTS2 is defined, omit this file.
ifcapable !fts2 {
return
}
rename finish_test really_finish_test
proc finish_test {} {}
set G(isquick) 1
set EXCLUDE {
fts2.test
}
# Files to include in the test. If this list is empty then everything
# that is not in the EXCLUDE list is run.
#
set INCLUDE {
}
foreach testfile [lsort -dictionary [glob $testdir/fts2*.test]] {
set tail [file tail $testfile]
if {[lsearch -exact $EXCLUDE $tail]>=0} continue
if {[llength $INCLUDE]>0 && [lsearch -exact $INCLUDE $tail]<0} continue
source $testfile
catch {db close}
if {$sqlite_open_file_count>0} {
puts "$tail did not close all files: $sqlite_open_file_count"
fail_test $tail
set sqlite_open_file_count 0
}
}
set sqlite_open_file_count 0
really_finish_test

View File

@ -1,202 +0,0 @@
# 2006 September 9
#
# 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. The
# focus of this script is testing the FTS2 module.
#
# $Id: fts2a.test,v 1.2 2007/05/21 21:59:18 shess Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If SQLITE_ENABLE_FTS2 is defined, omit this file.
ifcapable !fts2 {
finish_test
return
}
# Construct a full-text search table containing five keywords:
# one, two, three, four, and five, in various combinations. The
# rowid for each will be a bitmask for the elements it contains.
#
db eval {
CREATE VIRTUAL TABLE t1 USING fts2(content);
INSERT INTO t1(content) VALUES('one');
INSERT INTO t1(content) VALUES('two');
INSERT INTO t1(content) VALUES('one two');
INSERT INTO t1(content) VALUES('three');
INSERT INTO t1(content) VALUES('one three');
INSERT INTO t1(content) VALUES('two three');
INSERT INTO t1(content) VALUES('one two three');
INSERT INTO t1(content) VALUES('four');
INSERT INTO t1(content) VALUES('one four');
INSERT INTO t1(content) VALUES('two four');
INSERT INTO t1(content) VALUES('one two four');
INSERT INTO t1(content) VALUES('three four');
INSERT INTO t1(content) VALUES('one three four');
INSERT INTO t1(content) VALUES('two three four');
INSERT INTO t1(content) VALUES('one two three four');
INSERT INTO t1(content) VALUES('five');
INSERT INTO t1(content) VALUES('one five');
INSERT INTO t1(content) VALUES('two five');
INSERT INTO t1(content) VALUES('one two five');
INSERT INTO t1(content) VALUES('three five');
INSERT INTO t1(content) VALUES('one three five');
INSERT INTO t1(content) VALUES('two three five');
INSERT INTO t1(content) VALUES('one two three five');
INSERT INTO t1(content) VALUES('four five');
INSERT INTO t1(content) VALUES('one four five');
INSERT INTO t1(content) VALUES('two four five');
INSERT INTO t1(content) VALUES('one two four five');
INSERT INTO t1(content) VALUES('three four five');
INSERT INTO t1(content) VALUES('one three four five');
INSERT INTO t1(content) VALUES('two three four five');
INSERT INTO t1(content) VALUES('one two three four five');
}
do_test fts2a-1.1 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one'}
} {1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31}
do_test fts2a-1.2 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one two'}
} {3 7 11 15 19 23 27 31}
do_test fts2a-1.3 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'two one'}
} {3 7 11 15 19 23 27 31}
do_test fts2a-1.4 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one two three'}
} {7 15 23 31}
do_test fts2a-1.5 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one three two'}
} {7 15 23 31}
do_test fts2a-1.6 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'two three one'}
} {7 15 23 31}
do_test fts2a-1.7 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'two one three'}
} {7 15 23 31}
do_test fts2a-1.8 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'three one two'}
} {7 15 23 31}
do_test fts2a-1.9 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'three two one'}
} {7 15 23 31}
do_test fts2a-1.10 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one two THREE'}
} {7 15 23 31}
do_test fts2a-1.11 {
execsql {SELECT rowid FROM t1 WHERE content MATCH ' ONE Two three '}
} {7 15 23 31}
do_test fts2a-2.1 {
execsql {SELECT rowid FROM t1 WHERE content MATCH '"one"'}
} {1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31}
do_test fts2a-2.2 {
execsql {SELECT rowid FROM t1 WHERE content MATCH '"one two"'}
} {3 7 11 15 19 23 27 31}
do_test fts2a-2.3 {
execsql {SELECT rowid FROM t1 WHERE content MATCH '"two one"'}
} {}
do_test fts2a-2.4 {
execsql {SELECT rowid FROM t1 WHERE content MATCH '"one two three"'}
} {7 15 23 31}
do_test fts2a-2.5 {
execsql {SELECT rowid FROM t1 WHERE content MATCH '"one three two"'}
} {}
do_test fts2a-2.6 {
execsql {SELECT rowid FROM t1 WHERE content MATCH '"one two three four"'}
} {15 31}
do_test fts2a-2.7 {
execsql {SELECT rowid FROM t1 WHERE content MATCH '"one three two four"'}
} {}
do_test fts2a-2.8 {
execsql {SELECT rowid FROM t1 WHERE content MATCH '"one three five"'}
} {21}
do_test fts2a-2.9 {
execsql {SELECT rowid FROM t1 WHERE content MATCH '"one three" five'}
} {21 29}
do_test fts2a-2.10 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'five "one three"'}
} {21 29}
do_test fts2a-2.11 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'five "one three" four'}
} {29}
do_test fts2a-2.12 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'five four "one three"'}
} {29}
do_test fts2a-2.13 {
execsql {SELECT rowid FROM t1 WHERE content MATCH '"one three" four five'}
} {29}
do_test fts2a-3.1 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one'}
} {1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31}
do_test fts2a-3.2 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one -two'}
} {1 5 9 13 17 21 25 29}
do_test fts2a-3.3 {
execsql {SELECT rowid FROM t1 WHERE content MATCH '-two one'}
} {1 5 9 13 17 21 25 29}
do_test fts2a-4.1 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one OR two'}
} {1 2 3 5 6 7 9 10 11 13 14 15 17 18 19 21 22 23 25 26 27 29 30 31}
do_test fts2a-4.2 {
execsql {SELECT rowid FROM t1 WHERE content MATCH '"one two" OR three'}
} {3 4 5 6 7 11 12 13 14 15 19 20 21 22 23 27 28 29 30 31}
do_test fts2a-4.3 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'three OR "one two"'}
} {3 4 5 6 7 11 12 13 14 15 19 20 21 22 23 27 28 29 30 31}
do_test fts2a-4.4 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one two OR three'}
} {3 5 7 11 13 15 19 21 23 27 29 31}
do_test fts2a-4.5 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'three OR two one'}
} {3 5 7 11 13 15 19 21 23 27 29 31}
do_test fts2a-4.6 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one two OR three OR four'}
} {3 5 7 9 11 13 15 19 21 23 25 27 29 31}
do_test fts2a-4.7 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'two OR three OR four one'}
} {3 5 7 9 11 13 15 19 21 23 25 27 29 31}
# Test the ability to handle NULL content
#
do_test fts2a-5.1 {
execsql {INSERT INTO t1(content) VALUES(NULL)}
} {}
do_test fts2a-5.2 {
set rowid [db last_insert_rowid]
execsql {SELECT content FROM t1 WHERE rowid=$rowid}
} {{}}
do_test fts2a-5.3 {
execsql {SELECT rowid FROM t1 WHERE content MATCH NULL}
} {}
# Test the ability to handle non-positive rowids
#
do_test fts2a-6.0 {
execsql {INSERT INTO t1(rowid, content) VALUES(0, 'four five')}
} {}
do_test fts2a-6.1 {
execsql {SELECT content FROM t1 WHERE rowid = 0}
} {{four five}}
do_test fts2a-6.2 {
execsql {INSERT INTO t1(rowid, content) VALUES(-1, 'three four')}
} {}
do_test fts2a-6.3 {
execsql {SELECT content FROM t1 WHERE rowid = -1}
} {{three four}}
do_test fts2a-6.4 {
execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'four'}
} {-1 0 8 9 10 11 12 13 14 15 24 25 26 27 28 29 30 31}
finish_test

View File

@ -1,147 +0,0 @@
# 2006 September 13
#
# 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. The
# focus of this script is testing the FTS2 module.
#
# $Id: fts2b.test,v 1.1 2006/10/19 23:36:26 shess Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If SQLITE_ENABLE_FTS2 is defined, omit this file.
ifcapable !fts2 {
finish_test
return
}
# Fill the full-text index "t1" with phrases in english, spanish,
# and german. For the i-th row, fill in the names for the bits
# that are set in the value of i. The least significant bit is
# 1. For example, the value 5 is 101 in binary which will be
# converted to "one three" in english.
#
proc fill_multilanguage_fulltext_t1 {} {
set english {one two three four five}
set spanish {un dos tres cuatro cinco}
set german {eine zwei drei vier funf}
for {set i 1} {$i<=31} {incr i} {
set cmd "INSERT INTO t1 VALUES"
set vset {}
foreach lang {english spanish german} {
set words {}
for {set j 0; set k 1} {$j<5} {incr j; incr k $k} {
if {$k&$i} {lappend words [lindex [set $lang] $j]}
}
lappend vset "'$words'"
}
set sql "INSERT INTO t1(english,spanish,german) VALUES([join $vset ,])"
# puts $sql
db eval $sql
}
}
# Construct a full-text search table containing five keywords:
# one, two, three, four, and five, in various combinations. The
# rowid for each will be a bitmask for the elements it contains.
#
db eval {
CREATE VIRTUAL TABLE t1 USING fts2(english,spanish,german);
}
fill_multilanguage_fulltext_t1
do_test fts2b-1.1 {
execsql {SELECT rowid FROM t1 WHERE english MATCH 'one'}
} {1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31}
do_test fts2b-1.2 {
execsql {SELECT rowid FROM t1 WHERE spanish MATCH 'one'}
} {}
do_test fts2b-1.3 {
execsql {SELECT rowid FROM t1 WHERE german MATCH 'one'}
} {}
do_test fts2b-1.4 {
execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'one'}
} {1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31}
do_test fts2b-1.5 {
execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'one dos drei'}
} {7 15 23 31}
do_test fts2b-1.6 {
execsql {SELECT english, spanish, german FROM t1 WHERE rowid=1}
} {one un eine}
do_test fts2b-1.7 {
execsql {SELECT rowid FROM t1 WHERE t1 MATCH '"one un"'}
} {}
do_test fts2b-2.1 {
execsql {
CREATE VIRTUAL TABLE t2 USING fts2(from,to);
INSERT INTO t2([from],[to]) VALUES ('one two three', 'four five six');
SELECT [from], [to] FROM t2
}
} {{one two three} {four five six}}
# Compute an SQL string that contains the words one, two, three,... to
# describe bits set in the value $i. Only the lower 5 bits are examined.
#
proc wordset {i} {
set x {}
for {set j 0; set k 1} {$j<5} {incr j; incr k $k} {
if {$k&$i} {lappend x [lindex {one two three four five} $j]}
}
return '$x'
}
# Create a new FTS table with three columns:
#
# norm: words for the bits of rowid
# plusone: words for the bits of rowid+1
# invert: words for the bits of ~rowid
#
db eval {
CREATE VIRTUAL TABLE t4 USING fts2([norm],'plusone',"invert");
}
for {set i 1} {$i<=15} {incr i} {
set vset [list [wordset $i] [wordset [expr {$i+1}]] [wordset [expr {~$i}]]]
db eval "INSERT INTO t4(norm,plusone,invert) VALUES([join $vset ,]);"
}
do_test fts2b-4.1 {
execsql {SELECT rowid FROM t4 WHERE t4 MATCH 'norm:one'}
} {1 3 5 7 9 11 13 15}
do_test fts2b-4.2 {
execsql {SELECT rowid FROM t4 WHERE norm MATCH 'one'}
} {1 3 5 7 9 11 13 15}
do_test fts2b-4.3 {
execsql {SELECT rowid FROM t4 WHERE t4 MATCH 'one'}
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15}
do_test fts2b-4.4 {
execsql {SELECT rowid FROM t4 WHERE t4 MATCH 'plusone:one'}
} {2 4 6 8 10 12 14}
do_test fts2b-4.5 {
execsql {SELECT rowid FROM t4 WHERE plusone MATCH 'one'}
} {2 4 6 8 10 12 14}
do_test fts2b-4.6 {
execsql {SELECT rowid FROM t4 WHERE t4 MATCH 'norm:one plusone:two'}
} {1 5 9 13}
do_test fts2b-4.7 {
execsql {SELECT rowid FROM t4 WHERE t4 MATCH 'norm:one two'}
} {1 3 5 7 9 11 13 15}
do_test fts2b-4.8 {
execsql {SELECT rowid FROM t4 WHERE t4 MATCH 'plusone:two norm:one'}
} {1 5 9 13}
do_test fts2b-4.9 {
execsql {SELECT rowid FROM t4 WHERE t4 MATCH 'two norm:one'}
} {1 3 5 7 9 11 13 15}
finish_test

File diff suppressed because it is too large Load Diff

View File

@ -1,65 +0,0 @@
# 2006 October 1
#
# 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. The
# focus of this script is testing the FTS2 module, and in particular
# the Porter stemmer.
#
# $Id: fts2d.test,v 1.1 2006/10/19 23:36:26 shess Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If SQLITE_ENABLE_FTS2 is defined, omit this file.
ifcapable !fts2 {
finish_test
return
}
do_test fts2d-1.1 {
execsql {
CREATE VIRTUAL TABLE t1 USING fts2(content, tokenize porter);
INSERT INTO t1(rowid, content) VALUES(1, 'running and jumping');
SELECT rowid FROM t1 WHERE content MATCH 'run jump';
}
} {1}
do_test fts2d-1.2 {
execsql {
SELECT snippet(t1) FROM t1 WHERE t1 MATCH 'run jump';
}
} {{<b>running</b> and <b>jumping</b>}}
do_test fts2d-1.3 {
execsql {
INSERT INTO t1(rowid, content)
VALUES(2, 'abcdefghijklmnopqrstuvwyxz');
SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH 'abcdefghijqrstuvwyxz'
}
} {2 <b>abcdefghijklmnopqrstuvwyxz</b>}
do_test fts2d-1.4 {
execsql {
SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH 'abcdefghijXXXXqrstuvwyxz'
}
} {2 <b>abcdefghijklmnopqrstuvwyxz</b>}
do_test fts2d-1.5 {
execsql {
INSERT INTO t1(rowid, content)
VALUES(3, 'The value is 123456789');
SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH '123789'
}
} {3 {The value is <b>123456789</b>}}
do_test fts2d-1.6 {
execsql {
SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH '123000000789'
}
} {3 {The value is <b>123456789</b>}}
finish_test

View File

@ -1,85 +0,0 @@
# 2006 October 19
#
# The author disclaims copyright to this source code.
#
#*************************************************************************
# This file implements regression tests for SQLite library. The
# focus of this script is testing deletions in the FTS2 module.
#
# $Id: fts2e.test,v 1.1 2006/10/19 23:36:26 shess Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If SQLITE_ENABLE_FTS2 is defined, omit this file.
ifcapable !fts2 {
finish_test
return
}
# Construct a full-text search table containing keywords which are the
# ordinal numbers of the bit positions set for a sequence of integers,
# which are used for the rowid. There are a total of 30 INSERT and
# DELETE statements, so that we'll test both the segmentMerge() merge
# (over the first 16) and the termSelect() merge (over the level-1
# segment and 14 level-0 segments).
db eval {
CREATE VIRTUAL TABLE t1 USING fts2(content);
INSERT INTO t1 (rowid, content) VALUES(1, 'one');
INSERT INTO t1 (rowid, content) VALUES(2, 'two');
INSERT INTO t1 (rowid, content) VALUES(3, 'one two');
INSERT INTO t1 (rowid, content) VALUES(4, 'three');
DELETE FROM t1 WHERE rowid = 1;
INSERT INTO t1 (rowid, content) VALUES(5, 'one three');
INSERT INTO t1 (rowid, content) VALUES(6, 'two three');
INSERT INTO t1 (rowid, content) VALUES(7, 'one two three');
DELETE FROM t1 WHERE rowid = 4;
INSERT INTO t1 (rowid, content) VALUES(8, 'four');
INSERT INTO t1 (rowid, content) VALUES(9, 'one four');
INSERT INTO t1 (rowid, content) VALUES(10, 'two four');
DELETE FROM t1 WHERE rowid = 7;
INSERT INTO t1 (rowid, content) VALUES(11, 'one two four');
INSERT INTO t1 (rowid, content) VALUES(12, 'three four');
INSERT INTO t1 (rowid, content) VALUES(13, 'one three four');
DELETE FROM t1 WHERE rowid = 10;
INSERT INTO t1 (rowid, content) VALUES(14, 'two three four');
INSERT INTO t1 (rowid, content) VALUES(15, 'one two three four');
INSERT INTO t1 (rowid, content) VALUES(16, 'five');
DELETE FROM t1 WHERE rowid = 13;
INSERT INTO t1 (rowid, content) VALUES(17, 'one five');
INSERT INTO t1 (rowid, content) VALUES(18, 'two five');
INSERT INTO t1 (rowid, content) VALUES(19, 'one two five');
DELETE FROM t1 WHERE rowid = 16;
INSERT INTO t1 (rowid, content) VALUES(20, 'three five');
INSERT INTO t1 (rowid, content) VALUES(21, 'one three five');
INSERT INTO t1 (rowid, content) VALUES(22, 'two three five');
DELETE FROM t1 WHERE rowid = 19;
DELETE FROM t1 WHERE rowid = 22;
}
do_test fts2f-1.1 {
execsql {SELECT COUNT(*) FROM t1}
} {14}
do_test fts2e-2.1 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one'}
} {3 5 9 11 15 17 21}
do_test fts2e-2.2 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'two'}
} {2 3 6 11 14 15 18}
do_test fts2e-2.3 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'three'}
} {5 6 12 14 15 20 21}
do_test fts2e-2.4 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'four'}
} {8 9 11 12 14 15}
do_test fts2e-2.5 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'five'}
} {17 18 20 21}
finish_test

View File

@ -1,90 +0,0 @@
# 2006 October 19
#
# The author disclaims copyright to this source code.
#
#*************************************************************************
# This file implements regression tests for SQLite library. The
# focus of this script is testing updates in the FTS2 module.
#
# $Id: fts2f.test,v 1.2 2007/02/23 00:14:06 shess Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If SQLITE_ENABLE_FTS2 is defined, omit this file.
ifcapable !fts2 {
finish_test
return
}
# Construct a full-text search table containing keywords which are the
# ordinal numbers of the bit positions set for a sequence of integers,
# which are used for the rowid. There are a total of 31 INSERT,
# UPDATE, and DELETE statements, so that we'll test both the
# segmentMerge() merge (over the first 16) and the termSelect() merge
# (over the level-1 segment and 15 level-0 segments).
db eval {
CREATE VIRTUAL TABLE t1 USING fts2(content);
INSERT INTO t1 (rowid, content) VALUES(1, 'one');
INSERT INTO t1 (rowid, content) VALUES(2, 'two');
INSERT INTO t1 (rowid, content) VALUES(3, 'one two');
INSERT INTO t1 (rowid, content) VALUES(4, 'three');
INSERT INTO t1 (rowid, content) VALUES(5, 'one three');
INSERT INTO t1 (rowid, content) VALUES(6, 'two three');
INSERT INTO t1 (rowid, content) VALUES(7, 'one two three');
DELETE FROM t1 WHERE rowid = 4;
INSERT INTO t1 (rowid, content) VALUES(8, 'four');
UPDATE t1 SET content = 'update one three' WHERE rowid = 1;
INSERT INTO t1 (rowid, content) VALUES(9, 'one four');
INSERT INTO t1 (rowid, content) VALUES(10, 'two four');
DELETE FROM t1 WHERE rowid = 7;
INSERT INTO t1 (rowid, content) VALUES(11, 'one two four');
INSERT INTO t1 (rowid, content) VALUES(12, 'three four');
INSERT INTO t1 (rowid, content) VALUES(13, 'one three four');
DELETE FROM t1 WHERE rowid = 10;
INSERT INTO t1 (rowid, content) VALUES(14, 'two three four');
INSERT INTO t1 (rowid, content) VALUES(15, 'one two three four');
UPDATE t1 SET content = 'update two five' WHERE rowid = 8;
INSERT INTO t1 (rowid, content) VALUES(16, 'five');
DELETE FROM t1 WHERE rowid = 13;
INSERT INTO t1 (rowid, content) VALUES(17, 'one five');
INSERT INTO t1 (rowid, content) VALUES(18, 'two five');
INSERT INTO t1 (rowid, content) VALUES(19, 'one two five');
DELETE FROM t1 WHERE rowid = 16;
INSERT INTO t1 (rowid, content) VALUES(20, 'three five');
INSERT INTO t1 (rowid, content) VALUES(21, 'one three five');
INSERT INTO t1 (rowid, content) VALUES(22, 'two three five');
DELETE FROM t1 WHERE rowid = 19;
UPDATE t1 SET content = 'update' WHERE rowid = 15;
}
do_test fts2f-1.1 {
execsql {SELECT COUNT(*) FROM t1}
} {16}
do_test fts2f-2.0 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'update'}
} {1 8 15}
do_test fts2f-2.1 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one'}
} {1 3 5 9 11 17 21}
do_test fts2f-2.2 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'two'}
} {2 3 6 8 11 14 18 22}
do_test fts2f-2.3 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'three'}
} {1 5 6 12 14 20 21 22}
do_test fts2f-2.4 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'four'}
} {9 11 12 14}
do_test fts2f-2.5 {
execsql {SELECT rowid FROM t1 WHERE content MATCH 'five'}
} {8 17 18 20 21 22}
finish_test

View File

@ -1,93 +0,0 @@
# 2006 October 19
#
# The author disclaims copyright to this source code.
#
#*************************************************************************
# This file implements regression tests for SQLite library. The focus
# of this script is testing handling of edge cases for various doclist
# merging functions in the FTS2 module query logic.
#
# $Id: fts2g.test,v 1.3 2007/11/16 00:23:08 shess Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If SQLITE_ENABLE_FTS2 is defined, omit this file.
ifcapable !fts2 {
finish_test
return
}
db eval {
CREATE VIRTUAL TABLE t1 USING fts2(content);
INSERT INTO t1 (rowid, content) VALUES(1, 'this is a test');
INSERT INTO t1 (rowid, content) VALUES(2, 'also a test');
}
# No hits at all. Returns empty doclists from termSelect().
do_test fts2g-1.1 {
execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'something'}
} {}
# Empty left in docListExceptMerge().
do_test fts2g-1.2 {
execsql {SELECT rowid FROM t1 WHERE t1 MATCH '-this something'}
} {}
# Empty right in docListExceptMerge().
do_test fts2g-1.3 {
execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'this -something'}
} {1}
# Empty left in docListPhraseMerge().
do_test fts2g-1.4 {
execsql {SELECT rowid FROM t1 WHERE t1 MATCH '"this something"'}
} {}
# Empty right in docListPhraseMerge().
do_test fts2g-1.5 {
execsql {SELECT rowid FROM t1 WHERE t1 MATCH '"something is"'}
} {}
# Empty left in docListOrMerge().
do_test fts2g-1.6 {
execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'something OR this'}
} {1}
# Empty right in docListOrMerge().
do_test fts2g-1.7 {
execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'this OR something'}
} {1}
# Empty left in docListAndMerge().
do_test fts2g-1.8 {
execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'something this'}
} {}
# Empty right in docListAndMerge().
do_test fts2g-1.9 {
execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'this something'}
} {}
# No support for all-except queries.
do_test fts2g-1.10 {
catchsql {SELECT rowid FROM t1 WHERE t1 MATCH '-this -something'}
} {1 {SQL logic error}}
# Test that docListOrMerge() correctly handles reaching the end of one
# doclist before it reaches the end of the other.
do_test fts2g-1.11 {
execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'this OR also'}
} {1 2}
do_test fts2g-1.12 {
execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'also OR this'}
} {1 2}
# Empty left and right in docListOrMerge(). Each term matches neither
# row, and when combined there was an assertion failure.
do_test fts2g-1.13 {
execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'something OR nothing'}
} {}
finish_test

View File

@ -1,76 +0,0 @@
# 2006 October 31 (scaaarey)
#
# The author disclaims copyright to this source code.
#
#*************************************************************************
# This file implements regression tests for SQLite library. The focus
# here is testing correct handling of excessively long terms.
#
# $Id: fts2h.test,v 1.1 2006/11/29 21:03:01 shess Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If SQLITE_ENABLE_FTS2 is defined, omit this file.
ifcapable !fts2 {
finish_test
return
}
# Generate a term of len copies of char.
proc bigterm {char len} {
for {set term ""} {$len>0} {incr len -1} {
append term $char
}
return $term
}
# Generate a document of bigterms based on characters from the list
# chars.
proc bigtermdoc {chars len} {
set doc ""
foreach char $chars {
append doc " " [bigterm $char $len]
}
return $doc
}
set len 5000
set doc1 [bigtermdoc {a b c d} $len]
set doc2 [bigtermdoc {b d e f} $len]
set doc3 [bigtermdoc {a c e} $len]
set aterm [bigterm a $len]
set bterm [bigterm b $len]
set xterm [bigterm x $len]
db eval {
CREATE VIRTUAL TABLE t1 USING fts2(content);
INSERT INTO t1 (rowid, content) VALUES(1, $doc1);
INSERT INTO t1 (rowid, content) VALUES(2, $doc2);
INSERT INTO t1 (rowid, content) VALUES(3, $doc3);
}
# No hits at all. Returns empty doclists from termSelect().
do_test fts2h-1.1 {
execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'something'}
} {}
do_test fts2h-1.2 {
execsql {SELECT rowid FROM t1 WHERE t1 MATCH $aterm}
} {1 3}
do_test fts2h-1.2 {
execsql {SELECT rowid FROM t1 WHERE t1 MATCH $xterm}
} {}
do_test fts2h-1.3 {
execsql "SELECT rowid FROM t1 WHERE t1 MATCH '$aterm -$xterm'"
} {1 3}
do_test fts2h-1.4 {
execsql "SELECT rowid FROM t1 WHERE t1 MATCH '\"$aterm $bterm\"'"
} {1}
finish_test

View File

@ -1,87 +0,0 @@
# 2007 January 17
#
# The author disclaims copyright to this source code.
#
#*************************************************************************
# This file implements regression tests for SQLite fts2 library. The
# focus here is testing handling of UPDATE when using UTF-16-encoded
# databases.
#
# $Id: fts2i.test,v 1.2 2007/01/24 03:46:35 drh Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If SQLITE_ENABLE_FTS2 is defined, omit this file.
ifcapable !fts2 {
finish_test
return
}
# Return the UTF-16 representation of the supplied UTF-8 string $str.
# If $nt is true, append two 0x00 bytes as a nul terminator.
# NOTE(shess) Copied from capi3.test.
proc utf16 {str {nt 1}} {
set r [encoding convertto unicode $str]
if {$nt} {
append r "\x00\x00"
}
return $r
}
db eval {
PRAGMA encoding = "UTF-16le";
CREATE VIRTUAL TABLE t1 USING fts2(content);
}
do_test fts2i-1.0 {
execsql {PRAGMA encoding}
} {UTF-16le}
do_test fts2i-1.1 {
execsql {INSERT INTO t1 (rowid, content) VALUES(1, 'one')}
execsql {SELECT content FROM t1 WHERE rowid = 1}
} {one}
do_test fts2i-1.2 {
set sql "INSERT INTO t1 (rowid, content) VALUES(2, 'two')"
set STMT [sqlite3_prepare $DB $sql -1 TAIL]
sqlite3_step $STMT
sqlite3_finalize $STMT
execsql {SELECT content FROM t1 WHERE rowid = 2}
} {two}
do_test fts2i-1.3 {
set sql "INSERT INTO t1 (rowid, content) VALUES(3, 'three')"
set STMT [sqlite3_prepare $DB $sql -1 TAIL]
sqlite3_step $STMT
sqlite3_finalize $STMT
set sql "UPDATE t1 SET content = 'trois' WHERE rowid = 3"
set STMT [sqlite3_prepare $DB $sql -1 TAIL]
sqlite3_step $STMT
sqlite3_finalize $STMT
execsql {SELECT content FROM t1 WHERE rowid = 3}
} {trois}
do_test fts2i-1.4 {
set sql16 [utf16 {INSERT INTO t1 (rowid, content) VALUES(4, 'four')}]
set STMT [sqlite3_prepare16 $DB $sql16 -1 TAIL]
sqlite3_step $STMT
sqlite3_finalize $STMT
execsql {SELECT content FROM t1 WHERE rowid = 4}
} {four}
do_test fts2i-1.5 {
set sql16 [utf16 {INSERT INTO t1 (rowid, content) VALUES(5, 'five')}]
set STMT [sqlite3_prepare16 $DB $sql16 -1 TAIL]
sqlite3_step $STMT
sqlite3_finalize $STMT
set sql "UPDATE t1 SET content = 'cinq' WHERE rowid = 5"
set STMT [sqlite3_prepare $DB $sql -1 TAIL]
sqlite3_step $STMT
sqlite3_finalize $STMT
execsql {SELECT content FROM t1 WHERE rowid = 5}
} {cinq}
finish_test

View File

@ -1,89 +0,0 @@
# 2007 February 6
#
# The author disclaims copyright to this source code.
#
#*************************************************************************
# This file implements regression tests for SQLite library. This
# tests creating fts2 tables in an attached database.
#
# $Id: fts2j.test,v 1.1 2007/02/07 01:01:18 shess Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If SQLITE_ENABLE_FTS2 is defined, omit this file.
ifcapable !fts2 {
finish_test
return
}
# Clean up anything left over from a previous pass.
forcedelete test2.db
forcedelete test2.db-journal
sqlite3 db2 test2.db
db eval {
CREATE VIRTUAL TABLE t3 USING fts2(content);
INSERT INTO t3 (rowid, content) VALUES(1, "hello world");
}
db2 eval {
CREATE VIRTUAL TABLE t1 USING fts2(content);
INSERT INTO t1 (rowid, content) VALUES(1, "hello world");
INSERT INTO t1 (rowid, content) VALUES(2, "hello there");
INSERT INTO t1 (rowid, content) VALUES(3, "cruel world");
}
# This has always worked because the t1_* tables used by fts2 will be
# the defaults.
do_test fts2j-1.1 {
execsql {
ATTACH DATABASE 'test2.db' AS two;
SELECT rowid FROM t1 WHERE t1 MATCH 'hello';
DETACH DATABASE two;
}
} {1 2}
# Make certain we're detached if there was an error.
catch {db eval {DETACH DATABASE two}}
# In older code, this appears to work fine, but the t2_* tables used
# by fts2 will be created in database 'main' instead of database
# 'two'. It appears to work fine because the tables end up being the
# defaults, but obviously is badly broken if you hope to use things
# other than in the exact same ATTACH setup.
do_test fts2j-1.2 {
execsql {
ATTACH DATABASE 'test2.db' AS two;
CREATE VIRTUAL TABLE two.t2 USING fts2(content);
INSERT INTO t2 (rowid, content) VALUES(1, "hello world");
INSERT INTO t2 (rowid, content) VALUES(2, "hello there");
INSERT INTO t2 (rowid, content) VALUES(3, "cruel world");
SELECT rowid FROM t2 WHERE t2 MATCH 'hello';
DETACH DATABASE two;
}
} {1 2}
catch {db eval {DETACH DATABASE two}}
# In older code, this broke because the fts2 code attempted to create
# t3_* tables in database 'main', but they already existed. Normally
# this wouldn't happen without t3 itself existing, in which case the
# fts2 code would never be called in the first place.
do_test fts2j-1.3 {
execsql {
ATTACH DATABASE 'test2.db' AS two;
CREATE VIRTUAL TABLE two.t3 USING fts2(content);
INSERT INTO two.t3 (rowid, content) VALUES(2, "hello there");
INSERT INTO two.t3 (rowid, content) VALUES(3, "cruel world");
SELECT rowid FROM two.t3 WHERE t3 MATCH 'hello';
DETACH DATABASE two;
} db2
} {2}
catch {db eval {DETACH DATABASE two}}
catch {db2 close}
forcedelete test2.db
finish_test

View File

@ -1,105 +0,0 @@
# 2007 March 9
#
# The author disclaims copyright to this source code.
#
#*************************************************************************
# This file implements regression tests for SQLite library. These
# make sure that fts2 insertion buffering is fully transparent when
# using transactions.
#
# $Id: fts2k.test,v 1.2 2007/08/10 23:47:04 shess Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If SQLITE_ENABLE_FTS2 is defined, omit this file.
ifcapable !fts2 {
finish_test
return
}
db eval {
CREATE VIRTUAL TABLE t1 USING fts2(content);
INSERT INTO t1 (rowid, content) VALUES(1, "hello world");
INSERT INTO t1 (rowid, content) VALUES(2, "hello there");
INSERT INTO t1 (rowid, content) VALUES(3, "cruel world");
}
# Test that possibly-buffered inserts went through after commit.
do_test fts2k-1.1 {
execsql {
BEGIN TRANSACTION;
INSERT INTO t1 (rowid, content) VALUES(4, "false world");
INSERT INTO t1 (rowid, content) VALUES(5, "false door");
COMMIT TRANSACTION;
SELECT rowid FROM t1 WHERE t1 MATCH 'world';
}
} {1 3 4}
# Test that buffered inserts are seen by selects in the same
# transaction.
do_test fts2k-1.2 {
execsql {
BEGIN TRANSACTION;
INSERT INTO t1 (rowid, content) VALUES(6, "another world");
INSERT INTO t1 (rowid, content) VALUES(7, "another test");
SELECT rowid FROM t1 WHERE t1 MATCH 'world';
COMMIT TRANSACTION;
}
} {1 3 4 6}
# Test that buffered inserts are seen within a transaction. This is
# really the same test as 1.2.
do_test fts2k-1.3 {
execsql {
BEGIN TRANSACTION;
INSERT INTO t1 (rowid, content) VALUES(8, "second world");
INSERT INTO t1 (rowid, content) VALUES(9, "second sight");
SELECT rowid FROM t1 WHERE t1 MATCH 'world';
ROLLBACK TRANSACTION;
}
} {1 3 4 6 8}
# Double-check that the previous result doesn't persist past the
# rollback!
do_test fts2k-1.4 {
execsql {
SELECT rowid FROM t1 WHERE t1 MATCH 'world';
}
} {1 3 4 6}
# Test it all together.
do_test fts2k-1.5 {
execsql {
BEGIN TRANSACTION;
INSERT INTO t1 (rowid, content) VALUES(10, "second world");
INSERT INTO t1 (rowid, content) VALUES(11, "second sight");
ROLLBACK TRANSACTION;
SELECT rowid FROM t1 WHERE t1 MATCH 'world';
}
} {1 3 4 6}
# Test that the obvious case works.
do_test fts2k-1.6 {
execsql {
BEGIN;
INSERT INTO t1 (rowid, content) VALUES(12, "third world");
COMMIT;
SELECT rowid FROM t1 WHERE t1 MATCH 'third';
}
} {12}
# This is exactly the same as the previous test, except that older
# code loses the INSERT due to an SQLITE_SCHEMA error.
do_test fts2k-1.7 {
execsql {
BEGIN;
INSERT INTO t1 (rowid, content) VALUES(13, "third dimension");
CREATE TABLE x (c);
COMMIT;
SELECT rowid FROM t1 WHERE t1 MATCH 'dimension';
}
} {13}
finish_test

View File

@ -1,69 +0,0 @@
# 2007 March 28
#
# The author disclaims copyright to this source code.
#
#*************************************************************************
# This file implements regression tests for SQLite library. The focus
# of this script is testing isspace/isalnum/tolower problems with the
# FTS2 module. Unfortunately, this code isn't a really principled set
# of tests, because it is impossible to know where new uses of these
# functions might appear.
#
# $Id: fts2l.test,v 1.2 2007/12/13 21:54:11 drh Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If SQLITE_ENABLE_FTS2 is defined, omit this file.
ifcapable !fts2 {
finish_test
return
}
# Tests that startsWith() (calls isspace, tolower, isalnum) can handle
# hi-bit chars. parseSpec() also calls isalnum here.
do_test fts2l-1.1 {
execsql "CREATE VIRTUAL TABLE t1 USING fts2(content, \x80)"
} {}
# Additionally tests isspace() call in getToken(), and isalnum() call
# in tokenListToIdList().
do_test fts2l-1.2 {
catch {
execsql "CREATE VIRTUAL TABLE t2 USING fts2(content, tokenize \x80)"
}
sqlite3_errmsg $DB
} "unknown tokenizer: \x80"
# Additionally test final isalnum() in startsWith().
do_test fts2l-1.3 {
execsql "CREATE VIRTUAL TABLE t3 USING fts2(content, tokenize\x80)"
} {}
# The snippet-generation code has calls to isspace() which are sort of
# hard to get to. It finds convenient breakpoints by starting ~40
# chars before and after the matched term, and scanning ~10 chars
# around that position for isspace() characters. The long word with
# embedded hi-bit chars causes one of these isspace() calls to be
# exercised. The version with a couple extra spaces should cause the
# other isspace() call to be exercised. [Both cases have been tested
# in the debugger, but I'm hoping to continue to catch it if simple
# constant changes change things slightly.
#
# The trailing and leading hi-bit chars help with code which tests for
# isspace() to coalesce multiple spaces.
set word "\x80xxxxx\x80xxxxx\x80xxxxx\x80xxxxx\x80xxxxx\x80xxxxx\x80"
set phrase1 "$word $word $word target $word $word $word"
set phrase2 "$word $word $word target $word $word $word"
db eval {CREATE VIRTUAL TABLE t4 USING fts2(content)}
db eval "INSERT INTO t4 (content) VALUES ('$phrase1')"
db eval "INSERT INTO t4 (content) VALUES ('$phrase2')"
do_test fts2l-1.4 {
execsql {SELECT rowid, length(snippet(t4)) FROM t4 WHERE t4 MATCH 'target'}
} {1 111 2 117}
finish_test

View File

@ -1,65 +0,0 @@
# 2007 April 9
#
# The author disclaims copyright to this source code.
#
#*************************************************************************
# This file implements regression tests for SQLite library. fts2
# DELETE handling assumed all fields were non-null. This was not
# the intention at all.
#
# $Id: fts2m.test,v 1.1 2007/04/09 20:45:42 shess Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If SQLITE_ENABLE_FTS2 is defined, omit this file.
ifcapable !fts2 {
finish_test
return
}
db eval {
CREATE VIRTUAL TABLE t1 USING fts2(col_a, col_b);
INSERT INTO t1(rowid, col_a, col_b) VALUES(1, 'testing', 'testing');
INSERT INTO t1(rowid, col_a, col_b) VALUES(2, 'only a', null);
INSERT INTO t1(rowid, col_a, col_b) VALUES(3, null, 'only b');
INSERT INTO t1(rowid, col_a, col_b) VALUES(4, null, null);
}
do_test fts2m-1.0 {
execsql {
SELECT COUNT(col_a), COUNT(col_b), COUNT(*) FROM t1;
}
} {2 2 4}
do_test fts2m-1.1 {
execsql {
DELETE FROM t1 WHERE rowid = 1;
SELECT COUNT(col_a), COUNT(col_b), COUNT(*) FROM t1;
}
} {1 1 3}
do_test fts2m-1.2 {
execsql {
DELETE FROM t1 WHERE rowid = 2;
SELECT COUNT(col_a), COUNT(col_b), COUNT(*) FROM t1;
}
} {0 1 2}
do_test fts2m-1.3 {
execsql {
DELETE FROM t1 WHERE rowid = 3;
SELECT COUNT(col_a), COUNT(col_b), COUNT(*) FROM t1;
}
} {0 0 1}
do_test fts2m-1.4 {
execsql {
DELETE FROM t1 WHERE rowid = 4;
SELECT COUNT(col_a), COUNT(col_b), COUNT(*) FROM t1;
}
} {0 0 0}
finish_test

View File

@ -1,196 +0,0 @@
# 2007 April 26
#
# The author disclaims copyright to this source code.
#
#*************************************************************************
# This file implements tests for prefix-searching in the fts2
# component of the SQLite library.
#
# $Id: fts2n.test,v 1.2 2007/12/13 21:54:11 drh Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If SQLITE_ENABLE_FTS2 is defined, omit this file.
ifcapable !fts2 {
finish_test
return
}
# A large string to prime the pump with.
set text {
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas
iaculis mollis ipsum. Praesent rhoncus placerat justo. Duis non quam
sed turpis posuere placerat. Curabitur et lorem in lorem porttitor
aliquet. Pellentesque bibendum tincidunt diam. Vestibulum blandit
ante nec elit. In sapien diam, facilisis eget, dictum sed, viverra
at, felis. Vestibulum magna. Sed magna dolor, vestibulum rhoncus,
ornare vel, vulputate sit amet, felis. Integer malesuada, tellus at
luctus gravida, diam nunc porta nibh, nec imperdiet massa metus eu
lectus. Aliquam nisi. Nunc fringilla nulla at lectus. Suspendisse
potenti. Cum sociis natoque penatibus et magnis dis parturient
montes, nascetur ridiculus mus. Pellentesque odio nulla, feugiat eu,
suscipit nec, consequat quis, risus.
}
db eval {
CREATE VIRTUAL TABLE t1 USING fts2(c);
INSERT INTO t1(rowid, c) VALUES(1, $text);
INSERT INTO t1(rowid, c) VALUES(2, 'Another lovely row');
}
# Exact match
do_test fts2n-1.1 {
execsql "SELECT rowid FROM t1 WHERE t1 MATCH 'lorem'"
} {1}
# And a prefix
do_test fts2n-1.2 {
execsql "SELECT rowid FROM t1 WHERE t1 MATCH 'lore*'"
} {1}
# Prefix includes exact match
do_test fts2n-1.3 {
execsql "SELECT rowid FROM t1 WHERE t1 MATCH 'lorem*'"
} {1}
# Make certain everything isn't considered a prefix!
do_test fts2n-1.4 {
execsql "SELECT rowid FROM t1 WHERE t1 MATCH 'lore'"
} {}
# Prefix across multiple rows.
do_test fts2n-1.5 {
execsql "SELECT rowid FROM t1 WHERE t1 MATCH 'lo*'"
} {1 2}
# Likewise, with multiple hits in one document.
do_test fts2n-1.6 {
execsql "SELECT rowid FROM t1 WHERE t1 MATCH 'l*'"
} {1 2}
# Prefix which should only hit one document.
do_test fts2n-1.7 {
execsql "SELECT rowid FROM t1 WHERE t1 MATCH 'lov*'"
} {2}
# * not at end is dropped.
do_test fts2n-1.8 {
execsql "SELECT rowid FROM t1 WHERE t1 MATCH 'lo *'"
} {}
# Stand-alone * is dropped.
do_test fts2n-1.9 {
execsql "SELECT rowid FROM t1 WHERE t1 MATCH '*'"
} {}
# Phrase-query prefix.
do_test fts2n-1.10 {
execsql "SELECT rowid FROM t1 WHERE t1 MATCH '\"lovely r*\"'"
} {2}
do_test fts2n-1.11 {
execsql "SELECT rowid FROM t1 WHERE t1 MATCH '\"lovely r\"'"
} {}
# Phrase query with multiple prefix matches.
do_test fts2n-1.12 {
execsql "SELECT rowid FROM t1 WHERE t1 MATCH '\"a* l*\"'"
} {1 2}
# Phrase query with multiple prefix matches.
do_test fts2n-1.13 {
execsql "SELECT rowid FROM t1 WHERE t1 MATCH '\"a* l* row\"'"
} {2}
# Test across updates (and, by implication, deletes).
# Version of text without "lorem".
regsub -all {[Ll]orem} $text '' ntext
db eval {
CREATE VIRTUAL TABLE t2 USING fts2(c);
INSERT INTO t2(rowid, c) VALUES(1, $text);
INSERT INTO t2(rowid, c) VALUES(2, 'Another lovely row');
UPDATE t2 SET c = $ntext WHERE rowid = 1;
}
# Can't see lorem as an exact match.
do_test fts2n-2.1 {
execsql "SELECT rowid FROM t2 WHERE t2 MATCH 'lorem'"
} {}
# Can't see a prefix of lorem, either.
do_test fts2n-2.2 {
execsql "SELECT rowid FROM t2 WHERE t2 MATCH 'lore*'"
} {}
# Can see lovely in the other document.
do_test fts2n-2.3 {
execsql "SELECT rowid FROM t2 WHERE t2 MATCH 'lo*'"
} {2}
# Can still see other hits.
do_test fts2n-2.4 {
execsql "SELECT rowid FROM t2 WHERE t2 MATCH 'l*'"
} {1 2}
# Prefix which should only hit one document.
do_test fts2n-2.5 {
execsql "SELECT rowid FROM t2 WHERE t2 MATCH 'lov*'"
} {2}
# Test with a segment which will have multiple levels in the tree.
# Build a big document with lots of unique terms.
set bigtext $text
foreach c {a b c d e} {
regsub -all {[A-Za-z]+} $bigtext "&$c" t
append bigtext $t
}
# Populate a table with many copies of the big document, so that we
# can test the number of hits found. Populate $ret with the expected
# hit counts for each row. offsets() returns 4 elements for every
# hit. We'll have 6 hits for row 1, 1 for row 2, and 6*(2^5)==192 for
# $bigtext.
set ret {6 1}
db eval {
BEGIN;
CREATE VIRTUAL TABLE t3 USING fts2(c);
INSERT INTO t3(rowid, c) VALUES(1, $text);
INSERT INTO t3(rowid, c) VALUES(2, 'Another lovely row');
}
for {set i 0} {$i<100} {incr i} {
db eval {INSERT INTO t3(rowid, c) VALUES(3+$i, $bigtext)}
lappend ret 192
}
db eval {COMMIT;}
# Test that we get the expected number of hits.
do_test fts2n-3.1 {
set t {}
db eval {SELECT offsets(t3) as o FROM t3 WHERE t3 MATCH 'l*'} {
set l [llength $o]
lappend t [expr {$l/4}]
}
set t
} $ret
# TODO(shess) It would be useful to test a couple edge cases, but I
# don't know if we have the precision to manage it from here at this
# time. Prefix hits can cross leaves, which the code above _should_
# hit by virtue of size. There are two variations on this. If the
# tree is 2 levels high, the code will find the leaf-node extent
# directly, but if its higher, the code will have to follow two
# separate interior branches down the tree. Both should be tested.
finish_test

View File

@ -1,169 +0,0 @@
# 2007 June 20
#
# 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. The
# focus of this script is testing the FTS2 module.
#
# $Id: fts2o.test,v 1.4 2007/07/02 10:16:50 danielk1977 Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If SQLITE_ENABLE_FTS2 is not defined, omit this file.
ifcapable !fts2 {
finish_test
return
}
#---------------------------------------------------------------------
# These tests, fts2o-1.*, test that ticket #2429 is fixed.
#
db eval {
CREATE VIRTUAL TABLE t1 USING fts2(a, b, c);
INSERT INTO t1(a, b, c) VALUES('one three four', 'one four', 'one four two');
}
do_test fts2o-1.1 {
execsql {
SELECT rowid, snippet(t1) FROM t1 WHERE c MATCH 'four';
}
} {1 {one <b>four</b> two}}
do_test fts2o-1.2 {
execsql {
SELECT rowid, snippet(t1) FROM t1 WHERE b MATCH 'four';
}
} {1 {one <b>four</b>}}
do_test fts2o-1.3 {
execsql {
SELECT rowid, snippet(t1) FROM t1 WHERE a MATCH 'four';
}
} {1 {one three <b>four</b>}}
#---------------------------------------------------------------------
# Test that it is possible to rename an fts2 table.
#
do_test fts2o-2.1 {
execsql { SELECT tbl_name FROM sqlite_master WHERE type = 'table'}
} {t1 t1_content t1_segments t1_segdir}
do_test fts2o-2.2 {
execsql { ALTER TABLE t1 RENAME to fts_t1; }
} {}
do_test fts2o-2.3 {
execsql { SELECT rowid, snippet(fts_t1) FROM fts_t1 WHERE a MATCH 'four'; }
} {1 {one three <b>four</b>}}
do_test fts2o-2.4 {
execsql { SELECT tbl_name FROM sqlite_master WHERE type = 'table'}
} {fts_t1 fts_t1_content fts_t1_segments fts_t1_segdir}
# See what happens when renaming the fts2 table fails.
#
do_test fts2o-2.5 {
catchsql {
CREATE TABLE t1_segdir(a, b, c);
ALTER TABLE fts_t1 RENAME to t1;
}
} {1 {SQL logic error}}
do_test fts2o-2.6 {
execsql { SELECT rowid, snippet(fts_t1) FROM fts_t1 WHERE a MATCH 'four'; }
} {1 {one three <b>four</b>}}
do_test fts2o-2.7 {
execsql { SELECT tbl_name FROM sqlite_master WHERE type = 'table'}
} {fts_t1 fts_t1_content fts_t1_segments fts_t1_segdir t1_segdir}
# See what happens when renaming the fts2 table fails inside a transaction.
#
do_test fts2o-2.8 {
execsql {
BEGIN;
INSERT INTO fts_t1(a, b, c) VALUES('one two three', 'one four', 'one two');
}
} {}
do_test fts2o-2.9 {
catchsql {
ALTER TABLE fts_t1 RENAME to t1;
}
} {1 {SQL logic error}}
do_test fts2o-2.10 {
execsql { SELECT rowid, snippet(fts_t1) FROM fts_t1 WHERE a MATCH 'four'; }
} {1 {one three <b>four</b>}}
do_test fts2o-2.11 {
execsql { SELECT tbl_name FROM sqlite_master WHERE type = 'table'}
} {fts_t1 fts_t1_content fts_t1_segments fts_t1_segdir t1_segdir}
do_test fts2o-2.12 {
execsql COMMIT
execsql {SELECT a FROM fts_t1}
} {{one three four} {one two three}}
do_test fts2o-2.12 {
execsql { SELECT a, b, c FROM fts_t1 WHERE c MATCH 'four'; }
} {{one three four} {one four} {one four two}}
#-------------------------------------------------------------------
# Close, delete and reopen the database. The following test should
# be run on an initially empty db.
#
db close
forcedelete test.db test.db-journal
sqlite3 db test.db
do_test fts2o-3.1 {
execsql {
CREATE VIRTUAL TABLE t1 USING fts2(a, b, c);
INSERT INTO t1(a, b, c) VALUES('one three four', 'one four', 'one two');
SELECT a, b, c FROM t1 WHERE c MATCH 'two';
}
} {{one three four} {one four} {one two}}
# This test was crashing at one point.
#
do_test fts2o-3.2 {
execsql {
SELECT a, b, c FROM t1 WHERE c MATCH 'two';
CREATE TABLE t3(a, b, c);
SELECT a, b, c FROM t1 WHERE c MATCH 'two';
}
} {{one three four} {one four} {one two} {one three four} {one four} {one two}}
#---------------------------------------------------------------------
# Test that it is possible to rename an fts2 table in an attached
# database.
#
forcedelete test2.db test2.db-journal
do_test fts2o-3.1 {
execsql {
ATTACH 'test2.db' AS aux;
CREATE VIRTUAL TABLE aux.t1 USING fts2(a, b, c);
INSERT INTO aux.t1(a, b, c) VALUES(
'neung song sahm', 'neung see', 'neung see song'
);
}
} {}
do_test fts2o-3.2 {
execsql { SELECT a, b, c FROM aux.t1 WHERE a MATCH 'song'; }
} {{neung song sahm} {neung see} {neung see song}}
do_test fts2o-3.3 {
execsql { SELECT a, b, c FROM t1 WHERE c MATCH 'two'; }
} {{one three four} {one four} {one two}}
do_test fts2o-3.4 {
execsql { ALTER TABLE aux.t1 RENAME TO t2 }
} {}
do_test fts2o-3.2 {
execsql { SELECT a, b, c FROM t2 WHERE a MATCH 'song'; }
} {{neung song sahm} {neung see} {neung see song}}
do_test fts2o-3.3 {
execsql { SELECT a, b, c FROM t1 WHERE c MATCH 'two'; }
} {{one three four} {one four} {one two}}
finish_test

View File

@ -1,357 +0,0 @@
# 2008 June 26
#
# 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 exercises some new testing functions in the FTS2 module,
# and then uses them to do some basic tests that FTS2 is internally
# working as expected.
#
# $Id: fts2p.test,v 1.1 2008/07/22 23:32:28 shess Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If SQLITE_ENABLE_FTS2 is not defined, omit this file.
ifcapable !fts2 {
finish_test
return
}
#*************************************************************************
# Probe to see if support for these functions is compiled in.
# TODO(shess): Change main.mk to do the right thing and remove this test.
db eval {
DROP TABLE IF EXISTS t1;
CREATE VIRTUAL TABLE t1 USING fts2(c);
INSERT INTO t1 (rowid, c) VALUES (1, 'x');
}
set s {SELECT dump_terms(t1, 1) FROM t1 LIMIT 1}
set r {1 {unable to use function dump_terms in the requested context}}
if {[catchsql $s]==$r} {
finish_test
return
}
#*************************************************************************
# Test that the new functions give appropriate errors.
do_test fts2p-0.0 {
catchsql {
SELECT dump_terms(t1, 1) FROM t1 LIMIT 1;
}
} {1 {dump_terms: incorrect arguments}}
do_test fts2p-0.1 {
catchsql {
SELECT dump_terms(t1, 0, 0, 0) FROM t1 LIMIT 1;
}
} {1 {dump_terms: incorrect arguments}}
do_test fts2p-0.2 {
catchsql {
SELECT dump_terms(1, t1) FROM t1 LIMIT 1;
}
} {1 {unable to use function dump_terms in the requested context}}
do_test fts2p-0.3 {
catchsql {
SELECT dump_terms(t1, 16, 16) FROM t1 LIMIT 1;
}
} {1 {dump_terms: segment not found}}
do_test fts2p-0.4 {
catchsql {
SELECT dump_doclist(t1) FROM t1 LIMIT 1;
}
} {1 {dump_doclist: incorrect arguments}}
do_test fts2p-0.5 {
catchsql {
SELECT dump_doclist(t1, NULL) FROM t1 LIMIT 1;
}
} {1 {dump_doclist: empty second argument}}
do_test fts2p-0.6 {
catchsql {
SELECT dump_doclist(t1, '') FROM t1 LIMIT 1;
}
} {1 {dump_doclist: empty second argument}}
do_test fts2p-0.7 {
catchsql {
SELECT dump_doclist(t1, 'a', 0) FROM t1 LIMIT 1;
}
} {1 {dump_doclist: incorrect arguments}}
do_test fts2p-0.8 {
catchsql {
SELECT dump_doclist(t1, 'a', 0, 0, 0) FROM t1 LIMIT 1;
}
} {1 {dump_doclist: incorrect arguments}}
do_test fts2p-0.9 {
catchsql {
SELECT dump_doclist(t1, 'a', 16, 16) FROM t1 LIMIT 1;
}
} {1 {dump_doclist: segment not found}}
#*************************************************************************
# Utility function to check for the expected terms in the segment
# level/index. _all version does same but for entire index.
proc check_terms {test level index terms} {
# TODO(shess): Figure out why uplevel in do_test can't catch
# $level and $index directly.
set ::level $level
set ::index $index
do_test $test.terms {
execsql {
SELECT dump_terms(t1, $::level, $::index) FROM t1 LIMIT 1;
}
} [list $terms]
}
proc check_terms_all {test terms} {
do_test $test.terms {
execsql {
SELECT dump_terms(t1) FROM t1 LIMIT 1;
}
} [list $terms]
}
# Utility function to check for the expected doclist for the term in
# segment level/index. _all version does same for entire index.
proc check_doclist {test level index term doclist} {
# TODO(shess): Again, why can't the non-:: versions work?
set ::term $term
set ::level $level
set ::index $index
do_test $test {
execsql {
SELECT dump_doclist(t1, $::term, $::level, $::index) FROM t1 LIMIT 1;
}
} [list $doclist]
}
proc check_doclist_all {test term doclist} {
set ::term $term
do_test $test {
execsql {
SELECT dump_doclist(t1, $::term) FROM t1 LIMIT 1;
}
} [list $doclist]
}
#*************************************************************************
# Test the segments resulting from straight-forward inserts.
db eval {
DROP TABLE IF EXISTS t1;
CREATE VIRTUAL TABLE t1 USING fts2(c);
INSERT INTO t1 (rowid, c) VALUES (1, 'This is a test');
INSERT INTO t1 (rowid, c) VALUES (2, 'That was a test');
INSERT INTO t1 (rowid, c) VALUES (3, 'This is a test');
}
# Check for expected segments and expected matches.
do_test fts2p-1.0.segments {
execsql {
SELECT level, idx FROM t1_segdir ORDER BY level, idx;
}
} {0 0 0 1 0 2}
do_test fts2p-1.0.matches {
execsql {
SELECT OFFSETS(t1) FROM t1
WHERE t1 MATCH 'this OR that OR was OR a OR is OR test' ORDER BY rowid;
}
} [list {0 0 0 4 0 4 5 2 0 3 8 1 0 5 10 4} \
{0 1 0 4 0 2 5 3 0 3 9 1 0 5 11 4} \
{0 0 0 4 0 4 5 2 0 3 8 1 0 5 10 4}]
# Check the specifics of the segments constructed.
# Logical view of entire index.
check_terms_all fts2p-1.0.1 {a is test that this was}
check_doclist_all fts2p-1.0.1.1 a {[1 0[2]] [2 0[2]] [3 0[2]]}
check_doclist_all fts2p-1.0.1.2 is {[1 0[1]] [3 0[1]]}
check_doclist_all fts2p-1.0.1.3 test {[1 0[3]] [2 0[3]] [3 0[3]]}
check_doclist_all fts2p-1.0.1.4 that {[2 0[0]]}
check_doclist_all fts2p-1.0.1.5 this {[1 0[0]] [3 0[0]]}
check_doclist_all fts2p-1.0.1.6 was {[2 0[1]]}
# Segment 0,0
check_terms fts2p-1.0.2 0 0 {a is test this}
check_doclist fts2p-1.0.2.1 0 0 a {[1 0[2]]}
check_doclist fts2p-1.0.2.2 0 0 is {[1 0[1]]}
check_doclist fts2p-1.0.2.3 0 0 test {[1 0[3]]}
check_doclist fts2p-1.0.2.4 0 0 this {[1 0[0]]}
# Segment 0,1
check_terms fts2p-1.0.3 0 1 {a test that was}
check_doclist fts2p-1.0.3.1 0 1 a {[2 0[2]]}
check_doclist fts2p-1.0.3.2 0 1 test {[2 0[3]]}
check_doclist fts2p-1.0.3.3 0 1 that {[2 0[0]]}
check_doclist fts2p-1.0.3.4 0 1 was {[2 0[1]]}
# Segment 0,2
check_terms fts2p-1.0.4 0 2 {a is test this}
check_doclist fts2p-1.0.4.1 0 2 a {[3 0[2]]}
check_doclist fts2p-1.0.4.2 0 2 is {[3 0[1]]}
check_doclist fts2p-1.0.4.3 0 2 test {[3 0[3]]}
check_doclist fts2p-1.0.4.4 0 2 this {[3 0[0]]}
#*************************************************************************
# Test the segments resulting from inserts followed by a delete.
db eval {
DROP TABLE IF EXISTS t1;
CREATE VIRTUAL TABLE t1 USING fts2(c);
INSERT INTO t1 (rowid, c) VALUES (1, 'This is a test');
INSERT INTO t1 (rowid, c) VALUES (2, 'That was a test');
INSERT INTO t1 (rowid, c) VALUES (3, 'This is a test');
DELETE FROM t1 WHERE rowid = 1;
}
do_test fts2p-1.1.segments {
execsql {
SELECT level, idx FROM t1_segdir ORDER BY level, idx;
}
} {0 0 0 1 0 2 0 3}
do_test fts2p-1.1.matches {
execsql {
SELECT OFFSETS(t1) FROM t1
WHERE t1 MATCH 'this OR that OR was OR a OR is OR test' ORDER BY rowid;
}
} {{0 1 0 4 0 2 5 3 0 3 9 1 0 5 11 4} {0 0 0 4 0 4 5 2 0 3 8 1 0 5 10 4}}
check_terms_all fts2p-1.1.1 {a is test that this was}
check_doclist_all fts2p-1.1.1.1 a {[2 0[2]] [3 0[2]]}
check_doclist_all fts2p-1.1.1.2 is {[3 0[1]]}
check_doclist_all fts2p-1.1.1.3 test {[2 0[3]] [3 0[3]]}
check_doclist_all fts2p-1.1.1.4 that {[2 0[0]]}
check_doclist_all fts2p-1.1.1.5 this {[3 0[0]]}
check_doclist_all fts2p-1.1.1.6 was {[2 0[1]]}
check_terms fts2p-1.1.2 0 0 {a is test this}
check_doclist fts2p-1.1.2.1 0 0 a {[1 0[2]]}
check_doclist fts2p-1.1.2.2 0 0 is {[1 0[1]]}
check_doclist fts2p-1.1.2.3 0 0 test {[1 0[3]]}
check_doclist fts2p-1.1.2.4 0 0 this {[1 0[0]]}
check_terms fts2p-1.1.3 0 1 {a test that was}
check_doclist fts2p-1.1.3.1 0 1 a {[2 0[2]]}
check_doclist fts2p-1.1.3.2 0 1 test {[2 0[3]]}
check_doclist fts2p-1.1.3.3 0 1 that {[2 0[0]]}
check_doclist fts2p-1.1.3.4 0 1 was {[2 0[1]]}
check_terms fts2p-1.1.4 0 2 {a is test this}
check_doclist fts2p-1.1.4.1 0 2 a {[3 0[2]]}
check_doclist fts2p-1.1.4.2 0 2 is {[3 0[1]]}
check_doclist fts2p-1.1.4.3 0 2 test {[3 0[3]]}
check_doclist fts2p-1.1.4.4 0 2 this {[3 0[0]]}
check_terms fts2p-1.1.5 0 3 {a is test this}
check_doclist fts2p-1.1.5.1 0 3 a {[1]}
check_doclist fts2p-1.1.5.2 0 3 is {[1]}
check_doclist fts2p-1.1.5.3 0 3 test {[1]}
check_doclist fts2p-1.1.5.4 0 3 this {[1]}
#*************************************************************************
# Test results when all references to certain tokens are deleted.
db eval {
DROP TABLE IF EXISTS t1;
CREATE VIRTUAL TABLE t1 USING fts2(c);
INSERT INTO t1 (rowid, c) VALUES (1, 'This is a test');
INSERT INTO t1 (rowid, c) VALUES (2, 'That was a test');
INSERT INTO t1 (rowid, c) VALUES (3, 'This is a test');
DELETE FROM t1 WHERE rowid IN (1,3);
}
# Still 4 segments because 0,3 will contain deletes for rowid 1 and 3.
do_test fts2p-1.2.segments {
execsql {
SELECT level, idx FROM t1_segdir ORDER BY level, idx;
}
} {0 0 0 1 0 2 0 3}
do_test fts2p-1.2.matches {
execsql {
SELECT OFFSETS(t1) FROM t1
WHERE t1 MATCH 'this OR that OR was OR a OR is OR test' ORDER BY rowid;
}
} {{0 1 0 4 0 2 5 3 0 3 9 1 0 5 11 4}}
check_terms_all fts2p-1.2.1 {a is test that this was}
check_doclist_all fts2p-1.2.1.1 a {[2 0[2]]}
check_doclist_all fts2p-1.2.1.2 is {}
check_doclist_all fts2p-1.2.1.3 test {[2 0[3]]}
check_doclist_all fts2p-1.2.1.4 that {[2 0[0]]}
check_doclist_all fts2p-1.2.1.5 this {}
check_doclist_all fts2p-1.2.1.6 was {[2 0[1]]}
check_terms fts2p-1.2.2 0 0 {a is test this}
check_doclist fts2p-1.2.2.1 0 0 a {[1 0[2]]}
check_doclist fts2p-1.2.2.2 0 0 is {[1 0[1]]}
check_doclist fts2p-1.2.2.3 0 0 test {[1 0[3]]}
check_doclist fts2p-1.2.2.4 0 0 this {[1 0[0]]}
check_terms fts2p-1.2.3 0 1 {a test that was}
check_doclist fts2p-1.2.3.1 0 1 a {[2 0[2]]}
check_doclist fts2p-1.2.3.2 0 1 test {[2 0[3]]}
check_doclist fts2p-1.2.3.3 0 1 that {[2 0[0]]}
check_doclist fts2p-1.2.3.4 0 1 was {[2 0[1]]}
check_terms fts2p-1.2.4 0 2 {a is test this}
check_doclist fts2p-1.2.4.1 0 2 a {[3 0[2]]}
check_doclist fts2p-1.2.4.2 0 2 is {[3 0[1]]}
check_doclist fts2p-1.2.4.3 0 2 test {[3 0[3]]}
check_doclist fts2p-1.2.4.4 0 2 this {[3 0[0]]}
check_terms fts2p-1.2.5 0 3 {a is test this}
check_doclist fts2p-1.2.5.1 0 3 a {[1] [3]}
check_doclist fts2p-1.2.5.2 0 3 is {[1] [3]}
check_doclist fts2p-1.2.5.3 0 3 test {[1] [3]}
check_doclist fts2p-1.2.5.4 0 3 this {[1] [3]}
#*************************************************************************
# Test results when everything is optimized manually.
db eval {
DROP TABLE IF EXISTS t1;
CREATE VIRTUAL TABLE t1 USING fts2(c);
INSERT INTO t1 (rowid, c) VALUES (1, 'This is a test');
INSERT INTO t1 (rowid, c) VALUES (2, 'That was a test');
INSERT INTO t1 (rowid, c) VALUES (3, 'This is a test');
DELETE FROM t1 WHERE rowid IN (1,3);
DROP TABLE IF EXISTS t1old;
ALTER TABLE t1 RENAME TO t1old;
CREATE VIRTUAL TABLE t1 USING fts2(c);
INSERT INTO t1 (rowid, c) SELECT rowid, c FROM t1old;
DROP TABLE t1old;
}
# Should be a single optimal segment with the same logical results.
do_test fts2p-1.3.segments {
execsql {
SELECT level, idx FROM t1_segdir ORDER BY level, idx;
}
} {0 0}
do_test fts2p-1.3.matches {
execsql {
SELECT OFFSETS(t1) FROM t1
WHERE t1 MATCH 'this OR that OR was OR a OR is OR test' ORDER BY rowid;
}
} {{0 1 0 4 0 2 5 3 0 3 9 1 0 5 11 4}}
check_terms_all fts2p-1.3.1 {a test that was}
check_doclist_all fts2p-1.3.1.1 a {[2 0[2]]}
check_doclist_all fts2p-1.3.1.2 test {[2 0[3]]}
check_doclist_all fts2p-1.3.1.3 that {[2 0[0]]}
check_doclist_all fts2p-1.3.1.4 was {[2 0[1]]}
check_terms fts2p-1.3.2 0 0 {a test that was}
check_doclist fts2p-1.3.2.1 0 0 a {[2 0[2]]}
check_doclist fts2p-1.3.2.2 0 0 test {[2 0[3]]}
check_doclist fts2p-1.3.2.3 0 0 that {[2 0[0]]}
check_doclist fts2p-1.3.2.4 0 0 was {[2 0[1]]}
finish_test

View File

@ -1,346 +0,0 @@
# 2008 June 26
#
# 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. The focus
# of this script is testing the FTS2 module's optimize() function.
#
# $Id: fts2q.test,v 1.2 2008/07/22 23:49:44 shess Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If SQLITE_ENABLE_FTS2 is not defined, omit this file.
ifcapable !fts2 {
finish_test
return
}
#*************************************************************************
# Probe to see if support for the FTS2 dump_* functions is compiled in.
# TODO(shess): Change main.mk to do the right thing and remove this test.
db eval {
DROP TABLE IF EXISTS t1;
CREATE VIRTUAL TABLE t1 USING fts2(c);
INSERT INTO t1 (rowid, c) VALUES (1, 'x');
}
set s {SELECT dump_terms(t1, 1) FROM t1 LIMIT 1}
set r {1 {unable to use function dump_terms in the requested context}}
if {[catchsql $s]==$r} {
finish_test
return
}
#*************************************************************************
# Utility function to check for the expected terms in the segment
# level/index. _all version does same but for entire index.
proc check_terms {test level index terms} {
# TODO(shess): Figure out why uplevel in do_test can't catch
# $level and $index directly.
set ::level $level
set ::index $index
do_test $test.terms {
execsql {
SELECT dump_terms(t1, $::level, $::index) FROM t1 LIMIT 1;
}
} [list $terms]
}
proc check_terms_all {test terms} {
do_test $test.terms {
execsql {
SELECT dump_terms(t1) FROM t1 LIMIT 1;
}
} [list $terms]
}
# Utility function to check for the expected doclist for the term in
# segment level/index. _all version does same for entire index.
proc check_doclist {test level index term doclist} {
# TODO(shess): Again, why can't the non-:: versions work?
set ::term $term
set ::level $level
set ::index $index
do_test $test {
execsql {
SELECT dump_doclist(t1, $::term, $::level, $::index) FROM t1 LIMIT 1;
}
} [list $doclist]
}
proc check_doclist_all {test term doclist} {
set ::term $term
do_test $test {
execsql {
SELECT dump_doclist(t1, $::term) FROM t1 LIMIT 1;
}
} [list $doclist]
}
#*************************************************************************
# Test results when all rows are deleted and one is added back.
# Previously older segments would continue to exist, but now the index
# should be dropped when the table is empty. The results should look
# exactly like we never added the earlier rows in the first place.
db eval {
DROP TABLE IF EXISTS t1;
CREATE VIRTUAL TABLE t1 USING fts2(c);
INSERT INTO t1 (rowid, c) VALUES (1, 'This is a test');
INSERT INTO t1 (rowid, c) VALUES (2, 'That was a test');
INSERT INTO t1 (rowid, c) VALUES (3, 'This is a test');
DELETE FROM t1 WHERE 1=1; -- Delete each row rather than dropping table.
INSERT INTO t1 (rowid, c) VALUES (1, 'This is a test');
}
# Should be a single initial segment.
do_test fts2q-1.segments {
execsql {
SELECT level, idx FROM t1_segdir ORDER BY level, idx;
}
} {0 0}
do_test fts2q-1.matches {
execsql {
SELECT OFFSETS(t1) FROM t1
WHERE t1 MATCH 'this OR that OR was OR a OR is OR test' ORDER BY rowid;
}
} {{0 0 0 4 0 4 5 2 0 3 8 1 0 5 10 4}}
check_terms_all fts2q-1.1 {a is test this}
check_doclist_all fts2q-1.1.1 a {[1 0[2]]}
check_doclist_all fts2q-1.1.2 is {[1 0[1]]}
check_doclist_all fts2q-1.1.3 test {[1 0[3]]}
check_doclist_all fts2q-1.1.4 this {[1 0[0]]}
check_terms fts2q-1.2 0 0 {a is test this}
check_doclist fts2q-1.2.1 0 0 a {[1 0[2]]}
check_doclist fts2q-1.2.2 0 0 is {[1 0[1]]}
check_doclist fts2q-1.2.3 0 0 test {[1 0[3]]}
check_doclist fts2q-1.2.4 0 0 this {[1 0[0]]}
#*************************************************************************
# Test results when everything is optimized manually.
# NOTE(shess): This is a copy of fts2c-1.3. I've pulled a copy here
# because fts2q-2 and fts2q-3 should have identical results.
db eval {
DROP TABLE IF EXISTS t1;
CREATE VIRTUAL TABLE t1 USING fts2(c);
INSERT INTO t1 (rowid, c) VALUES (1, 'This is a test');
INSERT INTO t1 (rowid, c) VALUES (2, 'That was a test');
INSERT INTO t1 (rowid, c) VALUES (3, 'This is a test');
DELETE FROM t1 WHERE rowid IN (1,3);
DROP TABLE IF EXISTS t1old;
ALTER TABLE t1 RENAME TO t1old;
CREATE VIRTUAL TABLE t1 USING fts2(c);
INSERT INTO t1 (rowid, c) SELECT rowid, c FROM t1old;
DROP TABLE t1old;
}
# Should be a single optimal segment with the same logical results.
do_test fts2q-2.segments {
execsql {
SELECT level, idx FROM t1_segdir ORDER BY level, idx;
}
} {0 0}
do_test fts2q-2.matches {
execsql {
SELECT OFFSETS(t1) FROM t1
WHERE t1 MATCH 'this OR that OR was OR a OR is OR test' ORDER BY rowid;
}
} {{0 1 0 4 0 2 5 3 0 3 9 1 0 5 11 4}}
check_terms_all fts2q-2.1 {a test that was}
check_doclist_all fts2q-2.1.1 a {[2 0[2]]}
check_doclist_all fts2q-2.1.2 test {[2 0[3]]}
check_doclist_all fts2q-2.1.3 that {[2 0[0]]}
check_doclist_all fts2q-2.1.4 was {[2 0[1]]}
check_terms fts2q-2.2 0 0 {a test that was}
check_doclist fts2q-2.2.1 0 0 a {[2 0[2]]}
check_doclist fts2q-2.2.2 0 0 test {[2 0[3]]}
check_doclist fts2q-2.2.3 0 0 that {[2 0[0]]}
check_doclist fts2q-2.2.4 0 0 was {[2 0[1]]}
#*************************************************************************
# Test results when everything is optimized via optimize().
db eval {
DROP TABLE IF EXISTS t1;
CREATE VIRTUAL TABLE t1 USING fts2(c);
INSERT INTO t1 (rowid, c) VALUES (1, 'This is a test');
INSERT INTO t1 (rowid, c) VALUES (2, 'That was a test');
INSERT INTO t1 (rowid, c) VALUES (3, 'This is a test');
DELETE FROM t1 WHERE rowid IN (1,3);
SELECT OPTIMIZE(t1) FROM t1 LIMIT 1;
}
# Should be a single optimal segment with the same logical results.
do_test fts2q-3.segments {
execsql {
SELECT level, idx FROM t1_segdir ORDER BY level, idx;
}
} {0 0}
do_test fts2q-3.matches {
execsql {
SELECT OFFSETS(t1) FROM t1
WHERE t1 MATCH 'this OR that OR was OR a OR is OR test' ORDER BY rowid;
}
} {{0 1 0 4 0 2 5 3 0 3 9 1 0 5 11 4}}
check_terms_all fts2q-3.1 {a test that was}
check_doclist_all fts2q-3.1.1 a {[2 0[2]]}
check_doclist_all fts2q-3.1.2 test {[2 0[3]]}
check_doclist_all fts2q-3.1.3 that {[2 0[0]]}
check_doclist_all fts2q-3.1.4 was {[2 0[1]]}
check_terms fts2q-3.2 0 0 {a test that was}
check_doclist fts2q-3.2.1 0 0 a {[2 0[2]]}
check_doclist fts2q-3.2.2 0 0 test {[2 0[3]]}
check_doclist fts2q-3.2.3 0 0 that {[2 0[0]]}
check_doclist fts2q-3.2.4 0 0 was {[2 0[1]]}
#*************************************************************************
# Test optimize() against a table involving segment merges.
# NOTE(shess): Since there's no transaction, each of the INSERT/UPDATE
# statements generates a segment.
db eval {
DROP TABLE IF EXISTS t1;
CREATE VIRTUAL TABLE t1 USING fts2(c);
INSERT INTO t1 (rowid, c) VALUES (1, 'This is a test');
INSERT INTO t1 (rowid, c) VALUES (2, 'That was a test');
INSERT INTO t1 (rowid, c) VALUES (3, 'This is a test');
UPDATE t1 SET c = 'This is a test one' WHERE rowid = 1;
UPDATE t1 SET c = 'That was a test one' WHERE rowid = 2;
UPDATE t1 SET c = 'This is a test one' WHERE rowid = 3;
UPDATE t1 SET c = 'This is a test two' WHERE rowid = 1;
UPDATE t1 SET c = 'That was a test two' WHERE rowid = 2;
UPDATE t1 SET c = 'This is a test two' WHERE rowid = 3;
UPDATE t1 SET c = 'This is a test three' WHERE rowid = 1;
UPDATE t1 SET c = 'That was a test three' WHERE rowid = 2;
UPDATE t1 SET c = 'This is a test three' WHERE rowid = 3;
UPDATE t1 SET c = 'This is a test four' WHERE rowid = 1;
UPDATE t1 SET c = 'That was a test four' WHERE rowid = 2;
UPDATE t1 SET c = 'This is a test four' WHERE rowid = 3;
UPDATE t1 SET c = 'This is a test' WHERE rowid = 1;
UPDATE t1 SET c = 'That was a test' WHERE rowid = 2;
UPDATE t1 SET c = 'This is a test' WHERE rowid = 3;
}
# 2 segments in level 0, 1 in level 1 (18 segments created, 16
# merged).
do_test fts2q-4.segments {
execsql {
SELECT level, idx FROM t1_segdir ORDER BY level, idx;
}
} {0 0 0 1 1 0}
do_test fts2q-4.matches {
execsql {
SELECT OFFSETS(t1) FROM t1
WHERE t1 MATCH 'this OR that OR was OR a OR is OR test' ORDER BY rowid;
}
} [list {0 0 0 4 0 4 5 2 0 3 8 1 0 5 10 4} \
{0 1 0 4 0 2 5 3 0 3 9 1 0 5 11 4} \
{0 0 0 4 0 4 5 2 0 3 8 1 0 5 10 4}]
check_terms_all fts2q-4.1 {a four is one test that this three two was}
check_doclist_all fts2q-4.1.1 a {[1 0[2]] [2 0[2]] [3 0[2]]}
check_doclist_all fts2q-4.1.2 four {}
check_doclist_all fts2q-4.1.3 is {[1 0[1]] [3 0[1]]}
check_doclist_all fts2q-4.1.4 one {}
check_doclist_all fts2q-4.1.5 test {[1 0[3]] [2 0[3]] [3 0[3]]}
check_doclist_all fts2q-4.1.6 that {[2 0[0]]}
check_doclist_all fts2q-4.1.7 this {[1 0[0]] [3 0[0]]}
check_doclist_all fts2q-4.1.8 three {}
check_doclist_all fts2q-4.1.9 two {}
check_doclist_all fts2q-4.1.10 was {[2 0[1]]}
check_terms fts2q-4.2 0 0 {a four test that was}
check_doclist fts2q-4.2.1 0 0 a {[2 0[2]]}
check_doclist fts2q-4.2.2 0 0 four {[2]}
check_doclist fts2q-4.2.3 0 0 test {[2 0[3]]}
check_doclist fts2q-4.2.4 0 0 that {[2 0[0]]}
check_doclist fts2q-4.2.5 0 0 was {[2 0[1]]}
check_terms fts2q-4.3 0 1 {a four is test this}
check_doclist fts2q-4.3.1 0 1 a {[3 0[2]]}
check_doclist fts2q-4.3.2 0 1 four {[3]}
check_doclist fts2q-4.3.3 0 1 is {[3 0[1]]}
check_doclist fts2q-4.3.4 0 1 test {[3 0[3]]}
check_doclist fts2q-4.3.5 0 1 this {[3 0[0]]}
check_terms fts2q-4.4 1 0 {a four is one test that this three two was}
check_doclist fts2q-4.4.1 1 0 a {[1 0[2]] [2 0[2]] [3 0[2]]}
check_doclist fts2q-4.4.2 1 0 four {[1] [2 0[4]] [3 0[4]]}
check_doclist fts2q-4.4.3 1 0 is {[1 0[1]] [3 0[1]]}
check_doclist fts2q-4.4.4 1 0 one {[1] [2] [3]}
check_doclist fts2q-4.4.5 1 0 test {[1 0[3]] [2 0[3]] [3 0[3]]}
check_doclist fts2q-4.4.6 1 0 that {[2 0[0]]}
check_doclist fts2q-4.4.7 1 0 this {[1 0[0]] [3 0[0]]}
check_doclist fts2q-4.4.8 1 0 three {[1] [2] [3]}
check_doclist fts2q-4.4.9 1 0 two {[1] [2] [3]}
check_doclist fts2q-4.4.10 1 0 was {[2 0[1]]}
# Optimize should leave the result in the level of the highest-level
# prior segment.
do_test fts2q-4.5 {
execsql {
SELECT OPTIMIZE(t1) FROM t1 LIMIT 1;
SELECT level, idx FROM t1_segdir ORDER BY level, idx;
}
} {{Index optimized} 1 0}
# Identical to fts2q-4.matches.
do_test fts2q-4.5.matches {
execsql {
SELECT OFFSETS(t1) FROM t1
WHERE t1 MATCH 'this OR that OR was OR a OR is OR test' ORDER BY rowid;
}
} [list {0 0 0 4 0 4 5 2 0 3 8 1 0 5 10 4} \
{0 1 0 4 0 2 5 3 0 3 9 1 0 5 11 4} \
{0 0 0 4 0 4 5 2 0 3 8 1 0 5 10 4}]
check_terms_all fts2q-4.5.1 {a is test that this was}
check_doclist_all fts2q-4.5.1.1 a {[1 0[2]] [2 0[2]] [3 0[2]]}
check_doclist_all fts2q-4.5.1.2 is {[1 0[1]] [3 0[1]]}
check_doclist_all fts2q-4.5.1.3 test {[1 0[3]] [2 0[3]] [3 0[3]]}
check_doclist_all fts2q-4.5.1.4 that {[2 0[0]]}
check_doclist_all fts2q-4.5.1.5 this {[1 0[0]] [3 0[0]]}
check_doclist_all fts2q-4.5.1.6 was {[2 0[1]]}
check_terms fts2q-4.5.2 1 0 {a is test that this was}
check_doclist fts2q-4.5.2.1 1 0 a {[1 0[2]] [2 0[2]] [3 0[2]]}
check_doclist fts2q-4.5.2.2 1 0 is {[1 0[1]] [3 0[1]]}
check_doclist fts2q-4.5.2.3 1 0 test {[1 0[3]] [2 0[3]] [3 0[3]]}
check_doclist fts2q-4.5.2.4 1 0 that {[2 0[0]]}
check_doclist fts2q-4.5.2.5 1 0 this {[1 0[0]] [3 0[0]]}
check_doclist fts2q-4.5.2.6 1 0 was {[2 0[1]]}
# Re-optimizing does nothing.
do_test fts2q-5.0 {
execsql {
SELECT OPTIMIZE(t1) FROM t1 LIMIT 1;
SELECT level, idx FROM t1_segdir ORDER BY level, idx;
}
} {{Index already optimal} 1 0}
# Even if we move things around, still does nothing.
do_test fts2q-5.1 {
execsql {
UPDATE t1_segdir SET level = 2 WHERE level = 1 AND idx = 0;
SELECT OPTIMIZE(t1) FROM t1 LIMIT 1;
SELECT level, idx FROM t1_segdir ORDER BY level, idx;
}
} {{Index already optimal} 2 0}
finish_test

View File

@ -1,121 +0,0 @@
# 2008 July 29
#
# 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.
#
#*************************************************************************
# These tests exercise the various types of fts2 cursors.
#
# $Id: fts2r.test,v 1.1 2008/07/29 20:38:18 shess Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If SQLITE_ENABLE_FTS2 is not defined, omit this file.
ifcapable !fts2 {
finish_test
return
}
#*************************************************************************
# Test table scan (QUERY_GENERIC). This kind of query happens for
# queries with no WHERE clause, or for WHERE clauses which cannot be
# satisfied by an index.
db eval {
DROP TABLE IF EXISTS t1;
CREATE VIRTUAL TABLE t1 USING fts2(c);
INSERT INTO t1 (rowid, c) VALUES (1, 'This is a test');
INSERT INTO t1 (rowid, c) VALUES (2, 'That was a test');
INSERT INTO t1 (rowid, c) VALUES (3, 'This is a test');
}
do_test fts2e-1.1 {
execsql {
SELECT rowid FROM t1 ORDER BY rowid;
}
} {1 2 3}
do_test fts2e-1.2 {
execsql {
SELECT rowid FROM t1 WHERE c LIKE '%test' ORDER BY rowid;
}
} {1 2 3}
do_test fts2e-1.3 {
execsql {
SELECT rowid FROM t1 WHERE c LIKE 'That%' ORDER BY rowid;
}
} {2}
#*************************************************************************
# Test lookup by rowid (QUERY_ROWID). This kind of query happens for
# queries which select by the rowid implicit index.
db eval {
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE VIRTUAL TABLE t1 USING fts2(c);
CREATE TABLE t2(id INTEGER PRIMARY KEY AUTOINCREMENT, weight INTEGER UNIQUE);
INSERT INTO t2 VALUES (null, 10);
INSERT INTO t1 (rowid, c) VALUES (last_insert_rowid(), 'This is a test');
INSERT INTO t2 VALUES (null, 5);
INSERT INTO t1 (rowid, c) VALUES (last_insert_rowid(), 'That was a test');
INSERT INTO t2 VALUES (null, 20);
INSERT INTO t1 (rowid, c) VALUES (last_insert_rowid(), 'This is a test');
}
# TODO(shess): This actually is doing QUERY_GENERIC? I'd have
# expected QUERY_ROWID in this case, as for a very large table the
# full scan is less efficient.
do_test fts2e-2.1 {
execsql {
SELECT rowid FROM t1 WHERE rowid in (1, 2, 10);
}
} {1 2}
do_test fts2e-2.2 {
execsql {
SELECT t1.rowid, weight FROM t1, t2 WHERE t2.id = t1.rowid ORDER BY weight;
}
} {2 5 1 10 3 20}
do_test fts2e-2.3 {
execsql {
SELECT t1.rowid, weight FROM t1, t2
WHERE t2.weight>5 AND t2.id = t1.rowid ORDER BY weight;
}
} {1 10 3 20}
#*************************************************************************
# Test lookup by MATCH (QUERY_FULLTEXT). This is the fulltext index.
db eval {
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE VIRTUAL TABLE t1 USING fts2(c);
CREATE TABLE t2(id INTEGER PRIMARY KEY AUTOINCREMENT, weight INTEGER UNIQUE);
INSERT INTO t2 VALUES (null, 10);
INSERT INTO t1 (rowid, c) VALUES (last_insert_rowid(), 'This is a test');
INSERT INTO t2 VALUES (null, 5);
INSERT INTO t1 (rowid, c) VALUES (last_insert_rowid(), 'That was a test');
INSERT INTO t2 VALUES (null, 20);
INSERT INTO t1 (rowid, c) VALUES (last_insert_rowid(), 'This is a test');
}
do_test fts2e-3.1 {
execsql {
SELECT rowid FROM t1 WHERE t1 MATCH 'this' ORDER BY rowid;
}
} {1 3}
do_test fts2e-3.2 {
execsql {
SELECT t1.rowid, weight FROM t1, t2
WHERE t1 MATCH 'this' AND t1.rowid = t2.id ORDER BY weight;
}
} {1 10 3 20}
finish_test

View File

@ -1,174 +0,0 @@
# 2007 June 21
#
# 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. The focus
# of this script is testing the pluggable tokeniser feature of the
# FTS2 module.
#
# $Id: fts2token.test,v 1.3 2007/06/25 12:05:40 danielk1977 Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If SQLITE_ENABLE_FTS2 is defined, omit this file.
ifcapable !fts2 {
finish_test
return
}
proc escape_string {str} {
set out ""
foreach char [split $str ""] {
scan $char %c i
if {$i<=127} {
append out $char
} else {
append out [format {\x%.4x} $i]
}
}
set out
}
#--------------------------------------------------------------------------
# Test cases fts2token-1.* are the warm-body test for the SQL scalar
# function fts2_tokenizer(). The procedure is as follows:
#
# 1: Verify that there is no such fts2 tokenizer as 'blah'.
#
# 2: Query for the built-in tokenizer 'simple'. Insert a copy of the
# retrieved value as tokenizer 'blah'.
#
# 3: Test that the value returned for tokenizer 'blah' is now the
# same as that retrieved for 'simple'.
#
# 4: Test that it is now possible to create an fts2 table using
# tokenizer 'blah' (it was not possible in step 1).
#
# 5: Test that the table created to use tokenizer 'blah' is usable.
#
do_test fts2token-1.1 {
catchsql {
CREATE VIRTUAL TABLE t1 USING fts2(content, tokenize blah);
}
} {1 {unknown tokenizer: blah}}
do_test fts2token-1.2 {
execsql {
SELECT fts2_tokenizer('blah', fts2_tokenizer('simple')) IS NULL;
}
} {0}
do_test fts2token-1.3 {
execsql {
SELECT fts2_tokenizer('blah') == fts2_tokenizer('simple');
}
} {1}
do_test fts2token-1.4 {
catchsql {
CREATE VIRTUAL TABLE t1 USING fts2(content, tokenize blah);
}
} {0 {}}
do_test fts2token-1.5 {
execsql {
INSERT INTO t1(content) VALUES('There was movement at the station');
INSERT INTO t1(content) VALUES('For the word has passed around');
INSERT INTO t1(content) VALUES('That the colt from ol regret had got away');
SELECT content FROM t1 WHERE content MATCH 'movement'
}
} {{There was movement at the station}}
#--------------------------------------------------------------------------
# Test cases fts2token-2.* test error cases in the scalar function based
# API for getting and setting tokenizers.
#
do_test fts2token-2.1 {
catchsql {
SELECT fts2_tokenizer('nosuchtokenizer');
}
} {1 {unknown tokenizer: nosuchtokenizer}}
#--------------------------------------------------------------------------
# Test cases fts2token-3.* test the three built-in tokenizers with a
# simple input string via the built-in test function. This is as much
# to test the test function as the tokenizer implementations.
#
do_test fts2token-3.1 {
execsql {
SELECT fts2_tokenizer_test('simple', 'I don''t see how');
}
} {{0 i I 1 don don 2 t t 3 see see 4 how how}}
do_test fts2token-3.2 {
execsql {
SELECT fts2_tokenizer_test('porter', 'I don''t see how');
}
} {{0 i I 1 don don 2 t t 3 see see 4 how how}}
ifcapable icu {
do_test fts2token-3.3 {
execsql {
SELECT fts2_tokenizer_test('icu', 'I don''t see how');
}
} {{0 i I 1 don't don't 2 see see 3 how how}}
}
#--------------------------------------------------------------------------
# Test cases fts2token-4.* test the ICU tokenizer. In practice, this
# tokenizer only has two modes - "thai" and "everybody else". Some other
# Asian languages (Lao, Khmer etc.) require the same special treatment as
# Thai, but ICU doesn't support them yet.
#
ifcapable icu {
proc do_icu_test {name locale input output} {
set ::out [db eval { SELECT fts2_tokenizer_test('icu', $locale, $input) }]
do_test $name {
lindex $::out 0
} $output
}
do_icu_test fts2token-4.1 en_US {} {}
do_icu_test fts2token-4.2 en_US {Test cases fts2} [list \
0 test Test 1 cases cases 2 fts2 fts2
]
# The following test shows that ICU is smart enough to recognise
# Thai chararacters, even when the locale is set to English/United
# States.
#
set input "\u0e2d\u0e30\u0e44\u0e23\u0e19\u0e30\u0e04\u0e23\u0e31\u0e1a"
set output "0 \u0e2d\u0e30\u0e44\u0e23 \u0e2d\u0e30\u0e44\u0e23 "
append output "1 \u0e19\u0e30 \u0e19\u0e30 "
append output "2 \u0e04\u0e23\u0e31\u0e1a \u0e04\u0e23\u0e31\u0e1a"
do_icu_test fts2token-4.3 th_TH $input $output
do_icu_test fts2token-4.4 en_US $input $output
# ICU handles an unknown locale by falling back to the default.
# So this is not an error.
do_icu_test fts2token-4.5 MiddleOfTheOcean $input $output
set longtoken "AReallyReallyLongTokenOneThatWillSurelyRequire"
append longtoken "AReallocInTheIcuTokenizerCode"
set input "short tokens then "
append input $longtoken
set output "0 short short "
append output "1 tokens tokens "
append output "2 then then "
append output "3 [string tolower $longtoken] $longtoken"
do_icu_test fts2token-4.6 MiddleOfTheOcean $input $output
do_icu_test fts2token-4.7 th_TH $input $output
do_icu_test fts2token-4.8 en_US $input $output
}
do_test fts2token-internal {
execsql { SELECT fts2_tokenizer_internal_test() }
} {ok}
finish_test

View File

@ -36,7 +36,6 @@ altertab
altform
amalgamator
amongst
Analyse
analyse
antipenultimate
ap
@ -46,7 +45,6 @@ appendall
appendchar
appendf
ar
Arg
arg
argc
argcount
@ -58,15 +56,14 @@ arrayname
ascii
asm
async
Atoi
atoi
atomics
auth
authorizer
autocheckpoint
Autocommit
autocommit
autoconf
Autoext
autoext
autoextension
autoinc
autoincrement
@ -94,20 +91,16 @@ bcb
bcc
beginthreadex
behavior
Behavioral
behavioral
behaviors
benigncnt
bg
bigblob
bitcount
Bitfield
bitfield
Bitmask
bitmask
Bitmasks
bitmasks
bitset
Bitvec
bitvec
bitvecs
bitwise
@ -122,9 +115,7 @@ br
breadthfirstsearch
breakpoint
bt
Btree
btree
Btrees
btrees
buf
bufpt
@ -183,11 +174,9 @@ Cmpr
cnt
codec
codepage
Collseq
collseq
colname
compileoption
Concat
concat
config
confstr
@ -196,10 +185,8 @@ consective
considertion
const
coredump
Coroutine
coroutine
coroutines
corresonding
cov
crashparams
csr
@ -235,17 +222,13 @@ dbtotxt
De
de
deadman
Deallocate
deallocate
deallocated
Deallocates
deallocates
deallocating
Deallocation
deallocation
decltype
decrementing
Defense
defense
defenses
defn
@ -257,23 +240,18 @@ Deinitialize
deinitialize
demovfs
dependences
Dequote
dequote
Dequoted
dequoted
dequoting
dereferenced
Dereferences
dereferences
desc
deserialization
Deserialize
deserialize
deserialized
deserializes
deserializing
Dest
dest
Destructor
destructor
destructors
deterministically
@ -300,7 +278,6 @@ docid
docids
dont
dontcache
Dotfile
dotfile
dotlock
doublearray
@ -333,22 +310,16 @@ endian
endianness
endif
endthreadex
english
enum
eof
eph
Ephem
ephem
epheremal
ephermal
Eq
eq
eqp
equaling
equalities
errcode
errmsg
Errno
errno
errorcode
erroroffset
@ -363,9 +334,7 @@ exe
expander
explainer
expmask
Expr
expr
expresssion
exprlist
extern
fakeheap
@ -409,8 +378,7 @@ finalised
finalizer
findfirst
findnext
Finially
Fixup
fixup
fk
fkctr
fkey
@ -425,9 +393,7 @@ fread
fred
fred's
freeblock
Freeblocks
freeblocks
Freelist
freelist
freepage
freespace
@ -439,7 +405,6 @@ fsdir
fseek
fstat
fstree
Fsync
fsync
fsynced
fsyncs
@ -452,10 +417,8 @@ fullschema
fullshm
fullsync
fullsyncs
Func
func
funcs
functino
fuzzer
fuzzers
fwrite
@ -475,7 +438,6 @@ getters
gibabyte
gid
glibc
Globbing
globbing
gmtime
Gosub
@ -487,11 +449,9 @@ growable
grp
hdl
hdr
hexadeximal
hexdb
hexdouble
hexio
Highwater
highwater
hijklmno
honor
@ -505,7 +465,6 @@ hw
Hwtime
icecube
ideographical
Idx
idx
idxaff
idxnum
@ -517,19 +476,14 @@ iff
ifndef
imm
impl
implementions
implmentation
incr
Incrblob
incrblob
incrementing
indexable
indexname
infop
ing
Init
init
initalize
initfail
initializer
initializers
@ -643,9 +597,7 @@ lvalue
lwr
makefile
makefiles
Malloc
malloc
Malloc'd
malloc'd
malloced
mallocs
@ -659,7 +611,6 @@ mbcs
Mcafee
md
Meeus
Mem
mem
memcmp
memcpy
@ -679,7 +630,7 @@ millisec
mincore
mingw
mis
Miscoded
miscoded
mj
mkctimec
mkdir
@ -702,15 +653,12 @@ msize
msvc
mtime
mult
Multibyte
multipled
multibyte
multiplex'ed
multiplexor
multithreaded
multiwrite
Mutex
mutex
Mutexes
mutexes
mutexing
mx
@ -718,7 +666,6 @@ mxpathname
myprefix
nal
namecontext
Namespace
namespace
natively
nbr
@ -744,17 +691,14 @@ nomem
nomutex
nonblocking
nonroot
Noop
noop
noshm
notational
notheld
notnull
nowrap
Nr
nr
ntile
Nul
nul
nullable
nullif
@ -773,7 +717,7 @@ onecolumn
onepass
onoff
onwards
Oom
oom
opcodesnever
openable
opendir
@ -789,16 +733,13 @@ overreads
overrideable
oversize
overwriteable
Overwritting
ovewrite
ovfl
pagecache
pagecaches
Pagecount
pagecount
pagelist
pageno
Pagesize
pagesize
pagetype
Param
@ -821,7 +762,6 @@ pmasz
pn
popen
pos
Posix
posix
Postgres
Powersafe
@ -833,15 +773,12 @@ pragma
pragmaed
pragma's
pragmas
Pre
pre
pread
preallocate
Preallocated
preallocated
precisions
precompiled
Precomputed
precomputed
prefetch
prefetched
@ -862,7 +799,6 @@ preupdate
primarykey
printf
printfs
Prng
prng
proc
procs
@ -871,14 +807,11 @@ proleptic
proxying
proxys
pseudocode
Pseudotable
pseudotable
psow
psz
pthread
Pthreads
pthreads
Ptr
ptr
ptrmap
ptrs
@ -899,12 +832,10 @@ rcauth
Rcvr
rds
readdir
Readline
readline
readlock
readonly
Readr
Realloc
realloc
reallocs
realvalue
@ -917,26 +848,24 @@ reenabled
reentrant
refcount
refcounts
Regs
regs
reindexed
reinitializer
reinitializes
Rekey
rekey
rekeyed
relevancies
Relink
relink
relink
relock
renormalize
reoptimize
Reparse
reparse
reparse
reparsed
reparsing
reportable
Reprepare
reprepare
reprepare
reprepared
reprepares
@ -946,10 +875,10 @@ Req'd
requeries
requote
reregister
Reseek
reseek
reservebytes
resumable
Retarget
retarget
retargeted
retrys
returntype
@ -958,15 +887,11 @@ rhs
Ri
Rivest
ro
Rootpage
rootpage
Rowid
rowid
Rowids
rowids
Rowkey
rownumber
Rowset
rowset
runtime
rw
@ -975,12 +900,9 @@ samplelib
sampleno
sandboxed
sandboxing
Savepoint
savepoint
Savepoints
savepoints
scanf
scannning
scanstats
scanstatus
schemas
@ -1020,14 +942,11 @@ sqrt
src
srcck
statfs
statment
stderr
stdin
stdout
Stmt
stmt
stmts
Str
str
strace
strcasecmp
@ -1056,7 +975,7 @@ subdirectory
subelement
subexpression
subexpressions
Subfunction
subfunction
subfunctions
subitem
subjournals
@ -1075,9 +994,9 @@ subsec
subsecond
subsequence
substr
Substring
substring
substrings
Subsubstructure
subsubstructure
subsubterms
Subtask
subtasks
@ -1087,11 +1006,9 @@ subtransaction
subtransactions
subtree
subtrees
Subtype
subtype
subtypes
sumint
sunday
superclass
superlock
superset
@ -1171,7 +1088,6 @@ Un
un
unallocated
unanalyzed
Unary
unary
unbuffered
unclosed
@ -1184,21 +1100,18 @@ unfinalized
unfreed
unhex
unicode
Unindexed
unindexed
uninit
Uninitialize
uninitialize
unintuitive
unioned
unissued
unix
unixepoch
Unlink
unlink
unlinked
unlinking
unlinks
Unmap
unmap
unmapped
unmapping
@ -1208,9 +1121,8 @@ unreduced
unref
unreferenced
unrefs
Unregister
unregister
Unregistering
unregistering
unregisters
unresolvable
unsynced
@ -1237,27 +1149,22 @@ uuu
uuuuu
uuzzzz
va
Valgrind
valgrind
vanishingly
vappendf
Vararg
vararg
varargs
varint
varints
Varname
varname
vcolumn
Vdbe
vdbe
vdbeapi
vdbe's
vdbes
vdbesort
ve
verfication
verifications
veritical
vfs
vfslog
vfsname
@ -1277,10 +1184,8 @@ vvvvv
vvvvvv
vwait
vxworks
Wal
wal
wasm
wherease
wherecode
whereexpr
wheretrace
@ -1307,7 +1212,6 @@ xdg
xe
xf
xfe
Xfer
xfer
xff
xfff