Merge the pragma-as-vtab change into this branch.

FossilOrigin-Name: 4ba45e722371ca4343e3563e7e1c2896b48c9a87
This commit is contained in:
dan 2016-12-16 16:13:45 +00:00
commit c17f6255a4
36 changed files with 1118 additions and 567 deletions

View File

@ -1,5 +1,5 @@
C Add\sthe\s-groupbyparent\soption\sto\sthe\s".fkey_missing_indexes"\scommand.
D 2016-12-15T06:01:40.711
C Merge\sthe\spragma-as-vtab\schange\sinto\sthis\sbranch.
D 2016-12-16T16:13:45.218
F Makefile.in c194b58fe00c370a48ac6ae6945e92a7781db1c8
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc b8ca53350ae545e3562403d5da2a69cec79308da
@ -324,7 +324,7 @@ F spec.template 86a4a43b99ebb3e75e6b9a735d5fd293a24e90ca
F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
F sqlite3.1 fc7ad8990fc8409983309bb80de8c811a7506786
F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a
F src/alter.c 0f83ee1d5963e85f8f3316cb11a90227807a74c8
F src/alter.c 3b23977620ce9662ac54443f65b87ba996e36121
F src/analyze.c 8b62b2cf4da85451534ac0af82cafc418d837f68
F src/attach.c f6725410c184a80d8141b294fdf98a854c8a52b5
F src/auth.c 930b376a9c56998557367e6f7f8aaeac82a2a792
@ -334,7 +334,7 @@ F src/btmutex.c bc87dd3b062cc26edfe79918de2200ccb8d41e73
F src/btree.c b2055dff0b94e03eaad48a760984a2d8e39244e6
F src/btree.h 2349a588abcd7e0c04f984e15c5c777b61637583
F src/btreeInt.h 10c4b77c2fb399580babbcc7cf652ac10dba796e
F src/build.c e2b32766847eb16d4314c99067571ae08b888dfe
F src/build.c 52970b6cf3cf3107551a5d6dd668b0b261b0b491
F src/callback.c 2e76147783386374bf01b227f752c81ec872d730
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
F src/ctime.c 9f2296a4e5d26ebf0e0d95a0af4628f1ea694e7a
@ -381,8 +381,8 @@ F src/parse.y 29153738a7322054359320eb00b5a4cd44389f20
F src/pcache.c 51070ec9b8251bbf9c6ea3d35fd96a458752929e
F src/pcache.h 2cedcd8407eb23017d92790b112186886e179490
F src/pcache1.c e3967219b2a92b9edcb9324a4ba75009090d3953
F src/pragma.c d932ba278654617cdd281f88a790a3185fca7c44
F src/pragma.h 64c78a648751b9f4f297276c4eb7507b14b4628c
F src/pragma.c d5adfe89ad7f3f45d4dbd25b96cbf3f6611aea2a
F src/pragma.h f9b221b2c8949ea941dbee49934299e4ed5af41c
F src/prepare.c b1140c3d0cf59bc85ace00ce363153041b424b7a
F src/printf.c f94da4935d1dd25420ac50c6745db1deb35e07c1
F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
@ -393,7 +393,7 @@ F src/shell.c 331be7c5d82477baff3ab584f1dc679e9676e0ef
F src/sqlite.h.in e8e2d108d82647f0a812fdb74accf91c1ec08ddc
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 8648034aa702469afb553231677306cc6492a1ae
F src/sqliteInt.h 657a892d885253768c82f1e04e8053468b13cb6a
F src/sqliteInt.h adbe80409c2926d91e5485789e5bf69313cd54b0
F src/sqliteLimit.h c0373387c287c8d0932510b5547ecde31b5da247
F src/status.c a9e66593dfb28a9e746cba7153f84d49c1ddc4b1
F src/table.c 5226df15ab9179b9ed558d89575ea0ce37b03fc9
@ -450,12 +450,12 @@ F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9
F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c
F src/tokenize.c 6eb0752c4fd191f789190c3708ee5b0060fd2829
F src/treeview.c 4e44ade3bfe59d82005039f72e09333ce2b4162c
F src/trigger.c 3419bb9862983d84d70735fb4c94b21b934cd0c5
F src/trigger.c c9f0810043b265724fdb1bdd466894f984dfc182
F src/update.c 1da7c462110bffed442a42884cb0d528c1db46d8
F src/utf.c 699001c79f28e48e9bcdf8a463da029ea660540c
F src/util.c e68e8ced7328f22d2cf7b4c898c394a0de34cdf1
F src/vacuum.c 33c174b28886b2faf26e503b5a49a1c01a9b1c16
F src/vdbe.c 2d90c42f2117b36e92c3af6a9c9f380b22e6e3b8
F src/vdbe.c 64c3426893e1660bde7446c242468926555e3650
F src/vdbe.h 0c74f6305fb43b9b282dacaff102272370e327d4
F src/vdbeInt.h 42e498dbe96475dbb3fda3d85d8fd2a87eff60a2
F src/vdbeapi.c ea4e2dc2213cc6bd7bee375a29a9b51c31b93ae0
@ -464,7 +464,7 @@ F src/vdbeblob.c f4f98ea672b242f807c08c92c7faaa79e5091b65
F src/vdbemem.c d3fd85b7b7ef3eb75de29c6d7e1d10d3ca78b4fd
F src/vdbesort.c bb34eed4fb52e11ac037dccea4ee3190594c7f9e
F src/vdbetrace.c 41963d5376f0349842b5fc4aaaaacd7d9cdc0834
F src/vtab.c 2d5db3fd68c41c5a7476e43e79eb54181fa01713
F src/vtab.c c4bbe0f870f52036553f8098aee0703997f0577a
F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
F src/wal.c 40c543f0a2195d1b0dc88ef12142bea690009344
F src/wal.h 06b2a0b599cc0f53ea97f497cf8c6b758c999f71
@ -479,10 +479,10 @@ F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
F test/aggnested.test b35b4cd69fc913f90d39a575e171e1116c3a4bb7
F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87
F test/all.test 6ff7b43c2b4b905c74dc4a813d201d0fa64c5783
F test/alter.test 2facdddf08d0d48e75dc6cc312cd2b030f4835dd
F test/alter.test b820ab9dcf85f8e3a65bc8326accb2f0c7be64ef
F test/alter2.test 7ea05c7d92ac99349a802ef7ada17294dd647060
F test/alter3.test 4d79934d812eaeacc6f22781a080f8cfe012fdc3
F test/alter4.test 0c33c542247ba5aee4f4a0133ac44bcf8f97e5e0
F test/alter4.test b6d7b86860111864f6cddb54af313f5862dda23b
F test/altermalloc.test e81ac9657ed25c6c5bb09bebfa5a047cd8e4acfc
F test/amatch1.test b5ae7065f042b7f4c1c922933f4700add50cdb9f
F test/analyze.test 3eb35a4af972f98422e5dc0586501b17d103d321
@ -506,15 +506,15 @@ F test/async3.test d73a062002376d7edc1fe3edff493edbec1fc2f7
F test/async4.test 1787e3952128aa10238bf39945126de7ca23685a
F test/async5.test 383ab533fdb9f7ad228cc99ee66e1acb34cc0dc0
F test/atof1.test ff0b0156fd705b67c506e1f2bfe9e26102bea9bd
F test/attach.test 437107943f14d131cf5efc2ae5305a94d7cb1d58
F test/attach.test 9976867b1a6585018f0966857aa82ed44e0bd6dc
F test/attach2.test 0ec5defa340363de6cd50fd595046465e9aaba2d
F test/attach3.test 359eb65d00102cdfcef6fa4e81dc1648f8f80b27
F test/attach3.test c59d92791070c59272e00183b7353eeb94915976
F test/attach4.test 53bf502f17647c6d6c5add46dda6bac8b6f4665c
F test/attachmalloc.test 3a4bfca9545bfe906a8d2e622de10fbac5b711b0
F test/auth.test 872a122b3977c1d1bb9fd637dc20016e5c01880f
F test/auth.test c6ede04bee65637ff354b43fc1235aa560c0863e
F test/auth2.test 9eb7fce9f34bf1f50d3f366fb3e606be5a2000a1
F test/auth3.test b810826b193831929951c0d50783a200e5ef6b72
F test/autoinc.test c3a55c3667f429f4f4c7bed05f67b4d93e89e79d
F test/auth3.test 0d48b901cf111c14b4b1b5205c7d28f1a278190f
F test/autoinc.test 6ae8fb69c9f656962464ae4e6667045d0dfc3b46
F test/autoindex1.test 14b63a9f1e405fe6d5bfc8c8d00249c2ebaf13ea
F test/autoindex2.test 12ef578928102baaa0dc23ad397601a2f4ecb0df
F test/autoindex3.test a3be0d1a53a7d2edff208a5e442312957047e972
@ -535,8 +535,8 @@ F test/badutf2.test f5bc7f2d280670ecd79b9cf4f0f1760c607fe51f
F test/bc_common.tcl b5e42d80305be95697e6370e015af571e5333a1c
F test/bestindex1.test 0cf1bd2d7b97d3a3a8c10736125274f64765c4ee
F test/bestindex2.test 4a06b8922ab2fd09434870da8d1cdf525aaf7060
F test/bestindex3.test dd5fa4f483cd0356549203c4522f8c9e21cb1fc0
F test/bestindex4.test e6ef2ffe5787e6dbacb5f934ee3f32cf106474a1
F test/bestindex3.test 578b6a52dab819e63f28e3640e04b32c85aed320
F test/bestindex4.test 4cb5ff7dbaebadb87d366f51969271778423b455
F test/between.test 34d375fb5ce1ae283ffe82b6b233e9f38e84fc6c
F test/bigfile.test aa74f4e5db51c8e54a1d9de9fa65d01d1eb20b59
F test/bigfile2.test 1b489a3a39ae90c7f027b79110d6b4e1dbc71bfc
@ -650,7 +650,7 @@ F test/e_changes.test fd66105385153dbf21fdb35eb8ef6c3e1eade579
F test/e_createtable.test d4c6059d44dcd4b636de9aae322766062b471844
F test/e_delete.test ab39084f26ae1f033c940b70ebdbbd523dc4962e
F test/e_droptrigger.test 3cd080807622c13e5bbb61fc9a57bd7754da2412
F test/e_dropview.test 0c9f7f60989164a70a67a9d9c26d1083bc808306
F test/e_dropview.test 21ce09c361227ddbc9819a5608ee2700c276bdd5
F test/e_expr.test d0dd488e0527cbc560ae2dea1939cc44cb9b9924
F test/e_fkey.test 54cc0046d2d952d6c42b0dd94414e7a8f75f79f4
F test/e_fts3.test 5c02288842e4f941896fd44afdef564dd5fc1459
@ -685,7 +685,7 @@ F test/fallocate.test 3e979af17dfa7e5e9dda5eba1a696c04fa9d47f7
F test/filectrl.test 6e871c2d35dead1d9a88e176e8d2ca094fec6bb3
F test/filefmt.test e4edbdc637ca9576ccf4337a3cce627d9df7a56c
F test/fkey1.test ba64806ff9a04eecab2679caad377ae99a5e94e4
F test/fkey2.test f3d27ecba480a348c328965d154214719bb158a9
F test/fkey2.test 155809016fad6b2a1491facf2ac53a551bc57c2c
F test/fkey3.test 76d475c80b84ee7a5d062e56ccb6ea68882e2b49
F test/fkey4.test 86446017011273aad8f9a99c1a65019e7bd9ca9d
F test/fkey5.test 5a373303f201ac03c22ba1ef17a733d3f56e611a
@ -839,7 +839,7 @@ F test/in5.test 6c006e0bcd7351b69350ef566e65f244023489e9
F test/incrblob.test c9b96afc292aeff43d6687bcb09b0280aa599822
F test/incrblob2.test a5ce5ed1d0b01e2ed347245a21170372528af0a5
F test/incrblob3.test d8d036fde015d4a159cd3cbae9d29003b37227a4
F test/incrblob4.test fab83541571c7281aa561e5ea6088eb8612a4bec
F test/incrblob4.test 21a52a6843a56cdcce968c6a86b72a7066d0e6ba
F test/incrblob_err.test 69f9247fed50278d48ea710d1a8f9cdb09e4c0b8
F test/incrblobfault.test 280474078f6da9e732cd2a215d3d854969014b6e
F test/incrcorrupt.test 6c567fbf870aa9e91866fe52ce6f200cd548939a
@ -866,8 +866,8 @@ F test/insert4.test a20432f1c0fbbcff8f11d0e6ab4acb8c9db58023
F test/insert5.test 394f96728d1258f406fe5f5aeb0aaf29487c39a6
F test/instr.test 737bbf80685232033f3abedc6ae92f75860b5dd2
F test/instrfault.test aa90b7c3486a069151b28384ae525644a1f79d51
F test/intarray.test 066b7d7ac38d25bf96f87f1b017bfc687551cdd4
F test/interrupt.test dfe9a67a94b0b2d8f70545ba1a6cca10780d71cc
F test/intarray.test 46d95b457916638c5d8b1af21fb174804b3acf8b
F test/interrupt.test 16ea879ec728cb76414c148c5f24afd5d1f91054
F test/interrupt2.test 829b06f9e20a6c378d8bd121b26c337f4dfa36e5
F test/intpkey.test ac71107a49a06492b69b82aafaf225400598d3c8
F test/io.test f95bca1783b01ea7761671560d023360d2dfa4cc
@ -1022,7 +1022,7 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df
F test/rbu.test 168573d353cd0fd10196b87b0caa322c144ef736
F test/rdonly.test 64e2696c322e3538df0b1ed624e21f9a23ed9ff8
F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8
F test/regexp2.test aa7ffcc21350007a78361b82bcf3b74d12227144
F test/regexp2.test 40e894223b3d6672655481493f1be12012f2b33c
F test/reindex.test 44edd3966b474468b823d481eafef0c305022254
F test/releasetest.tcl cb06c4df0de4872e65b178316f8a87ccf7624d59 x
F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb
@ -1032,7 +1032,7 @@ F test/rollbackfault.test 0e646aeab8840c399cfbfa43daab46fd609cf04a
F test/rowallock.test 3f88ec6819489d0b2341c7a7528ae17c053ab7cc
F test/rowhash.test 0bc1d31415e4575d10cacf31e1a66b5cc0f8be81
F test/rowid.test 5b7509f384f4f6fae1af3c8c104c8ca299fea18d
F test/rowvalue.test 3f468a9e370a3ee8b267e58049679eb0df2b9d01
F test/rowvalue.test cacc565ed7e3ac467866af6705dd99020fdf2ee2
F test/rowvalue2.test 060d238b7e5639a7c5630cb5e63e311b44efef2b
F test/rowvalue3.test 3068f508753af69884b12125995f023da0dbb256
F test/rowvalue4.test 4b556d7de161a0dd8cff095c336e913986398bea
@ -1040,8 +1040,8 @@ F test/rowvalue5.test c81c7d8cf36711ab37675ad7376084ae2a359cb6
F test/rowvalue6.test d19b54feb604d5601f8614b15e214e0774c01087
F test/rowvalue7.test 5d06ff19d9e6969e574a2e662a531dd0c67801a8
F test/rowvalue8.test 5900eddad9e2c3c2e26f1a95f74aafc1232ee5e0
F test/rowvalue9.test e24f9eb02baffc6a67b6eed9e40d4c612c98079d
F test/rowvaluefault.test 7b16485e3f2b371f3e3d05455b8ded6d0c090244
F test/rowvalue9.test d8dd2c6ecac432dadaa79e41dc2434f007be1b6b
F test/rowvaluefault.test 7cd9ccc6c2fbdd881672984087aad0491bb75504
F test/rtree.test 0c8d9dd458d6824e59683c19ab2ffa9ef946f798
F test/run-wordcount.sh 891e89c4c2d16e629cd45951d4ed899ad12afc09
F test/savepoint.test c671fdbd34cd3bfe1518a777526ada595180cf8d
@ -1055,7 +1055,7 @@ F test/scanstatus.test 5253c219e331318a437f436268e0e82345700285
F test/schema.test 8f7999be894260f151adf15c2c7540f1c6d6a481
F test/schema2.test 906408621ea881fdb496d878b1822572a34e32c5
F test/schema3.test 1bc1008e1f8cb5654b248c55f27249366eb7ed38
F test/schema4.test e6a66e20cc69f0e306667c08be7fda3d11707dc5
F test/schema4.test 3b26c9fa916abb6dadf894137adcf41b7796f7b9
F test/schema5.test 29699b4421f183c8f0e88bd28ce7d75d13ea653e
F test/securedel.test 21749c32ccc30f1ea9e4b9f33295a6521ec20fa0
F test/securedel2.test 2d54c28e46eb1fd6902089958b20b1b056c6f1c5
@ -1105,7 +1105,7 @@ F test/skipscan3.test ec5bab3f81c7038b43450e7b3062e04a198bdbb5
F test/skipscan5.test 67817a4b6857c47e0e33ba3e506da6f23ef68de2
F test/skipscan6.test 5866039d03a56f5bd0b3d172a012074a1d90a15b
F test/snapshot.test 85735bd997a4f6d710140c28fd860519a299649f
F test/snapshot2.test eb083df2e617708a4a93d70965f14268d4934120
F test/snapshot2.test 867652ed4a13282dce218723535fad1c7b44c3c4
F test/snapshot_fault.test 52c5e97ebd218846a8ae2da4d147d3e77d71f963
F test/soak.test 0b5b6375c9f4110c828070b826b3b4b0bb65cd5f
F test/softheap1.test 843cd84db9891b2d01b9ab64cef3e9020f98d087
@ -1149,12 +1149,12 @@ F test/tableapi.test 2674633fa95d80da917571ebdd759a14d9819126
F test/tableopts.test dba698ba97251017b7c80d738c198d39ab747930
F test/tclsqlite.test 1d73b9203b1ca8798d7d7310742b8d3febc0d56e
F test/tempdb.test bd92eba8f20e16a9136e434e20b280794de3cdb6
F test/tempdb2.test 4fc92055f2a3f7626c0f2eabbb637dc021b311d5
F test/tempdb2.test 27e41ed540b2f9b056c2e77e9bddc1b875358507
F test/tempfault.test 0c0d349c9a99bf5f374655742577f8712c647900
F test/temptable.test d2c9b87a54147161bcd1822e30c1d1cd891e5b30
F test/temptable2.test cd396beb41117a5302fff61767c35fa4270a0d5e
F test/temptable3.test d11a0974e52b347e45ee54ef1923c91ed91e4637
F test/temptrigger.test 8ec228b0db5d7ebc4ee9b458fc28cb9e7873f5e1
F test/temptrigger.test 38f0ca479b1822d3117069e014daabcaacefffcc
F test/tester.tcl 4ce5afd5e192db4cae178e1a983b060e0f08c5d6
F test/thread001.test 9f22fd3525a307ff42a326b6bc7b0465be1745a5
F test/thread002.test e630504f8a06c00bf8bbe68528774dd96aeb2e58
@ -1285,7 +1285,7 @@ F test/tkt3541.test 5dc257bde9bc833ab9cc6844bf170b998dbb950a
F test/tkt3554.test f599967f279077bace39220cbe76085c7b423725
F test/tkt3581.test 1966b7193f1e3f14951cce8c66907ae69454e9a3
F test/tkt35xx.test f38c1b03713179d414969187c941466e44945b35
F test/tkt3630.test 929f64852103054125200bc825c316d5f75d42f7
F test/tkt3630.test 9a934c58c259f89a0ae6bb6bb846c56285a6fd0f
F test/tkt3718.test 3b59dcb5c4e7754dacd91e7fd353a61492cc402a
F test/tkt3731.test 0c5f4cbffe102d43c3b2188af91a9e36348f974b
F test/tkt3757.test 10cd679a88675c880533083fc79ac04324525595
@ -1294,7 +1294,7 @@ F test/tkt3762.test 4d439ff7abdc8d9323150269d182c37c2d514576
F test/tkt3773.test 7bca904d2a647a6a4a291bd86d7fd7c73855b789
F test/tkt3791.test a6624b9a80b216a26cf473607f42f3e51898c267
F test/tkt3793.test d90ffd75c52413908d15e1c44fc2ea9c80fcc449
F test/tkt3810.test 90fa0635dfa7da9680c8cd3513350a49b3a8ae12
F test/tkt3810.test 09608d81c63a6ff3aaf7bc70717909c51f5f4048
F test/tkt3824.test 150aa00bb6220672e5f0eb14dc8eaa36750425f0
F test/tkt3832.test 2300d10d57562b89875b72148338ac3e14f8847d
F test/tkt3838.test 292e72489101cd1320d7278dc111c173ebf334d4
@ -1441,7 +1441,7 @@ F test/with3.test 511bacdbe41c49cf34f9fd1bd3245fe1575bca98
F test/withM.test 693b61765f2b387b5e3e24a4536e2e82de15ff64
F test/without_rowid1.test 1a7b9bd51b899928d327052df9741d2fe8dbe701
F test/without_rowid2.test af260339f79d13cb220288b67cd287fbcf81ad99
F test/without_rowid3.test aad4f9d383e199349b6c7e508a778f7dff5dff79
F test/without_rowid3.test 2724c787a51a5dce09d078453a758117b4b728f1
F test/without_rowid4.test 4e08bcbaee0399f35d58b5581881e7a6243d458a
F test/without_rowid5.test 89b1c587bd92a0590e440da33e7666bf4891572a
F test/without_rowid6.test 1f99644e6508447fb050f73697350c7ceca3392e
@ -1475,7 +1475,7 @@ F tool/mkmsvcmin.tcl 2f12f7fa8858bbe61cf81820a2da96c79ed1ca8d
F tool/mkopcodec.tcl d1b6362bd3aa80d5520d4d6f3765badf01f6c43c
F tool/mkopcodeh.tcl a01d2c1d8a6205b03fc635adf3735b4c523befd3
F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e
F tool/mkpragmatab.tcl f0d5bb266d1d388cf86fce5ba01a891e95d72d41
F tool/mkpragmatab.tcl a30ee93515135466fc49ae881f75da07ebcafd19
F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97
F tool/mksqlite3c-noext.tcl fef88397668ae83166735c41af99d79f56afaabb
F tool/mksqlite3c.tcl 06b2e6a0f21cc0a5d70fbbd136b3e0a96470645e
@ -1537,7 +1537,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 7df23aca1f7c7b769d614d740b3fda3073f46ba9
R 109aa4e43fd004b2c710d444b0c58b6c
P 976c51b4836dfba2ce9b246334a85bda08ac526f 546821e29edb0282a4b1d8f49512e36027a6bf6d
R 30e9fb459cb16eb6392de3bdb60521ee
U dan
Z 2faf32103da4e43d54e82bc173d9e560
Z 8d92568d6acf97185670c4652b437304

View File

@ -1 +1 @@
976c51b4836dfba2ce9b246334a85bda08ac526f
4ba45e722371ca4343e3563e7e1c2896b48c9a87

View File

@ -504,7 +504,7 @@ void sqlite3AlterRenameTable(
sqlite3NestedParse(pParse,
"UPDATE \"%w\".%s SET "
"sql = sqlite_rename_parent(sql, %Q, %Q) "
"WHERE %s;", zDb, SCHEMA_TABLE(iDb), zTabName, zName, zWhere);
"WHERE %s;", zDb, MASTER_NAME, zTabName, zName, zWhere);
sqlite3DbFree(db, zWhere);
}
}
@ -528,7 +528,7 @@ void sqlite3AlterRenameTable(
"ELSE name END "
"WHERE tbl_name=%Q COLLATE nocase AND "
"(type='table' OR type='index' OR type='trigger');",
zDb, SCHEMA_TABLE(iDb), zName, zName, zName,
zDb, MASTER_NAME, zName, zName, zName,
#ifndef SQLITE_OMIT_TRIGGER
zName,
#endif
@ -689,7 +689,7 @@ void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pColDef){
"UPDATE \"%w\".%s SET "
"sql = substr(sql,1,%d) || ', ' || %Q || substr(sql,%d) "
"WHERE type = 'table' AND name = %Q",
zDb, SCHEMA_TABLE(iDb), pNew->addColOffset, zCol, pNew->addColOffset+1,
zDb, MASTER_NAME, pNew->addColOffset, zCol, pNew->addColOffset+1,
zTab
);
sqlite3DbFree(db, zCol);

View File

@ -30,10 +30,10 @@
** codeTableLocks() functions.
*/
struct TableLock {
int iDb; /* The database containing the table to be locked */
int iTab; /* The root page of the table to be locked */
u8 isWriteLock; /* True for write lock. False for a read lock */
const char *zName; /* Name of the table */
int iDb; /* The database containing the table to be locked */
int iTab; /* The root page of the table to be locked */
u8 isWriteLock; /* True for write lock. False for a read lock */
const char *zLockName; /* Name of the table */
};
/*
@ -77,7 +77,7 @@ void sqlite3TableLock(
p->iDb = iDb;
p->iTab = iTab;
p->isWriteLock = isWriteLock;
p->zName = zName;
p->zLockName = zName;
}else{
pToplevel->nTableLock = 0;
sqlite3OomFault(pToplevel->db);
@ -99,7 +99,7 @@ static void codeTableLocks(Parse *pParse){
TableLock *p = &pParse->aTableLock[i];
int p1 = p->iDb;
sqlite3VdbeAddOp4(pVdbe, OP_TableLock, p1, p->iTab, p->isWriteLock,
p->zName, P4_STATIC);
p->zLockName, P4_STATIC);
}
}
#else
@ -308,15 +308,22 @@ Table *sqlite3FindTable(sqlite3 *db, const char *zName, const char *zDatabase){
return 0;
}
#endif
for(i=OMIT_TEMPDB; i<db->nDb; i++){
int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */
if( zDatabase==0 || sqlite3StrICmp(zDatabase, db->aDb[j].zDbSName)==0 ){
assert( sqlite3SchemaMutexHeld(db, j, 0) );
p = sqlite3HashFind(&db->aDb[j].pSchema->tblHash, zName);
if( p ) break;
while(1){
for(i=OMIT_TEMPDB; i<db->nDb; i++){
int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */
if( zDatabase==0 || sqlite3StrICmp(zDatabase, db->aDb[j].zDbSName)==0 ){
assert( sqlite3SchemaMutexHeld(db, j, 0) );
p = sqlite3HashFind(&db->aDb[j].pSchema->tblHash, zName);
if( p ) return p;
}
}
/* Not found. If the name we were looking for was temp.sqlite_master
** then change the name to sqlite_temp_master and try again. */
if( sqlite3StrICmp(zName, MASTER_NAME)!=0 ) break;
if( sqlite3_stricmp(zDatabase, db->aDb[1].zDbSName)!=0 ) break;
zName = TEMP_MASTER_NAME;
}
return p;
return 0;
}
/*
@ -352,6 +359,9 @@ Table *sqlite3LocateTable(
** CREATE, then check to see if it is the name of an virtual table that
** can be an eponymous virtual table. */
Module *pMod = (Module*)sqlite3HashFind(&pParse->db->aModule, zName);
if( pMod==0 && sqlite3_strnicmp(zName, "pragma_", 7)==0 ){
pMod = sqlite3PragmaVtabRegister(pParse->db, zName);
}
if( pMod && sqlite3VtabEponymousTableInit(pParse, pMod) ){
return pMod->pEpoTab;
}
@ -688,7 +698,7 @@ char *sqlite3NameFromToken(sqlite3 *db, Token *pName){
*/
void sqlite3OpenMasterTable(Parse *p, int iDb){
Vdbe *v = sqlite3GetVdbe(p);
sqlite3TableLock(p, iDb, MASTER_ROOT, 1, SCHEMA_TABLE(iDb));
sqlite3TableLock(p, iDb, MASTER_ROOT, 1, MASTER_NAME);
sqlite3VdbeAddOp4Int(v, OP_OpenWrite, 0, MASTER_ROOT, iDb, 5);
if( p->nTab==0 ){
p->nTab = 1;
@ -1991,7 +2001,7 @@ void sqlite3EndTable(
"UPDATE %Q.%s "
"SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q "
"WHERE rowid=#%d",
db->aDb[iDb].zDbSName, SCHEMA_TABLE(iDb),
db->aDb[iDb].zDbSName, MASTER_NAME,
zType,
p->zName,
p->zName,
@ -2328,7 +2338,7 @@ static void destroyRootPage(Parse *pParse, int iTable, int iDb){
*/
sqlite3NestedParse(pParse,
"UPDATE %Q.%s SET rootpage=%d WHERE #%d AND rootpage=#%d",
pParse->db->aDb[iDb].zDbSName, SCHEMA_TABLE(iDb), iTable, r1, r1);
pParse->db->aDb[iDb].zDbSName, MASTER_NAME, iTable, r1, r1);
#endif
sqlite3ReleaseTempReg(pParse, r1);
}
@ -2471,7 +2481,7 @@ void sqlite3CodeDropTable(Parse *pParse, Table *pTab, int iDb, int isView){
*/
sqlite3NestedParse(pParse,
"DELETE FROM %Q.%s WHERE tbl_name=%Q and type!='trigger'",
pDb->zDbSName, SCHEMA_TABLE(iDb), pTab->zName);
pDb->zDbSName, MASTER_NAME, pTab->zName);
if( !isView && !IsVirtual(pTab) ){
destroyTable(pParse, pTab);
}
@ -3363,7 +3373,7 @@ void sqlite3CreateIndex(
*/
sqlite3NestedParse(pParse,
"INSERT INTO %Q.%s VALUES('index',%Q,%Q,#%d,%Q);",
db->aDb[iDb].zDbSName, SCHEMA_TABLE(iDb),
db->aDb[iDb].zDbSName, MASTER_NAME,
pIndex->zName,
pTab->zName,
iMem,
@ -3515,7 +3525,7 @@ void sqlite3DropIndex(Parse *pParse, SrcList *pName, int ifExists){
sqlite3BeginWriteOperation(pParse, 1, iDb);
sqlite3NestedParse(pParse,
"DELETE FROM %Q.%s WHERE name=%Q AND type='index'",
db->aDb[iDb].zDbSName, SCHEMA_TABLE(iDb), pIndex->zName
db->aDb[iDb].zDbSName, MASTER_NAME, pIndex->zName
);
sqlite3ClearStatTables(pParse, iDb, "idx", pIndex->zName);
sqlite3ChangeCookie(pParse, iDb);
@ -3658,7 +3668,7 @@ SrcList *sqlite3SrcListEnlarge(
/* Allocate additional space if needed */
if( (u32)pSrc->nSrc+nExtra>pSrc->nAlloc ){
SrcList *pNew;
int nAlloc = pSrc->nSrc+nExtra;
int nAlloc = pSrc->nSrc*2+nExtra;
int nGot;
pNew = sqlite3DbRealloc(db, pSrc,
sizeof(*pSrc) + (nAlloc-1)*sizeof(pSrc->a[0]) );

View File

@ -163,29 +163,29 @@ static int changeTempStorage(Parse *pParse, const char *zStorageType){
#endif /* SQLITE_PAGER_PRAGMAS */
/*
** Set the names of the first N columns to the values in azCol[]
** Set result column names for a pragma.
*/
static void setAllColumnNames(
Vdbe *v, /* The query under construction */
int N, /* Number of columns */
const char **azCol /* Names of columns */
static void setPragmaResultColumnNames(
Vdbe *v, /* The query under construction */
const PragmaName *pPragma /* The pragma */
){
int i;
sqlite3VdbeSetNumCols(v, N);
for(i=0; i<N; i++){
sqlite3VdbeSetColName(v, i, COLNAME_NAME, azCol[i], SQLITE_STATIC);
u8 n = pPragma->nPragCName;
sqlite3VdbeSetNumCols(v, n==0 ? 1 : n);
if( n==0 ){
sqlite3VdbeSetColName(v, 0, COLNAME_NAME, pPragma->zName, SQLITE_STATIC);
}else{
int i, j;
for(i=0, j=pPragma->iPragCName; i<n; i++, j++){
sqlite3VdbeSetColName(v, i, COLNAME_NAME, pragCName[j], SQLITE_STATIC);
}
}
}
static void setOneColumnName(Vdbe *v, const char *z){
setAllColumnNames(v, 1, &z);
}
/*
** Generate code to return a single integer value.
*/
static void returnSingleInt(Vdbe *v, const char *zLabel, i64 value){
static void returnSingleInt(Vdbe *v, i64 value){
sqlite3VdbeAddOp4Dup8(v, OP_Int64, 0, 1, 0, (const u8*)&value, P4_INT64);
setOneColumnName(v, zLabel);
sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1);
}
@ -194,12 +194,10 @@ static void returnSingleInt(Vdbe *v, const char *zLabel, i64 value){
*/
static void returnSingleText(
Vdbe *v, /* Prepared statement under construction */
const char *zLabel, /* Name of the result column */
const char *zValue /* Value to be returned */
){
if( zValue ){
sqlite3VdbeLoadString(v, 1, (const char*)zValue);
setOneColumnName(v, zLabel);
sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1);
}
}
@ -277,6 +275,26 @@ const char *sqlite3JournalModename(int eMode){
return azModeName[eMode];
}
/*
** Locate a pragma in the aPragmaName[] array.
*/
static const PragmaName *pragmaLocate(const char *zName){
int upr, lwr, mid, rc;
lwr = 0;
upr = ArraySize(aPragmaName)-1;
while( lwr<=upr ){
mid = (lwr+upr)/2;
rc = sqlite3_stricmp(zName, aPragmaName[mid].zName);
if( rc==0 ) break;
if( rc<0 ){
upr = mid - 1;
}else{
lwr = mid + 1;
}
}
return lwr>upr ? 0 : &aPragmaName[mid];
}
/*
** Process a pragma statement.
**
@ -305,12 +323,11 @@ void sqlite3Pragma(
Token *pId; /* Pointer to <id> token */
char *aFcntl[4]; /* Argument to SQLITE_FCNTL_PRAGMA */
int iDb; /* Database index for <database> */
int lwr, upr, mid = 0; /* Binary search bounds */
int rc; /* return value form SQLITE_FCNTL_PRAGMA */
sqlite3 *db = pParse->db; /* The database connection */
Db *pDb; /* The specific database being pragmaed */
Vdbe *v = sqlite3GetVdbe(pParse); /* Prepared statement */
const struct sPragmaNames *pPragma;
const PragmaName *pPragma; /* The pragma */
if( v==0 ) return;
sqlite3VdbeRunOnlyOnce(v);
@ -365,7 +382,9 @@ void sqlite3Pragma(
db->busyHandler.nBusy = 0;
rc = sqlite3_file_control(db, zDb, SQLITE_FCNTL_PRAGMA, (void*)aFcntl);
if( rc==SQLITE_OK ){
returnSingleText(v, "result", aFcntl[0]);
sqlite3VdbeSetNumCols(v, 1);
sqlite3VdbeSetColName(v, 0, COLNAME_NAME, aFcntl[0], SQLITE_TRANSIENT);
returnSingleText(v, aFcntl[0]);
sqlite3_free(aFcntl[0]);
goto pragma_out;
}
@ -380,26 +399,19 @@ void sqlite3Pragma(
}
/* Locate the pragma in the lookup table */
lwr = 0;
upr = ArraySize(aPragmaNames)-1;
while( lwr<=upr ){
mid = (lwr+upr)/2;
rc = sqlite3_stricmp(zLeft, aPragmaNames[mid].zName);
if( rc==0 ) break;
if( rc<0 ){
upr = mid - 1;
}else{
lwr = mid + 1;
}
}
if( lwr>upr ) goto pragma_out;
pPragma = &aPragmaNames[mid];
pPragma = pragmaLocate(zLeft);
if( pPragma==0 ) goto pragma_out;
/* Make sure the database schema is loaded if the pragma requires that */
if( (pPragma->mPragFlag & PragFlag_NeedSchema)!=0 ){
if( (pPragma->mPragFlg & PragFlg_NeedSchema)!=0 ){
if( sqlite3ReadSchema(pParse) ) goto pragma_out;
}
/* Register the result column names for pragmas that return results */
if( (pPragma->mPragFlg & PragFlg_NoColumns)==0 ){
setPragmaResultColumnNames(v, pPragma);
}
/* Jump to the appropriate pragma handler */
switch( pPragma->ePragTyp ){
@ -436,7 +448,6 @@ void sqlite3Pragma(
VdbeOp *aOp;
sqlite3VdbeUsesBtree(v, iDb);
if( !zRight ){
setOneColumnName(v, "cache_size");
pParse->nMem += 2;
sqlite3VdbeVerifyNoMallocRequired(v, ArraySize(getCacheSize));
aOp = sqlite3VdbeAddOpList(v, ArraySize(getCacheSize), getCacheSize, iLn);
@ -471,7 +482,7 @@ void sqlite3Pragma(
assert( pBt!=0 );
if( !zRight ){
int size = ALWAYS(pBt) ? sqlite3BtreeGetPageSize(pBt) : 0;
returnSingleInt(v, "page_size", size);
returnSingleInt(v, size);
}else{
/* Malloc may fail when setting the page-size, as there is an internal
** buffer that the pager module resizes using sqlite3_realloc().
@ -506,7 +517,7 @@ void sqlite3Pragma(
}
}
b = sqlite3BtreeSecureDelete(pBt, b);
returnSingleInt(v, "secure_delete", b);
returnSingleInt(v, b);
break;
}
@ -538,8 +549,6 @@ void sqlite3Pragma(
sqlite3AbsInt32(sqlite3Atoi(zRight)));
}
sqlite3VdbeAddOp2(v, OP_ResultRow, iReg, 1);
sqlite3VdbeSetNumCols(v, 1);
sqlite3VdbeSetColName(v, 0, COLNAME_NAME, zLeft, SQLITE_TRANSIENT);
break;
}
@ -585,7 +594,7 @@ void sqlite3Pragma(
if( eMode==PAGER_LOCKINGMODE_EXCLUSIVE ){
zRet = "exclusive";
}
returnSingleText(v, "locking_mode", zRet);
returnSingleText(v, zRet);
break;
}
@ -598,7 +607,6 @@ void sqlite3Pragma(
int eMode; /* One of the PAGER_JOURNALMODE_XXX symbols */
int ii; /* Loop counter */
setOneColumnName(v, "journal_mode");
if( zRight==0 ){
/* If there is no "=MODE" part of the pragma, do a query for the
** current mode */
@ -644,7 +652,7 @@ void sqlite3Pragma(
if( iLimit<-1 ) iLimit = -1;
}
iLimit = sqlite3PagerJournalSizeLimit(pPager, iLimit);
returnSingleInt(v, "journal_size_limit", iLimit);
returnSingleInt(v, iLimit);
break;
}
@ -662,7 +670,7 @@ void sqlite3Pragma(
Btree *pBt = pDb->pBt;
assert( pBt!=0 );
if( !zRight ){
returnSingleInt(v, "auto_vacuum", sqlite3BtreeGetAutoVacuum(pBt));
returnSingleInt(v, sqlite3BtreeGetAutoVacuum(pBt));
}else{
int eAuto = getAutoVacuum(zRight);
assert( eAuto>=0 && eAuto<=2 );
@ -741,7 +749,7 @@ void sqlite3Pragma(
case PragTyp_CACHE_SIZE: {
assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
if( !zRight ){
returnSingleInt(v, "cache_size", pDb->pSchema->cache_size);
returnSingleInt(v, pDb->pSchema->cache_size);
}else{
int size = sqlite3Atoi(zRight);
pDb->pSchema->cache_size = size;
@ -775,7 +783,7 @@ void sqlite3Pragma(
case PragTyp_CACHE_SPILL: {
assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
if( !zRight ){
returnSingleInt(v, "cache_spill",
returnSingleInt(v,
(db->flags & SQLITE_CacheSpill)==0 ? 0 :
sqlite3BtreeSetSpillSize(pDb->pBt,0));
}else{
@ -829,7 +837,7 @@ void sqlite3Pragma(
rc = SQLITE_OK;
#endif
if( rc==SQLITE_OK ){
returnSingleInt(v, "mmap_size", sz);
returnSingleInt(v, sz);
}else if( rc!=SQLITE_NOTFOUND ){
pParse->nErr++;
pParse->rc = rc;
@ -850,7 +858,7 @@ void sqlite3Pragma(
*/
case PragTyp_TEMP_STORE: {
if( !zRight ){
returnSingleInt(v, "temp_store", db->temp_store);
returnSingleInt(v, db->temp_store);
}else{
changeTempStorage(pParse, zRight);
}
@ -869,7 +877,7 @@ void sqlite3Pragma(
*/
case PragTyp_TEMP_STORE_DIRECTORY: {
if( !zRight ){
returnSingleText(v, "temp_store_directory", sqlite3_temp_directory);
returnSingleText(v, sqlite3_temp_directory);
}else{
#ifndef SQLITE_OMIT_WSD
if( zRight[0] ){
@ -913,7 +921,7 @@ void sqlite3Pragma(
*/
case PragTyp_DATA_STORE_DIRECTORY: {
if( !zRight ){
returnSingleText(v, "data_store_directory", sqlite3_data_directory);
returnSingleText(v, sqlite3_data_directory);
}else{
#ifndef SQLITE_OMIT_WSD
if( zRight[0] ){
@ -952,7 +960,7 @@ void sqlite3Pragma(
sqlite3_file *pFile = sqlite3PagerFile(pPager);
sqlite3OsFileControlHint(pFile, SQLITE_GET_LOCKPROXYFILE,
&proxy_file_path);
returnSingleText(v, "lock_proxy_file", proxy_file_path);
returnSingleText(v, proxy_file_path);
}else{
Pager *pPager = sqlite3BtreePager(pDb->pBt);
sqlite3_file *pFile = sqlite3PagerFile(pPager);
@ -984,7 +992,7 @@ void sqlite3Pragma(
*/
case PragTyp_SYNCHRONOUS: {
if( !zRight ){
returnSingleInt(v, "synchronous", pDb->safety_level-1);
returnSingleInt(v, pDb->safety_level-1);
}else{
if( !db->autoCommit ){
sqlite3ErrorMsg(pParse,
@ -1004,7 +1012,8 @@ void sqlite3Pragma(
#ifndef SQLITE_OMIT_FLAG_PRAGMAS
case PragTyp_FLAG: {
if( zRight==0 ){
returnSingleInt(v, pPragma->zName, (db->flags & pPragma->iArg)!=0 );
setPragmaResultColumnNames(v, pPragma);
returnSingleInt(v, (db->flags & pPragma->iArg)!=0 );
}else{
int mask = pPragma->iArg; /* Mask of bits to set or clear. */
if( db->autoCommit==0 ){
@ -1054,16 +1063,12 @@ void sqlite3Pragma(
Table *pTab;
pTab = sqlite3LocateTable(pParse, LOCATE_NOERR, zRight, zDb);
if( pTab ){
static const char *azCol[] = {
"cid", "name", "type", "notnull", "dflt_value", "pk"
};
int i, k;
int nHidden = 0;
Column *pCol;
Index *pPk = sqlite3PrimaryKeyIndex(pTab);
pParse->nMem = 6;
sqlite3CodeVerifySchema(pParse, iDb);
setAllColumnNames(v, 6, azCol); assert( 6==ArraySize(azCol) );
sqlite3ViewGetColumnNames(pParse, pTab);
for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){
if( IsHiddenColumn(pCol) ){
@ -1092,13 +1097,10 @@ void sqlite3Pragma(
break;
case PragTyp_STATS: {
static const char *azCol[] = { "table", "index", "width", "height" };
Index *pIdx;
HashElem *i;
v = sqlite3GetVdbe(pParse);
pParse->nMem = 4;
sqlite3CodeVerifySchema(pParse, iDb);
setAllColumnNames(v, 4, azCol); assert( 4==ArraySize(azCol) );
for(i=sqliteHashFirst(&pDb->pSchema->tblHash); i; i=sqliteHashNext(i)){
Table *pTab = sqliteHashData(i);
sqlite3VdbeMultiLoad(v, 1, "ssii",
@ -1123,9 +1125,6 @@ void sqlite3Pragma(
Table *pTab;
pIdx = sqlite3FindIndex(db, zRight, zDb);
if( pIdx ){
static const char *azCol[] = {
"seqno", "cid", "name", "desc", "coll", "key"
};
int i;
int mx;
if( pPragma->iArg ){
@ -1139,8 +1138,7 @@ void sqlite3Pragma(
}
pTab = pIdx->pTable;
sqlite3CodeVerifySchema(pParse, iDb);
assert( pParse->nMem<=ArraySize(azCol) );
setAllColumnNames(v, pParse->nMem, azCol);
assert( pParse->nMem<=pPragma->nPragCName );
for(i=0; i<mx; i++){
i16 cnum = pIdx->aiColumn[i];
sqlite3VdbeMultiLoad(v, 1, "iis", i, cnum,
@ -1163,13 +1161,8 @@ void sqlite3Pragma(
int i;
pTab = sqlite3FindTable(db, zRight, zDb);
if( pTab ){
static const char *azCol[] = {
"seq", "name", "unique", "origin", "partial"
};
v = sqlite3GetVdbe(pParse);
pParse->nMem = 5;
sqlite3CodeVerifySchema(pParse, iDb);
setAllColumnNames(v, 5, azCol); assert( 5==ArraySize(azCol) );
for(pIdx=pTab->pIndex, i=0; pIdx; pIdx=pIdx->pNext, i++){
const char *azOrigin[] = { "c", "u", "pk" };
sqlite3VdbeMultiLoad(v, 1, "isisi",
@ -1185,10 +1178,8 @@ void sqlite3Pragma(
break;
case PragTyp_DATABASE_LIST: {
static const char *azCol[] = { "seq", "name", "file" };
int i;
pParse->nMem = 3;
setAllColumnNames(v, 3, azCol); assert( 3==ArraySize(azCol) );
for(i=0; i<db->nDb; i++){
if( db->aDb[i].pBt==0 ) continue;
assert( db->aDb[i].zDbSName!=0 );
@ -1202,11 +1193,9 @@ void sqlite3Pragma(
break;
case PragTyp_COLLATION_LIST: {
static const char *azCol[] = { "seq", "name" };
int i = 0;
HashElem *p;
pParse->nMem = 2;
setAllColumnNames(v, 2, azCol); assert( 2==ArraySize(azCol) );
for(p=sqliteHashFirst(&db->aCollSeq); p; p=sqliteHashNext(p)){
CollSeq *pColl = (CollSeq *)sqliteHashData(p);
sqlite3VdbeMultiLoad(v, 1, "is", i++, pColl->zName);
@ -1222,17 +1211,11 @@ void sqlite3Pragma(
Table *pTab;
pTab = sqlite3FindTable(db, zRight, zDb);
if( pTab ){
v = sqlite3GetVdbe(pParse);
pFK = pTab->pFKey;
if( pFK ){
static const char *azCol[] = {
"id", "seq", "table", "from", "to", "on_update", "on_delete",
"match"
};
int i = 0;
pParse->nMem = 8;
sqlite3CodeVerifySchema(pParse, iDb);
setAllColumnNames(v, 8, azCol); assert( 8==ArraySize(azCol) );
while(pFK){
int j;
for(j=0; j<pFK->nCol; j++){
@ -1273,14 +1256,11 @@ void sqlite3Pragma(
int addrTop; /* Top of a loop checking foreign keys */
int addrOk; /* Jump here if the key is OK */
int *aiCols; /* child to parent column mapping */
static const char *azCol[] = { "table", "rowid", "parent", "fkid" };
regResult = pParse->nMem+1;
pParse->nMem += 4;
regKey = ++pParse->nMem;
regRow = ++pParse->nMem;
v = sqlite3GetVdbe(pParse);
setAllColumnNames(v, 4, azCol); assert( 4==ArraySize(azCol) );
sqlite3CodeVerifySchema(pParse, iDb);
k = sqliteHashFirst(&db->aDb[iDb].pSchema->tblHash);
while( k ){
@ -1419,7 +1399,6 @@ void sqlite3Pragma(
/* Initialize the VDBE program */
pParse->nMem = 6;
setOneColumnName(v, "integrity_check");
/* Set the maximum error count */
mxErr = SQLITE_INTEGRITY_CHECK_ERROR_MAX;
@ -1671,7 +1650,7 @@ void sqlite3Pragma(
assert( encnames[SQLITE_UTF8].enc==SQLITE_UTF8 );
assert( encnames[SQLITE_UTF16LE].enc==SQLITE_UTF16LE );
assert( encnames[SQLITE_UTF16BE].enc==SQLITE_UTF16BE );
returnSingleText(v, "encoding", encnames[ENC(pParse->db)].zName);
returnSingleText(v, encnames[ENC(pParse->db)].zName);
}else{ /* "PRAGMA encoding = XXX" */
/* Only change the value of sqlite.enc if the database handle is not
** initialized. If the main database exists, the new sqlite.enc value
@ -1734,7 +1713,7 @@ void sqlite3Pragma(
case PragTyp_HEADER_VALUE: {
int iCookie = pPragma->iArg; /* Which cookie to read or write */
sqlite3VdbeUsesBtree(v, iDb);
if( zRight && (pPragma->mPragFlag & PragFlag_ReadOnly)==0 ){
if( zRight && (pPragma->mPragFlg & PragFlg_ReadOnly)==0 ){
/* Write the specified cookie value */
static const VdbeOpList setCookie[] = {
{ OP_Transaction, 0, 1, 0}, /* 0 */
@ -1762,8 +1741,6 @@ void sqlite3Pragma(
aOp[0].p1 = iDb;
aOp[1].p1 = iDb;
aOp[1].p3 = iCookie;
sqlite3VdbeSetNumCols(v, 1);
sqlite3VdbeSetColName(v, 0, COLNAME_NAME, zLeft, SQLITE_TRANSIENT);
sqlite3VdbeReusable(v);
}
}
@ -1781,7 +1758,6 @@ void sqlite3Pragma(
int i = 0;
const char *zOpt;
pParse->nMem = 1;
setOneColumnName(v, "compile_option");
while( (zOpt = sqlite3_compileoption_get(i++))!=0 ){
sqlite3VdbeLoadString(v, 1, zOpt);
sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1);
@ -1798,7 +1774,6 @@ void sqlite3Pragma(
** Checkpoint the database.
*/
case PragTyp_WAL_CHECKPOINT: {
static const char *azCol[] = { "busy", "log", "checkpointed" };
int iBt = (pId2->z?iDb:SQLITE_MAX_ATTACHED);
int eMode = SQLITE_CHECKPOINT_PASSIVE;
if( zRight ){
@ -1810,7 +1785,6 @@ void sqlite3Pragma(
eMode = SQLITE_CHECKPOINT_TRUNCATE;
}
}
setAllColumnNames(v, 3, azCol); assert( 3==ArraySize(azCol) );
pParse->nMem = 3;
sqlite3VdbeAddOp3(v, OP_Checkpoint, iBt, eMode, 1);
sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 3);
@ -1829,7 +1803,7 @@ void sqlite3Pragma(
if( zRight ){
sqlite3_wal_autocheckpoint(db, sqlite3Atoi(zRight));
}
returnSingleInt(v, "wal_autocheckpoint",
returnSingleInt(v,
db->xWalCallback==sqlite3WalDefaultHook ?
SQLITE_PTR_TO_INT(db->pWalArg) : 0);
}
@ -1862,7 +1836,7 @@ void sqlite3Pragma(
if( zRight ){
sqlite3_busy_timeout(db, sqlite3Atoi(zRight));
}
returnSingleInt(v, "timeout", db->busyTimeout);
returnSingleInt(v, db->busyTimeout);
break;
}
@ -1882,7 +1856,7 @@ void sqlite3Pragma(
if( zRight && sqlite3DecOrHexToI64(zRight, &N)==SQLITE_OK ){
sqlite3_soft_heap_limit64(N);
}
returnSingleInt(v, "soft_heap_limit", sqlite3_soft_heap_limit64(-1));
returnSingleInt(v, sqlite3_soft_heap_limit64(-1));
break;
}
@ -1901,8 +1875,7 @@ void sqlite3Pragma(
){
sqlite3_limit(db, SQLITE_LIMIT_WORKER_THREADS, (int)(N&0x7fffffff));
}
returnSingleInt(v, "threads",
sqlite3_limit(db, SQLITE_LIMIT_WORKER_THREADS, -1));
returnSingleInt(v, sqlite3_limit(db, SQLITE_LIMIT_WORKER_THREADS, -1));
break;
}
@ -1914,9 +1887,7 @@ void sqlite3Pragma(
static const char *const azLockName[] = {
"unlocked", "shared", "reserved", "pending", "exclusive"
};
static const char *azCol[] = { "database", "status" };
int i;
setAllColumnNames(v, 2, azCol); assert( 2==ArraySize(azCol) );
pParse->nMem = 2;
for(i=0; i<db->nDb; i++){
Btree *pBt;
@ -1986,5 +1957,307 @@ pragma_out:
sqlite3DbFree(db, zLeft);
sqlite3DbFree(db, zRight);
}
#ifndef SQLITE_OMIT_VIRTUALTABLE
/*****************************************************************************
** Implementation of an eponymous virtual table that runs a pragma.
**
*/
typedef struct PragmaVtab PragmaVtab;
typedef struct PragmaVtabCursor PragmaVtabCursor;
struct PragmaVtab {
sqlite3_vtab base; /* Base class. Must be first */
sqlite3 *db; /* The database connection to which it belongs */
const PragmaName *pName; /* Name of the pragma */
u8 nHidden; /* Number of hidden columns */
u8 iHidden; /* Index of the first hidden column */
};
struct PragmaVtabCursor {
sqlite3_vtab_cursor base; /* Base class. Must be first */
sqlite3_stmt *pPragma; /* The pragma statement to run */
sqlite_int64 iRowid; /* Current rowid */
char *azArg[2]; /* Value of the argument and schema */
};
/*
** Pragma virtual table module xConnect method.
*/
static int pragmaVtabConnect(
sqlite3 *db,
void *pAux,
int argc, const char *const*argv,
sqlite3_vtab **ppVtab,
char **pzErr
){
const PragmaName *pPragma = (const PragmaName*)pAux;
PragmaVtab *pTab = 0;
int rc;
int i, j;
char cSep = '(';
StrAccum acc;
char zBuf[200];
sqlite3StrAccumInit(&acc, 0, zBuf, sizeof(zBuf), 0);
sqlite3StrAccumAppendAll(&acc, "CREATE TABLE x");
for(i=0, j=pPragma->iPragCName; i<pPragma->nPragCName; i++, j++){
sqlite3XPrintf(&acc, "%c\"%s\"", cSep, pragCName[j]);
cSep = ',';
}
if( i==0 ){
sqlite3XPrintf(&acc, "(\"%s\"", pPragma->zName);
cSep = ',';
i++;
}
j = 0;
if( pPragma->mPragFlg & PragFlg_Result1 ){
sqlite3StrAccumAppendAll(&acc, ",arg HIDDEN");
j++;
}
if( pPragma->mPragFlg & (PragFlg_SchemaOpt|PragFlg_SchemaReq) ){
sqlite3StrAccumAppendAll(&acc, ",schema HIDDEN");
j++;
}
sqlite3StrAccumAppend(&acc, ")", 1);
sqlite3StrAccumFinish(&acc);
assert( strlen(zBuf) < sizeof(zBuf)-1 );
rc = sqlite3_declare_vtab(db, zBuf);
if( rc==SQLITE_OK ){
pTab = (PragmaVtab*)sqlite3_malloc(sizeof(PragmaVtab));
if( pTab==0 ){
rc = SQLITE_NOMEM;
}else{
memset(pTab, 0, sizeof(PragmaVtab));
pTab->pName = pPragma;
pTab->db = db;
pTab->iHidden = i;
pTab->nHidden = j;
}
}else{
*pzErr = sqlite3_mprintf("%s", sqlite3_errmsg(db));
}
*ppVtab = (sqlite3_vtab*)pTab;
return rc;
}
/*
** Pragma virtual table module xDisconnect method.
*/
static int pragmaVtabDisconnect(sqlite3_vtab *pVtab){
PragmaVtab *pTab = (PragmaVtab*)pVtab;
sqlite3_free(pTab);
return SQLITE_OK;
}
/* Figure out the best index to use to search a pragma virtual table.
**
** There are not really any index choices. But we want to encourage the
** query planner to give == constraints on as many hidden parameters as
** possible, and especially on the first hidden parameter. So return a
** high cost if hidden parameters are unconstrained.
*/
static int pragmaVtabBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){
PragmaVtab *pTab = (PragmaVtab*)tab;
const struct sqlite3_index_constraint *pConstraint;
int i, j;
int seen[2];
pIdxInfo->estimatedCost = (double)1;
if( pTab->nHidden==0 ){ return SQLITE_OK; }
pConstraint = pIdxInfo->aConstraint;
seen[0] = 0;
seen[1] = 0;
for(i=0; i<pIdxInfo->nConstraint; i++, pConstraint++){
if( pConstraint->usable==0 ) continue;
if( pConstraint->op!=SQLITE_INDEX_CONSTRAINT_EQ ) continue;
if( pConstraint->iColumn < pTab->iHidden ) continue;
j = pConstraint->iColumn - pTab->iHidden;
assert( j < 2 );
seen[j] = i+1;
}
if( seen[0]==0 ){
pIdxInfo->estimatedCost = (double)2147483647;
pIdxInfo->estimatedRows = 2147483647;
return SQLITE_OK;
}
j = seen[0]-1;
pIdxInfo->aConstraintUsage[j].argvIndex = 1;
pIdxInfo->aConstraintUsage[j].omit = 1;
if( seen[1]==0 ) return SQLITE_OK;
pIdxInfo->estimatedCost = (double)20;
pIdxInfo->estimatedRows = 20;
j = seen[1]-1;
pIdxInfo->aConstraintUsage[j].argvIndex = 2;
pIdxInfo->aConstraintUsage[j].omit = 1;
return SQLITE_OK;
}
/* Create a new cursor for the pragma virtual table */
static int pragmaVtabOpen(sqlite3_vtab *pVtab, sqlite3_vtab_cursor **ppCursor){
PragmaVtabCursor *pCsr;
pCsr = (PragmaVtabCursor*)sqlite3_malloc(sizeof(*pCsr));
if( pCsr==0 ) return SQLITE_NOMEM;
memset(pCsr, 0, sizeof(PragmaVtabCursor));
pCsr->base.pVtab = pVtab;
*ppCursor = &pCsr->base;
return SQLITE_OK;
}
/* Clear all content from pragma virtual table cursor. */
static void pragmaVtabCursorClear(PragmaVtabCursor *pCsr){
int i;
sqlite3_finalize(pCsr->pPragma);
pCsr->pPragma = 0;
for(i=0; i<ArraySize(pCsr->azArg); i++){
sqlite3_free(pCsr->azArg[i]);
pCsr->azArg[i] = 0;
}
}
/* Close a pragma virtual table cursor */
static int pragmaVtabClose(sqlite3_vtab_cursor *cur){
PragmaVtabCursor *pCsr = (PragmaVtabCursor*)cur;
pragmaVtabCursorClear(pCsr);
sqlite3_free(pCsr);
return SQLITE_OK;
}
/* Advance the pragma virtual table cursor to the next row */
static int pragmaVtabNext(sqlite3_vtab_cursor *pVtabCursor){
PragmaVtabCursor *pCsr = (PragmaVtabCursor*)pVtabCursor;
int rc = SQLITE_OK;
/* Increment the xRowid value */
pCsr->iRowid++;
assert( pCsr->pPragma );
if( SQLITE_ROW!=sqlite3_step(pCsr->pPragma) ){
rc = sqlite3_finalize(pCsr->pPragma);
pCsr->pPragma = 0;
pragmaVtabCursorClear(pCsr);
}
return rc;
}
/*
** Pragma virtual table module xFilter method.
*/
static int pragmaVtabFilter(
sqlite3_vtab_cursor *pVtabCursor,
int idxNum, const char *idxStr,
int argc, sqlite3_value **argv
){
PragmaVtabCursor *pCsr = (PragmaVtabCursor*)pVtabCursor;
PragmaVtab *pTab = (PragmaVtab*)(pVtabCursor->pVtab);
int rc;
int i, j;
StrAccum acc;
char *zSql;
pragmaVtabCursorClear(pCsr);
j = (pTab->pName->mPragFlg & PragFlg_Result1)!=0 ? 0 : 1;
for(i=0; i<argc; i++, j++){
assert( j<ArraySize(pCsr->azArg) );
pCsr->azArg[j] = sqlite3_mprintf("%s", sqlite3_value_text(argv[i]));
if( pCsr->azArg[j]==0 ){
return SQLITE_NOMEM;
}
}
sqlite3StrAccumInit(&acc, 0, 0, 0, pTab->db->aLimit[SQLITE_LIMIT_SQL_LENGTH]);
sqlite3StrAccumAppendAll(&acc, "PRAGMA ");
if( pCsr->azArg[1] ){
sqlite3XPrintf(&acc, "%Q.", pCsr->azArg[1]);
}
sqlite3StrAccumAppendAll(&acc, pTab->pName->zName);
if( pCsr->azArg[0] ){
sqlite3XPrintf(&acc, "=%Q", pCsr->azArg[0]);
}
zSql = sqlite3StrAccumFinish(&acc);
if( zSql==0 ) return SQLITE_NOMEM;
rc = sqlite3_prepare_v2(pTab->db, zSql, -1, &pCsr->pPragma, 0);
sqlite3_free(zSql);
if( rc!=SQLITE_OK ){
pTab->base.zErrMsg = sqlite3_mprintf("%s", sqlite3_errmsg(pTab->db));
return rc;
}
return pragmaVtabNext(pVtabCursor);
}
/*
** Pragma virtual table module xEof method.
*/
static int pragmaVtabEof(sqlite3_vtab_cursor *pVtabCursor){
PragmaVtabCursor *pCsr = (PragmaVtabCursor*)pVtabCursor;
return (pCsr->pPragma==0);
}
/* The xColumn method simply returns the corresponding column from
** the PRAGMA.
*/
static int pragmaVtabColumn(
sqlite3_vtab_cursor *pVtabCursor,
sqlite3_context *ctx,
int i
){
PragmaVtabCursor *pCsr = (PragmaVtabCursor*)pVtabCursor;
PragmaVtab *pTab = (PragmaVtab*)(pVtabCursor->pVtab);
if( i<pTab->iHidden ){
sqlite3_result_value(ctx, sqlite3_column_value(pCsr->pPragma, i));
}else{
sqlite3_result_text(ctx, pCsr->azArg[i-pTab->iHidden],-1,SQLITE_TRANSIENT);
}
return SQLITE_OK;
}
/*
** Pragma virtual table module xRowid method.
*/
static int pragmaVtabRowid(sqlite3_vtab_cursor *pVtabCursor, sqlite_int64 *p){
PragmaVtabCursor *pCsr = (PragmaVtabCursor*)pVtabCursor;
*p = pCsr->iRowid;
return SQLITE_OK;
}
/* The pragma virtual table object */
static const sqlite3_module pragmaVtabModule = {
0, /* iVersion */
0, /* xCreate - create a table */
pragmaVtabConnect, /* xConnect - connect to an existing table */
pragmaVtabBestIndex, /* xBestIndex - Determine search strategy */
pragmaVtabDisconnect, /* xDisconnect - Disconnect from a table */
0, /* xDestroy - Drop a table */
pragmaVtabOpen, /* xOpen - open a cursor */
pragmaVtabClose, /* xClose - close a cursor */
pragmaVtabFilter, /* xFilter - configure scan constraints */
pragmaVtabNext, /* xNext - advance a cursor */
pragmaVtabEof, /* xEof */
pragmaVtabColumn, /* xColumn - read data */
pragmaVtabRowid, /* xRowid - read data */
0, /* xUpdate - write data */
0, /* xBegin - begin transaction */
0, /* xSync - sync transaction */
0, /* xCommit - commit transaction */
0, /* xRollback - rollback transaction */
0, /* xFindFunction - function overloading */
0, /* xRename - rename the table */
0, /* xSavepoint */
0, /* xRelease */
0 /* xRollbackTo */
};
/*
** Check to see if zTabName is really the name of a pragma. If it is,
** then register an eponymous virtual table for that pragma and return
** a pointer to the Module object for the new virtual table.
*/
Module *sqlite3PragmaVtabRegister(sqlite3 *db, const char *zName){
const PragmaName *pName;
assert( sqlite3_strnicmp(zName, "pragma_", 7)==0 );
pName = pragmaLocate(zName+7);
if( pName==0 ) return 0;
if( (pName->mPragFlg & (PragFlg_Result0|PragFlg_Result1))==0 ) return 0;
assert( sqlite3HashFind(&db->aModule, zName)==0 );
return sqlite3VtabCreateModule(db, zName, &pragmaVtabModule, (void*)pName, 0);
}
#endif /* SQLITE_OMIT_VIRTUALTABLE */
#endif /* SQLITE_OMIT_PRAGMA */

View File

@ -3,6 +3,8 @@
** ../tool/mkpragmatab.tcl. To update the set of pragmas, edit
** that script and rerun it.
*/
/* The various pragma types */
#define PragTyp_HEADER_VALUE 0
#define PragTyp_AUTO_VACUUM 1
#define PragTyp_FLAG 2
@ -46,419 +48,559 @@
#define PragTyp_REKEY 40
#define PragTyp_LOCK_STATUS 41
#define PragTyp_PARSER_TRACE 42
#define PragFlag_NeedSchema 0x01
#define PragFlag_ReadOnly 0x02
static const struct sPragmaNames {
const char *const zName; /* Name of pragma */
u8 ePragTyp; /* PragTyp_XXX value */
u8 mPragFlag; /* Zero or more PragFlag_XXX values */
u32 iArg; /* Extra argument */
} aPragmaNames[] = {
/* Property flags associated with various pragma. */
#define PragFlg_NeedSchema 0x01 /* Force schema load before running */
#define PragFlg_NoColumns 0x02 /* OP_ResultRow called with zero columns */
#define PragFlg_ReadOnly 0x04 /* Read-only HEADER_VALUE */
#define PragFlg_Result0 0x08 /* Acts as query when no argument */
#define PragFlg_Result1 0x10 /* Acts as query when has one argument */
#define PragFlg_SchemaOpt 0x20 /* Schema restricts name search if present */
#define PragFlg_SchemaReq 0x40 /* Schema required - "main" is default */
/* Names of columns for pragmas that return multi-column result
** or that return single-column results where the name of the
** result column is different from the name of the pragma
*/
static const char *const pragCName[] = {
/* 0 */ "cache_size", /* Used by: default_cache_size */
/* 1 */ "cid", /* Used by: table_info */
/* 2 */ "name",
/* 3 */ "type",
/* 4 */ "notnull",
/* 5 */ "dflt_value",
/* 6 */ "pk",
/* 7 */ "table", /* Used by: stats */
/* 8 */ "index",
/* 9 */ "width",
/* 10 */ "height",
/* 11 */ "seqno", /* Used by: index_info */
/* 12 */ "cid",
/* 13 */ "name",
/* 14 */ "seqno", /* Used by: index_xinfo */
/* 15 */ "cid",
/* 16 */ "name",
/* 17 */ "desc",
/* 18 */ "coll",
/* 19 */ "key",
/* 20 */ "seq", /* Used by: index_list */
/* 21 */ "name",
/* 22 */ "unique",
/* 23 */ "origin",
/* 24 */ "partial",
/* 25 */ "seq", /* Used by: database_list */
/* 26 */ "name",
/* 27 */ "file",
/* 28 */ "seq", /* Used by: collation_list */
/* 29 */ "name",
/* 30 */ "id", /* Used by: foreign_key_list */
/* 31 */ "seq",
/* 32 */ "table",
/* 33 */ "from",
/* 34 */ "to",
/* 35 */ "on_update",
/* 36 */ "on_delete",
/* 37 */ "match",
/* 38 */ "table", /* Used by: foreign_key_check */
/* 39 */ "rowid",
/* 40 */ "parent",
/* 41 */ "fkid",
/* 42 */ "busy", /* Used by: wal_checkpoint */
/* 43 */ "log",
/* 44 */ "checkpointed",
/* 45 */ "timeout", /* Used by: busy_timeout */
/* 46 */ "database", /* Used by: lock_status */
/* 47 */ "status",
};
/* Definitions of all built-in pragmas */
typedef struct PragmaName {
const char *const zName; /* Name of pragma */
u8 ePragTyp; /* PragTyp_XXX value */
u8 mPragFlg; /* Zero or more PragFlg_XXX values */
u8 iPragCName; /* Start of column names in pragCName[] */
u8 nPragCName; /* Num of col names. 0 means use pragma name */
u32 iArg; /* Extra argument */
} PragmaName;
static const PragmaName aPragmaName[] = {
#if defined(SQLITE_HAS_CODEC) || defined(SQLITE_ENABLE_CEROD)
{ /* zName: */ "activate_extensions",
/* ePragTyp: */ PragTyp_ACTIVATE_EXTENSIONS,
/* ePragFlag: */ 0,
/* iArg: */ 0 },
{/* zName: */ "activate_extensions",
/* ePragTyp: */ PragTyp_ACTIVATE_EXTENSIONS,
/* ePragFlg: */ 0,
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
{ /* zName: */ "application_id",
/* ePragTyp: */ PragTyp_HEADER_VALUE,
/* ePragFlag: */ 0,
/* iArg: */ BTREE_APPLICATION_ID },
{/* zName: */ "application_id",
/* ePragTyp: */ PragTyp_HEADER_VALUE,
/* ePragFlg: */ PragFlg_Result0,
/* ColNames: */ 0, 0,
/* iArg: */ BTREE_APPLICATION_ID },
#endif
#if !defined(SQLITE_OMIT_AUTOVACUUM)
{ /* zName: */ "auto_vacuum",
/* ePragTyp: */ PragTyp_AUTO_VACUUM,
/* ePragFlag: */ PragFlag_NeedSchema,
/* iArg: */ 0 },
{/* zName: */ "auto_vacuum",
/* ePragTyp: */ PragTyp_AUTO_VACUUM,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq,
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
#if !defined(SQLITE_OMIT_AUTOMATIC_INDEX)
{ /* zName: */ "automatic_index",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlag: */ 0,
/* iArg: */ SQLITE_AutoIndex },
{/* zName: */ "automatic_index",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
/* ColNames: */ 0, 0,
/* iArg: */ SQLITE_AutoIndex },
#endif
#endif
{ /* zName: */ "busy_timeout",
/* ePragTyp: */ PragTyp_BUSY_TIMEOUT,
/* ePragFlag: */ 0,
/* iArg: */ 0 },
{/* zName: */ "busy_timeout",
/* ePragTyp: */ PragTyp_BUSY_TIMEOUT,
/* ePragFlg: */ PragFlg_Result0,
/* ColNames: */ 45, 1,
/* iArg: */ 0 },
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
{ /* zName: */ "cache_size",
/* ePragTyp: */ PragTyp_CACHE_SIZE,
/* ePragFlag: */ PragFlag_NeedSchema,
/* iArg: */ 0 },
{/* zName: */ "cache_size",
/* ePragTyp: */ PragTyp_CACHE_SIZE,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq,
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
{ /* zName: */ "cache_spill",
/* ePragTyp: */ PragTyp_CACHE_SPILL,
/* ePragFlag: */ 0,
/* iArg: */ 0 },
{/* zName: */ "cache_spill",
/* ePragTyp: */ PragTyp_CACHE_SPILL,
/* ePragFlg: */ PragFlg_Result0|PragFlg_SchemaReq,
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
#endif
{ /* zName: */ "case_sensitive_like",
/* ePragTyp: */ PragTyp_CASE_SENSITIVE_LIKE,
/* ePragFlag: */ 0,
/* iArg: */ 0 },
{ /* zName: */ "cell_size_check",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlag: */ 0,
/* iArg: */ SQLITE_CellSizeCk },
{/* zName: */ "case_sensitive_like",
/* ePragTyp: */ PragTyp_CASE_SENSITIVE_LIKE,
/* ePragFlg: */ 0,
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
{/* zName: */ "cell_size_check",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
/* ColNames: */ 0, 0,
/* iArg: */ SQLITE_CellSizeCk },
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
{ /* zName: */ "checkpoint_fullfsync",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlag: */ 0,
/* iArg: */ SQLITE_CkptFullFSync },
{/* zName: */ "checkpoint_fullfsync",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
/* ColNames: */ 0, 0,
/* iArg: */ SQLITE_CkptFullFSync },
#endif
#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
{ /* zName: */ "collation_list",
/* ePragTyp: */ PragTyp_COLLATION_LIST,
/* ePragFlag: */ 0,
/* iArg: */ 0 },
{/* zName: */ "collation_list",
/* ePragTyp: */ PragTyp_COLLATION_LIST,
/* ePragFlg: */ PragFlg_Result0,
/* ColNames: */ 28, 2,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_COMPILEOPTION_DIAGS)
{ /* zName: */ "compile_options",
/* ePragTyp: */ PragTyp_COMPILE_OPTIONS,
/* ePragFlag: */ 0,
/* iArg: */ 0 },
{/* zName: */ "compile_options",
/* ePragTyp: */ PragTyp_COMPILE_OPTIONS,
/* ePragFlg: */ PragFlg_Result0,
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
{ /* zName: */ "count_changes",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlag: */ 0,
/* iArg: */ SQLITE_CountRows },
{/* zName: */ "count_changes",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
/* ColNames: */ 0, 0,
/* iArg: */ SQLITE_CountRows },
#endif
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && SQLITE_OS_WIN
{ /* zName: */ "data_store_directory",
/* ePragTyp: */ PragTyp_DATA_STORE_DIRECTORY,
/* ePragFlag: */ 0,
/* iArg: */ 0 },
{/* zName: */ "data_store_directory",
/* ePragTyp: */ PragTyp_DATA_STORE_DIRECTORY,
/* ePragFlg: */ 0,
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
{ /* zName: */ "data_version",
/* ePragTyp: */ PragTyp_HEADER_VALUE,
/* ePragFlag: */ PragFlag_ReadOnly,
/* iArg: */ BTREE_DATA_VERSION },
{/* zName: */ "data_version",
/* ePragTyp: */ PragTyp_HEADER_VALUE,
/* ePragFlg: */ PragFlg_Result0|PragFlg_ReadOnly,
/* ColNames: */ 0, 0,
/* iArg: */ BTREE_DATA_VERSION },
#endif
#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
{ /* zName: */ "database_list",
/* ePragTyp: */ PragTyp_DATABASE_LIST,
/* ePragFlag: */ PragFlag_NeedSchema,
/* iArg: */ 0 },
{/* zName: */ "database_list",
/* ePragTyp: */ PragTyp_DATABASE_LIST,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0,
/* ColNames: */ 25, 3,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && !defined(SQLITE_OMIT_DEPRECATED)
{ /* zName: */ "default_cache_size",
/* ePragTyp: */ PragTyp_DEFAULT_CACHE_SIZE,
/* ePragFlag: */ PragFlag_NeedSchema,
/* iArg: */ 0 },
{/* zName: */ "default_cache_size",
/* ePragTyp: */ PragTyp_DEFAULT_CACHE_SIZE,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq,
/* ColNames: */ 0, 1,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
{ /* zName: */ "defer_foreign_keys",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlag: */ 0,
/* iArg: */ SQLITE_DeferFKs },
{/* zName: */ "defer_foreign_keys",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
/* ColNames: */ 0, 0,
/* iArg: */ SQLITE_DeferFKs },
#endif
#endif
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
{ /* zName: */ "empty_result_callbacks",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlag: */ 0,
/* iArg: */ SQLITE_NullCallback },
{/* zName: */ "empty_result_callbacks",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
/* ColNames: */ 0, 0,
/* iArg: */ SQLITE_NullCallback },
#endif
#if !defined(SQLITE_OMIT_UTF16)
{ /* zName: */ "encoding",
/* ePragTyp: */ PragTyp_ENCODING,
/* ePragFlag: */ 0,
/* iArg: */ 0 },
{/* zName: */ "encoding",
/* ePragTyp: */ PragTyp_ENCODING,
/* ePragFlg: */ PragFlg_Result0,
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
{ /* zName: */ "foreign_key_check",
/* ePragTyp: */ PragTyp_FOREIGN_KEY_CHECK,
/* ePragFlag: */ PragFlag_NeedSchema,
/* iArg: */ 0 },
{/* zName: */ "foreign_key_check",
/* ePragTyp: */ PragTyp_FOREIGN_KEY_CHECK,
/* ePragFlg: */ PragFlg_NeedSchema,
/* ColNames: */ 38, 4,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_FOREIGN_KEY)
{ /* zName: */ "foreign_key_list",
/* ePragTyp: */ PragTyp_FOREIGN_KEY_LIST,
/* ePragFlag: */ PragFlag_NeedSchema,
/* iArg: */ 0 },
{/* zName: */ "foreign_key_list",
/* ePragTyp: */ PragTyp_FOREIGN_KEY_LIST,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt,
/* ColNames: */ 30, 8,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
{ /* zName: */ "foreign_keys",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlag: */ 0,
/* iArg: */ SQLITE_ForeignKeys },
{/* zName: */ "foreign_keys",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
/* ColNames: */ 0, 0,
/* iArg: */ SQLITE_ForeignKeys },
#endif
#endif
#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
{ /* zName: */ "freelist_count",
/* ePragTyp: */ PragTyp_HEADER_VALUE,
/* ePragFlag: */ PragFlag_ReadOnly,
/* iArg: */ BTREE_FREE_PAGE_COUNT },
{/* zName: */ "freelist_count",
/* ePragTyp: */ PragTyp_HEADER_VALUE,
/* ePragFlg: */ PragFlg_Result0|PragFlg_ReadOnly,
/* ColNames: */ 0, 0,
/* iArg: */ BTREE_FREE_PAGE_COUNT },
#endif
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
{ /* zName: */ "full_column_names",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlag: */ 0,
/* iArg: */ SQLITE_FullColNames },
{ /* zName: */ "fullfsync",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlag: */ 0,
/* iArg: */ SQLITE_FullFSync },
{/* zName: */ "full_column_names",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
/* ColNames: */ 0, 0,
/* iArg: */ SQLITE_FullColNames },
{/* zName: */ "fullfsync",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
/* ColNames: */ 0, 0,
/* iArg: */ SQLITE_FullFSync },
#endif
#if defined(SQLITE_HAS_CODEC)
{ /* zName: */ "hexkey",
/* ePragTyp: */ PragTyp_HEXKEY,
/* ePragFlag: */ 0,
/* iArg: */ 0 },
{ /* zName: */ "hexrekey",
/* ePragTyp: */ PragTyp_HEXKEY,
/* ePragFlag: */ 0,
/* iArg: */ 0 },
{/* zName: */ "hexkey",
/* ePragTyp: */ PragTyp_HEXKEY,
/* ePragFlg: */ 0,
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
{/* zName: */ "hexrekey",
/* ePragTyp: */ PragTyp_HEXKEY,
/* ePragFlg: */ 0,
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
#if !defined(SQLITE_OMIT_CHECK)
{ /* zName: */ "ignore_check_constraints",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlag: */ 0,
/* iArg: */ SQLITE_IgnoreChecks },
{/* zName: */ "ignore_check_constraints",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
/* ColNames: */ 0, 0,
/* iArg: */ SQLITE_IgnoreChecks },
#endif
#endif
#if !defined(SQLITE_OMIT_AUTOVACUUM)
{ /* zName: */ "incremental_vacuum",
/* ePragTyp: */ PragTyp_INCREMENTAL_VACUUM,
/* ePragFlag: */ PragFlag_NeedSchema,
/* iArg: */ 0 },
{/* zName: */ "incremental_vacuum",
/* ePragTyp: */ PragTyp_INCREMENTAL_VACUUM,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_NoColumns,
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
{ /* zName: */ "index_info",
/* ePragTyp: */ PragTyp_INDEX_INFO,
/* ePragFlag: */ PragFlag_NeedSchema,
/* iArg: */ 0 },
{ /* zName: */ "index_list",
/* ePragTyp: */ PragTyp_INDEX_LIST,
/* ePragFlag: */ PragFlag_NeedSchema,
/* iArg: */ 0 },
{ /* zName: */ "index_xinfo",
/* ePragTyp: */ PragTyp_INDEX_INFO,
/* ePragFlag: */ PragFlag_NeedSchema,
/* iArg: */ 1 },
{/* zName: */ "index_info",
/* ePragTyp: */ PragTyp_INDEX_INFO,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt,
/* ColNames: */ 11, 3,
/* iArg: */ 0 },
{/* zName: */ "index_list",
/* ePragTyp: */ PragTyp_INDEX_LIST,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt,
/* ColNames: */ 20, 5,
/* iArg: */ 0 },
{/* zName: */ "index_xinfo",
/* ePragTyp: */ PragTyp_INDEX_INFO,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt,
/* ColNames: */ 14, 6,
/* iArg: */ 1 },
#endif
#if !defined(SQLITE_OMIT_INTEGRITY_CHECK)
{ /* zName: */ "integrity_check",
/* ePragTyp: */ PragTyp_INTEGRITY_CHECK,
/* ePragFlag: */ PragFlag_NeedSchema,
/* iArg: */ 0 },
{/* zName: */ "integrity_check",
/* ePragTyp: */ PragTyp_INTEGRITY_CHECK,
/* ePragFlg: */ PragFlg_NeedSchema,
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
{ /* zName: */ "journal_mode",
/* ePragTyp: */ PragTyp_JOURNAL_MODE,
/* ePragFlag: */ PragFlag_NeedSchema,
/* iArg: */ 0 },
{ /* zName: */ "journal_size_limit",
/* ePragTyp: */ PragTyp_JOURNAL_SIZE_LIMIT,
/* ePragFlag: */ 0,
/* iArg: */ 0 },
{/* zName: */ "journal_mode",
/* ePragTyp: */ PragTyp_JOURNAL_MODE,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq,
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
{/* zName: */ "journal_size_limit",
/* ePragTyp: */ PragTyp_JOURNAL_SIZE_LIMIT,
/* ePragFlg: */ PragFlg_Result0|PragFlg_SchemaReq,
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
#endif
#if defined(SQLITE_HAS_CODEC)
{ /* zName: */ "key",
/* ePragTyp: */ PragTyp_KEY,
/* ePragFlag: */ 0,
/* iArg: */ 0 },
{/* zName: */ "key",
/* ePragTyp: */ PragTyp_KEY,
/* ePragFlg: */ 0,
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
{ /* zName: */ "legacy_file_format",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlag: */ 0,
/* iArg: */ SQLITE_LegacyFileFmt },
{/* zName: */ "legacy_file_format",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
/* ColNames: */ 0, 0,
/* iArg: */ SQLITE_LegacyFileFmt },
#endif
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && SQLITE_ENABLE_LOCKING_STYLE
{ /* zName: */ "lock_proxy_file",
/* ePragTyp: */ PragTyp_LOCK_PROXY_FILE,
/* ePragFlag: */ 0,
/* iArg: */ 0 },
{/* zName: */ "lock_proxy_file",
/* ePragTyp: */ PragTyp_LOCK_PROXY_FILE,
/* ePragFlg: */ 0,
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
#endif
#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
{ /* zName: */ "lock_status",
/* ePragTyp: */ PragTyp_LOCK_STATUS,
/* ePragFlag: */ 0,
/* iArg: */ 0 },
{/* zName: */ "lock_status",
/* ePragTyp: */ PragTyp_LOCK_STATUS,
/* ePragFlg: */ PragFlg_Result0,
/* ColNames: */ 46, 2,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
{ /* zName: */ "locking_mode",
/* ePragTyp: */ PragTyp_LOCKING_MODE,
/* ePragFlag: */ 0,
/* iArg: */ 0 },
{ /* zName: */ "max_page_count",
/* ePragTyp: */ PragTyp_PAGE_COUNT,
/* ePragFlag: */ PragFlag_NeedSchema,
/* iArg: */ 0 },
{ /* zName: */ "mmap_size",
/* ePragTyp: */ PragTyp_MMAP_SIZE,
/* ePragFlag: */ 0,
/* iArg: */ 0 },
{ /* zName: */ "page_count",
/* ePragTyp: */ PragTyp_PAGE_COUNT,
/* ePragFlag: */ PragFlag_NeedSchema,
/* iArg: */ 0 },
{ /* zName: */ "page_size",
/* ePragTyp: */ PragTyp_PAGE_SIZE,
/* ePragFlag: */ 0,
/* iArg: */ 0 },
{/* zName: */ "locking_mode",
/* ePragTyp: */ PragTyp_LOCKING_MODE,
/* ePragFlg: */ PragFlg_Result0|PragFlg_SchemaReq,
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
{/* zName: */ "max_page_count",
/* ePragTyp: */ PragTyp_PAGE_COUNT,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq,
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
{/* zName: */ "mmap_size",
/* ePragTyp: */ PragTyp_MMAP_SIZE,
/* ePragFlg: */ 0,
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
{/* zName: */ "page_count",
/* ePragTyp: */ PragTyp_PAGE_COUNT,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq,
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
{/* zName: */ "page_size",
/* ePragTyp: */ PragTyp_PAGE_SIZE,
/* ePragFlg: */ PragFlg_Result0|PragFlg_SchemaReq,
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
#endif
#if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_PARSER_TRACE)
{ /* zName: */ "parser_trace",
/* ePragTyp: */ PragTyp_PARSER_TRACE,
/* ePragFlag: */ 0,
/* iArg: */ 0 },
{/* zName: */ "parser_trace",
/* ePragTyp: */ PragTyp_PARSER_TRACE,
/* ePragFlg: */ 0,
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
{ /* zName: */ "query_only",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlag: */ 0,
/* iArg: */ SQLITE_QueryOnly },
{/* zName: */ "query_only",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
/* ColNames: */ 0, 0,
/* iArg: */ SQLITE_QueryOnly },
#endif
#if !defined(SQLITE_OMIT_INTEGRITY_CHECK)
{ /* zName: */ "quick_check",
/* ePragTyp: */ PragTyp_INTEGRITY_CHECK,
/* ePragFlag: */ PragFlag_NeedSchema,
/* iArg: */ 0 },
{/* zName: */ "quick_check",
/* ePragTyp: */ PragTyp_INTEGRITY_CHECK,
/* ePragFlg: */ PragFlg_NeedSchema,
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
{ /* zName: */ "read_uncommitted",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlag: */ 0,
/* iArg: */ SQLITE_ReadUncommitted },
{ /* zName: */ "recursive_triggers",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlag: */ 0,
/* iArg: */ SQLITE_RecTriggers },
{/* zName: */ "read_uncommitted",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
/* ColNames: */ 0, 0,
/* iArg: */ SQLITE_ReadUncommitted },
{/* zName: */ "recursive_triggers",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
/* ColNames: */ 0, 0,
/* iArg: */ SQLITE_RecTriggers },
#endif
#if defined(SQLITE_HAS_CODEC)
{ /* zName: */ "rekey",
/* ePragTyp: */ PragTyp_REKEY,
/* ePragFlag: */ 0,
/* iArg: */ 0 },
{/* zName: */ "rekey",
/* ePragTyp: */ PragTyp_REKEY,
/* ePragFlg: */ 0,
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
{ /* zName: */ "reverse_unordered_selects",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlag: */ 0,
/* iArg: */ SQLITE_ReverseOrder },
{/* zName: */ "reverse_unordered_selects",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
/* ColNames: */ 0, 0,
/* iArg: */ SQLITE_ReverseOrder },
#endif
#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
{ /* zName: */ "schema_version",
/* ePragTyp: */ PragTyp_HEADER_VALUE,
/* ePragFlag: */ 0,
/* iArg: */ BTREE_SCHEMA_VERSION },
{/* zName: */ "schema_version",
/* ePragTyp: */ PragTyp_HEADER_VALUE,
/* ePragFlg: */ PragFlg_Result0,
/* ColNames: */ 0, 0,
/* iArg: */ BTREE_SCHEMA_VERSION },
#endif
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
{ /* zName: */ "secure_delete",
/* ePragTyp: */ PragTyp_SECURE_DELETE,
/* ePragFlag: */ 0,
/* iArg: */ 0 },
{/* zName: */ "secure_delete",
/* ePragTyp: */ PragTyp_SECURE_DELETE,
/* ePragFlg: */ PragFlg_Result0,
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
{ /* zName: */ "short_column_names",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlag: */ 0,
/* iArg: */ SQLITE_ShortColNames },
{/* zName: */ "short_column_names",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
/* ColNames: */ 0, 0,
/* iArg: */ SQLITE_ShortColNames },
#endif
{ /* zName: */ "shrink_memory",
/* ePragTyp: */ PragTyp_SHRINK_MEMORY,
/* ePragFlag: */ 0,
/* iArg: */ 0 },
{ /* zName: */ "soft_heap_limit",
/* ePragTyp: */ PragTyp_SOFT_HEAP_LIMIT,
/* ePragFlag: */ 0,
/* iArg: */ 0 },
{/* zName: */ "shrink_memory",
/* ePragTyp: */ PragTyp_SHRINK_MEMORY,
/* ePragFlg: */ 0,
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
{/* zName: */ "soft_heap_limit",
/* ePragTyp: */ PragTyp_SOFT_HEAP_LIMIT,
/* ePragFlg: */ PragFlg_Result0,
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
#if defined(SQLITE_DEBUG)
{ /* zName: */ "sql_trace",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlag: */ 0,
/* iArg: */ SQLITE_SqlTrace },
{/* zName: */ "sql_trace",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
/* ColNames: */ 0, 0,
/* iArg: */ SQLITE_SqlTrace },
#endif
#endif
#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
{ /* zName: */ "stats",
/* ePragTyp: */ PragTyp_STATS,
/* ePragFlag: */ PragFlag_NeedSchema,
/* iArg: */ 0 },
{/* zName: */ "stats",
/* ePragTyp: */ PragTyp_STATS,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq,
/* ColNames: */ 7, 4,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
{ /* zName: */ "synchronous",
/* ePragTyp: */ PragTyp_SYNCHRONOUS,
/* ePragFlag: */ PragFlag_NeedSchema,
/* iArg: */ 0 },
{/* zName: */ "synchronous",
/* ePragTyp: */ PragTyp_SYNCHRONOUS,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq,
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
{ /* zName: */ "table_info",
/* ePragTyp: */ PragTyp_TABLE_INFO,
/* ePragFlag: */ PragFlag_NeedSchema,
/* iArg: */ 0 },
{/* zName: */ "table_info",
/* ePragTyp: */ PragTyp_TABLE_INFO,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt,
/* ColNames: */ 1, 6,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
{ /* zName: */ "temp_store",
/* ePragTyp: */ PragTyp_TEMP_STORE,
/* ePragFlag: */ 0,
/* iArg: */ 0 },
{ /* zName: */ "temp_store_directory",
/* ePragTyp: */ PragTyp_TEMP_STORE_DIRECTORY,
/* ePragFlag: */ 0,
/* iArg: */ 0 },
{/* zName: */ "temp_store",
/* ePragTyp: */ PragTyp_TEMP_STORE,
/* ePragFlg: */ PragFlg_Result0,
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
{/* zName: */ "temp_store_directory",
/* ePragTyp: */ PragTyp_TEMP_STORE_DIRECTORY,
/* ePragFlg: */ 0,
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
#endif
{ /* zName: */ "threads",
/* ePragTyp: */ PragTyp_THREADS,
/* ePragFlag: */ 0,
/* iArg: */ 0 },
{/* zName: */ "threads",
/* ePragTyp: */ PragTyp_THREADS,
/* ePragFlg: */ PragFlg_Result0,
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
{ /* zName: */ "user_version",
/* ePragTyp: */ PragTyp_HEADER_VALUE,
/* ePragFlag: */ 0,
/* iArg: */ BTREE_USER_VERSION },
{/* zName: */ "user_version",
/* ePragTyp: */ PragTyp_HEADER_VALUE,
/* ePragFlg: */ PragFlg_Result0,
/* ColNames: */ 0, 0,
/* iArg: */ BTREE_USER_VERSION },
#endif
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
#if defined(SQLITE_DEBUG)
{ /* zName: */ "vdbe_addoptrace",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlag: */ 0,
/* iArg: */ SQLITE_VdbeAddopTrace },
{ /* zName: */ "vdbe_debug",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlag: */ 0,
/* iArg: */ SQLITE_SqlTrace|SQLITE_VdbeListing|SQLITE_VdbeTrace },
{ /* zName: */ "vdbe_eqp",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlag: */ 0,
/* iArg: */ SQLITE_VdbeEQP },
{ /* zName: */ "vdbe_listing",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlag: */ 0,
/* iArg: */ SQLITE_VdbeListing },
{ /* zName: */ "vdbe_trace",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlag: */ 0,
/* iArg: */ SQLITE_VdbeTrace },
{/* zName: */ "vdbe_addoptrace",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
/* ColNames: */ 0, 0,
/* iArg: */ SQLITE_VdbeAddopTrace },
{/* zName: */ "vdbe_debug",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
/* ColNames: */ 0, 0,
/* iArg: */ SQLITE_SqlTrace|SQLITE_VdbeListing|SQLITE_VdbeTrace },
{/* zName: */ "vdbe_eqp",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
/* ColNames: */ 0, 0,
/* iArg: */ SQLITE_VdbeEQP },
{/* zName: */ "vdbe_listing",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
/* ColNames: */ 0, 0,
/* iArg: */ SQLITE_VdbeListing },
{/* zName: */ "vdbe_trace",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
/* ColNames: */ 0, 0,
/* iArg: */ SQLITE_VdbeTrace },
#endif
#endif
#if !defined(SQLITE_OMIT_WAL)
{ /* zName: */ "wal_autocheckpoint",
/* ePragTyp: */ PragTyp_WAL_AUTOCHECKPOINT,
/* ePragFlag: */ 0,
/* iArg: */ 0 },
{ /* zName: */ "wal_checkpoint",
/* ePragTyp: */ PragTyp_WAL_CHECKPOINT,
/* ePragFlag: */ PragFlag_NeedSchema,
/* iArg: */ 0 },
{/* zName: */ "wal_autocheckpoint",
/* ePragTyp: */ PragTyp_WAL_AUTOCHECKPOINT,
/* ePragFlg: */ 0,
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
{/* zName: */ "wal_checkpoint",
/* ePragTyp: */ PragTyp_WAL_CHECKPOINT,
/* ePragFlg: */ PragFlg_NeedSchema,
/* ColNames: */ 42, 3,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
{ /* zName: */ "writable_schema",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlag: */ 0,
/* iArg: */ SQLITE_WriteSchema|SQLITE_RecoveryMode },
{/* zName: */ "writable_schema",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns,
/* ColNames: */ 0, 0,
/* iArg: */ SQLITE_WriteSchema|SQLITE_RecoveryMode },
#endif
};
/* Number of pragmas: 60 on by default, 73 total. */

View File

@ -3563,6 +3563,9 @@ u32 sqlite3ExprListFlags(const ExprList*);
int sqlite3Init(sqlite3*, char**);
int sqlite3InitCallback(void*, int, char**, char**);
void sqlite3Pragma(Parse*,Token*,Token*,Token*,int);
#ifndef SQLITE_OMIT_VIRTUALTABLE
Module *sqlite3PragmaVtabRegister(sqlite3*,const char *zName);
#endif
void sqlite3ResetAllSchemasOfConnection(sqlite3*);
void sqlite3ResetOneSchema(sqlite3*,int);
void sqlite3CollapseDatabaseArray(sqlite3*);
@ -4077,6 +4080,13 @@ void sqlite3AutoLoadExtensions(sqlite3*);
int sqlite3VtabSavepoint(sqlite3 *, int, int);
void sqlite3VtabImportErrmsg(Vdbe*, sqlite3_vtab*);
VTable *sqlite3GetVTable(sqlite3*, Table*);
Module *sqlite3VtabCreateModule(
sqlite3*,
const char*,
const sqlite3_module*,
void*,
void(*)(void*)
);
# define sqlite3VtabInSync(db) ((db)->nVTrans>0 && (db)->aVTrans==0)
#endif
int sqlite3VtabEponymousTableInit(Parse*,Module*);

View File

@ -308,7 +308,7 @@ void sqlite3FinishTrigger(
z = sqlite3DbStrNDup(db, (char*)pAll->z, pAll->n);
sqlite3NestedParse(pParse,
"INSERT INTO %Q.%s VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')",
db->aDb[iDb].zDbSName, SCHEMA_TABLE(iDb), zName,
db->aDb[iDb].zDbSName, MASTER_NAME, zName,
pTrig->table, z);
sqlite3DbFree(db, z);
sqlite3ChangeCookie(pParse, iDb);
@ -559,7 +559,7 @@ void sqlite3DropTriggerPtr(Parse *pParse, Trigger *pTrigger){
if( (v = sqlite3GetVdbe(pParse))!=0 ){
sqlite3NestedParse(pParse,
"DELETE FROM %Q.%s WHERE name=%Q AND type='trigger'",
db->aDb[iDb].zDbSName, SCHEMA_TABLE(iDb), pTrigger->zName
db->aDb[iDb].zDbSName, MASTER_NAME, pTrigger->zName
);
sqlite3ChangeCookie(pParse, iDb);
sqlite3VdbeAddOp4(v, OP_DropTrigger, iDb, 0, 0, pTrigger->zName, 0);

View File

@ -5479,7 +5479,7 @@ case OP_ParseSchema: {
assert( iDb>=0 && iDb<db->nDb );
assert( DbHasProperty(db, iDb, DB_SchemaLoaded) );
/* Used to be a conditional */ {
zMaster = SCHEMA_TABLE(iDb);
zMaster = MASTER_NAME;
initData.db = db;
initData.iDb = pOp->p1;
initData.pzErrMsg = &p->zErrMsg;

View File

@ -28,6 +28,41 @@ struct VtabCtx {
int bDeclared; /* True after sqlite3_declare_vtab() is called */
};
/*
** Construct and install a Module object for a virtual table. When this
** routine is called, it is guaranteed that all appropriate locks are held
** and the module is not already part of the connection.
*/
Module *sqlite3VtabCreateModule(
sqlite3 *db, /* Database in which module is registered */
const char *zName, /* Name assigned to this module */
const sqlite3_module *pModule, /* The definition of the module */
void *pAux, /* Context pointer for xCreate/xConnect */
void (*xDestroy)(void *) /* Module destructor function */
){
Module *pMod;
int nName = sqlite3Strlen30(zName);
pMod = (Module *)sqlite3DbMallocRawNN(db, sizeof(Module) + nName + 1);
if( pMod ){
Module *pDel;
char *zCopy = (char *)(&pMod[1]);
memcpy(zCopy, zName, nName+1);
pMod->zName = zCopy;
pMod->pModule = pModule;
pMod->pAux = pAux;
pMod->xDestroy = xDestroy;
pMod->pEpoTab = 0;
pDel = (Module *)sqlite3HashInsert(&db->aModule,zCopy,(void*)pMod);
assert( pDel==0 || pDel==pMod );
if( pDel ){
sqlite3OomFault(db);
sqlite3DbFree(db, pDel);
pMod = 0;
}
}
return pMod;
}
/*
** The actual function that does the work of creating a new module.
** This function implements the sqlite3_create_module() and
@ -41,35 +76,15 @@ static int createModule(
void (*xDestroy)(void *) /* Module destructor function */
){
int rc = SQLITE_OK;
int nName;
sqlite3_mutex_enter(db->mutex);
nName = sqlite3Strlen30(zName);
if( sqlite3HashFind(&db->aModule, zName) ){
rc = SQLITE_MISUSE_BKPT;
}else{
Module *pMod;
pMod = (Module *)sqlite3DbMallocRawNN(db, sizeof(Module) + nName + 1);
if( pMod ){
Module *pDel;
char *zCopy = (char *)(&pMod[1]);
memcpy(zCopy, zName, nName+1);
pMod->zName = zCopy;
pMod->pModule = pModule;
pMod->pAux = pAux;
pMod->xDestroy = xDestroy;
pMod->pEpoTab = 0;
pDel = (Module *)sqlite3HashInsert(&db->aModule,zCopy,(void*)pMod);
assert( pDel==0 || pDel==pMod );
if( pDel ){
sqlite3OomFault(db);
sqlite3DbFree(db, pDel);
}
}
(void)sqlite3VtabCreateModule(db, zName, pModule, pAux, xDestroy);
}
rc = sqlite3ApiExit(db, rc);
if( rc!=SQLITE_OK && xDestroy ) xDestroy(pAux);
sqlite3_mutex_leave(db->mutex);
return rc;
}
@ -408,7 +423,7 @@ void sqlite3VtabFinishParse(Parse *pParse, Token *pEnd){
"UPDATE %Q.%s "
"SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q "
"WHERE rowid=#%d",
db->aDb[iDb].zDbSName, SCHEMA_TABLE(iDb),
db->aDb[iDb].zDbSName, MASTER_NAME,
pTab->zName,
pTab->zName,
zStmt,

View File

@ -77,7 +77,7 @@ do_test alter-1.2 {
ifcapable tempdb {
execsql {
INSERT INTO objlist SELECT type, name, tbl_name
FROM sqlite_temp_master WHERE NAME!='objlist';
FROM temp.sqlite_master WHERE NAME!='objlist';
}
}
@ -153,7 +153,7 @@ ifcapable tempdb {
CREATE TEMP TABLE objlist(type, name, tbl_name);
INSERT INTO objlist SELECT type, name, tbl_name FROM sqlite_master;
INSERT INTO objlist
SELECT type, name, tbl_name FROM sqlite_temp_master
SELECT type, name, tbl_name FROM temp.sqlite_master
WHERE NAME!='objlist';
SELECT type, name, tbl_name FROM objlist
ORDER BY tbl_name, type desc, name;
@ -524,7 +524,7 @@ do_test alter-3.3.7 {
ifcapable tempdb {
do_test alter-3.3.8 {
execsql {
SELECT * FROM sqlite_temp_master WHERE type = 'trigger';
SELECT * FROM temp.sqlite_master WHERE type = 'trigger';
}
} {}
}

View File

@ -45,18 +45,33 @@ do_test alter4-1.1 {
SELECT sql FROM sqlite_temp_master;
}
} {{CREATE TABLE abc(a, b, c)}}
do_test alter4-1.1b {
execsql {
SELECT sql FROM temp.sqlite_master;
}
} {{CREATE TABLE abc(a, b, c)}}
do_test alter4-1.2 {
execsql {ALTER TABLE abc ADD d INTEGER;}
execsql {
SELECT sql FROM sqlite_temp_master;
}
} {{CREATE TABLE abc(a, b, c, d INTEGER)}}
do_test alter4-1.2b {
execsql {
SELECT sql FROM temp.sqlite_master;
}
} {{CREATE TABLE abc(a, b, c, d INTEGER)}}
do_test alter4-1.3 {
execsql {ALTER TABLE abc ADD e}
execsql {
SELECT sql FROM sqlite_temp_master;
}
} {{CREATE TABLE abc(a, b, c, d INTEGER, e)}}
do_test alter4-1.3b {
execsql {
SELECT sql FROM temp.sqlite_master;
}
} {{CREATE TABLE abc(a, b, c, d INTEGER, e)}}
do_test alter4-1.4 {
execsql {
CREATE TABLE temp.t1(a, b);
@ -64,6 +79,11 @@ do_test alter4-1.4 {
SELECT sql FROM sqlite_temp_master WHERE tbl_name = 't1';
}
} {{CREATE TABLE t1(a, b, c)}}
do_test alter4-1.4b {
execsql {
SELECT sql FROM temp.sqlite_master WHERE tbl_name = 't1';
}
} {{CREATE TABLE t1(a, b, c)}}
do_test alter4-1.5 {
execsql {
ALTER TABLE t1 ADD d CHECK (a>d);

View File

@ -193,7 +193,7 @@ do_test attach-1.20.2 {
} ;# ifcapable schema_pragmas
integrity_check attach-1.20.3
ifcapable tempdb {
execsql {select * from sqlite_temp_master}
execsql {select * from temp.sqlite_master}
}
do_test attach-1.21 {
catchsql {

View File

@ -207,7 +207,7 @@ ifcapable tempdb {
CREATE TEMP TRIGGER tst_trigger BEFORE INSERT ON aux.t4 BEGIN
SELECT 'hello world';
END;
SELECT count(*) FROM sqlite_temp_master;
SELECT count(*) FROM temp.sqlite_master;
}
} {1}
do_test attach3-9.1 {
@ -219,7 +219,7 @@ ifcapable tempdb {
do_test attach3-9.2 {
execsql {
DROP TABLE aux.t4;
SELECT count(*) FROM sqlite_temp_master;
SELECT count(*) FROM temp.sqlite_master;
}
} {0}
}

View File

@ -91,7 +91,7 @@ ifcapable tempdb {
catchsql {CREATE TEMP TABLE t1(a,b,c)}
} {1 {not authorized}}
do_test auth-1.6 {
execsql {SELECT name FROM sqlite_temp_master}
execsql {SELECT name FROM temp.sqlite_master}
} {}
do_test auth-1.7.1 {
proc auth {code arg1 arg2 arg3 arg4 args} {
@ -148,7 +148,7 @@ ifcapable tempdb {
catchsql {CREATE TEMP TABLE t1(a,b,c)}
} {0 {}}
do_test auth-1.14 {
execsql {SELECT name FROM sqlite_temp_master}
execsql {SELECT name FROM temp.sqlite_master}
} {}
do_test auth-1.15 {
proc auth {code arg1 arg2 arg3 arg4 args} {
@ -561,7 +561,7 @@ ifcapable tempdb {
catchsql {DROP TABLE t1}
} {0 {}}
do_test auth-1.78 {
execsql {SELECT name FROM sqlite_temp_master}
execsql {SELECT name FROM temp.sqlite_master}
} {t1}
}
@ -632,7 +632,7 @@ ifcapable tempdb {
set ::authargs
} {v1 {} temp {}}
do_test auth-1.90 {
execsql {SELECT name FROM sqlite_temp_master}
execsql {SELECT name FROM temp.sqlite_master}
} {t1}
}
@ -779,7 +779,7 @@ ifcapable tempdb {
}
} {1 {not authorized}}
do_test auth-1.113 {
execsql {SELECT name FROM sqlite_temp_master}
execsql {SELECT name FROM temp.sqlite_master}
} {t1 v1}
do_test auth-1.114 {
proc auth {code arg1 arg2 arg3 arg4 args} {
@ -823,7 +823,7 @@ ifcapable tempdb {
set ::authargs
} {v1 {} temp {}}
do_test auth-1.121 {
execsql {SELECT name FROM sqlite_temp_master}
execsql {SELECT name FROM temp.sqlite_master}
} {t1 v1}
do_test auth-1.122 {
proc auth {code arg1 arg2 arg3 arg4 args} {
@ -980,7 +980,7 @@ do_test auth-1.139 {
set ::authargs
} {r1 t1 temp {}}
do_test auth-1.140 {
execsql {SELECT name FROM sqlite_temp_master}
execsql {SELECT name FROM temp.sqlite_master}
} {t1}
do_test auth-1.141 {
proc auth {code arg1 arg2 arg3 arg4 args} {
@ -1016,7 +1016,7 @@ do_test auth-1.144 {
set ::authargs
} {r1 t1 temp {}}
do_test auth-1.145 {
execsql {SELECT name FROM sqlite_temp_master}
execsql {SELECT name FROM temp.sqlite_master}
} {t1}
do_test auth-1.146 {
proc auth {code arg1 arg2 arg3 arg4 args} {
@ -1052,7 +1052,7 @@ do_test auth-1.149 {
set ::authargs
} {r1 t1 temp {}}
do_test auth-1.150 {
execsql {SELECT name FROM sqlite_temp_master}
execsql {SELECT name FROM temp.sqlite_master}
} {t1 r1}
do_test auth-1.151 {
@ -1142,7 +1142,7 @@ do_test auth-1.164 {
catchsql {DROP TRIGGER r1}
} {1 {not authorized}}
do_test auth-1.165 {
execsql {SELECT name FROM sqlite_temp_master}
execsql {SELECT name FROM temp.sqlite_master}
} {t1 r1}
do_test auth-1.166 {
proc auth {code arg1 arg2 arg3 arg4 args} {
@ -1170,7 +1170,7 @@ do_test auth-1.169 {
catchsql {DROP TRIGGER r1}
} {0 {}}
do_test auth-1.170 {
execsql {SELECT name FROM sqlite_temp_master}
execsql {SELECT name FROM temp.sqlite_master}
} {t1 r1}
do_test auth-1.171 {
proc auth {code arg1 arg2 arg3 arg4 args} {
@ -1202,7 +1202,7 @@ do_test auth-1.175 {
set ::authargs
} {r1 t1 temp {}}
do_test auth-1.176 {
execsql {SELECT name FROM sqlite_temp_master}
execsql {SELECT name FROM temp.sqlite_master}
} {t1}
} ;# ifcapable trigger
@ -1306,7 +1306,7 @@ ifcapable tempdb {
catchsql {CREATE INDEX i1 ON t1(b)}
} {1 {not authorized}}
do_test auth-1.194 {
execsql {SELECT name FROM sqlite_temp_master}
execsql {SELECT name FROM temp.sqlite_master}
} {t1}
do_test auth-1.195 {
proc auth {code arg1 arg2 arg3 arg4 args} {
@ -1350,7 +1350,7 @@ ifcapable tempdb {
set ::authargs
} {i1 t1 temp {}}
do_test auth-1.202 {
execsql {SELECT name FROM sqlite_temp_master}
execsql {SELECT name FROM temp.sqlite_master}
} {t1 i1}
}
@ -1466,7 +1466,7 @@ ifcapable tempdb {
catchsql {DROP INDEX i1}
} {0 {}}
do_test auth-1.222 {
execsql {SELECT name FROM sqlite_temp_master}
execsql {SELECT name FROM temp.sqlite_master}
} {t1 i1}
do_test auth-1.223 {
proc auth {code arg1 arg2 arg3 arg4 args} {
@ -1482,7 +1482,7 @@ ifcapable tempdb {
set ::authargs
} {i1 t1 temp {}}
do_test auth-1.225 {
execsql {SELECT name FROM sqlite_temp_master}
execsql {SELECT name FROM temp.sqlite_master}
} {t1 i1}
do_test auth-1.226 {
proc auth {code arg1 arg2 arg3 arg4 args} {
@ -1498,7 +1498,7 @@ ifcapable tempdb {
set ::authargs
} {i1 t1 temp {}}
do_test auth-1.228 {
execsql {SELECT name FROM sqlite_temp_master}
execsql {SELECT name FROM temp.sqlite_master}
} {t1}
}
@ -1765,7 +1765,7 @@ ifcapable attach {
}
} {0 {}}
do_test auth-1.267 {
execsql {SELECT name FROM sqlite_temp_master WHERE type='table'}
execsql {SELECT name FROM temp.sqlite_master WHERE type='table'}
} {t1x}
do_test auth-1.268 {
set authargs
@ -2070,7 +2070,7 @@ ifcapable {altertable} {
}
} {1 {not authorized}}
do_test auth-1.307 {
set x [execsql {SELECT sql FROM sqlite_temp_master WHERE type='t5'}]
set x [execsql {SELECT sql FROM temp.sqlite_master WHERE type='t5'}]
regexp new_col_3 $x
} {0}
@ -2373,7 +2373,7 @@ ifcapable compound&&subquery {
do_test auth-5.2 {
execsql {
SELECT name FROM (
SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master)
SELECT * FROM sqlite_master UNION ALL SELECT * FROM temp.sqlite_master)
WHERE type='table'
ORDER BY name
}

View File

@ -122,7 +122,7 @@ do_execsql_test auth3-3.0 {
key TEXT NOT NULL ON CONFLICT FAIL UNIQUE ON CONFLICT REPLACE,
value TEXT NOT NULL ON CONFLICT FAIL);
ALTER TABLE TempTable RENAME TO DoNotRead;
SELECT name FROM sqlite_temp_master;
SELECT name FROM temp.sqlite_master;
} {DoNotRead sqlite_autoindex_DoNotRead_1}
finish_test

View File

@ -344,7 +344,7 @@ ifcapable tempdb {
do_test autoinc-4.1 {
execsql {
SELECT 1, name FROM sqlite_master WHERE type='table';
SELECT 2, name FROM sqlite_temp_master WHERE type='table';
SELECT 2, name FROM temp.sqlite_master WHERE type='table';
}
} {1 sqlite_sequence}
do_test autoinc-4.2 {

View File

@ -172,4 +172,3 @@ do_execsql_test 3.1 { CREATE VIRTUAL TABLE t3 USING tcl('vvv_command') }
do_execsql_test 3.2 { CREATE VIRTUAL TABLE t4 USING tcl('yyy_command') }
finish_test

View File

@ -118,4 +118,3 @@ for {set param1 0} {$param1<16} {incr param1} {
}
finish_test

View File

@ -45,7 +45,7 @@ proc list_all_views {{db db}} {
set res [list]
$db eval { PRAGMA database_list } {
set tbl "$name.sqlite_master"
if {$name == "temp"} { set tbl sqlite_temp_master }
if {$name == "temp"} { set tbl temp.sqlite_master }
set sql "SELECT '$name.' || name FROM $tbl WHERE type = 'view'"
lappend res {*}[$db eval $sql]

View File

@ -1062,7 +1062,7 @@ ifcapable altertable {
PRAGMA foreign_keys = off;
ALTER TABLE t2 ADD COLUMN h DEFAULT 'text' REFERENCES t1;
PRAGMA foreign_keys = on;
SELECT sql FROM sqlite_temp_master WHERE name='t2';
SELECT sql FROM temp.sqlite_master WHERE name='t2';
}
} {{CREATE TABLE t2(a, b, c REFERENCES t1, d DEFAULT NULL REFERENCES t1, e REFERENCES t1 DEFAULT NULL, h DEFAULT 'text' REFERENCES t1)}}
@ -1093,7 +1093,7 @@ ifcapable altertable {
]
do_test fkey2-14.2tmp.2.2 {
execsql { ALTER TABLE t1 RENAME TO t4 }
execsql { SELECT sql FROM sqlite_temp_master WHERE type = 'table'}
execsql { SELECT sql FROM temp.sqlite_master WHERE type = 'table'}
} [list \
{CREATE TABLE "t4"(a PRIMARY KEY, b REFERENCES "t4")} \
{CREATE TABLE t2(a PRIMARY KEY, b REFERENCES "t4", c REFERENCES t2)} \

View File

@ -107,4 +107,3 @@ do_test 4.4 {
close $blob
finish_test

View File

@ -42,7 +42,7 @@ do_test intarray-1.1 {
set ia3 [sqlite3_intarray_create db ia3]
set ia4 [sqlite3_intarray_create db ia4]
db eval {
SELECT type, name FROM sqlite_temp_master
SELECT type, name FROM temp.sqlite_master
ORDER BY name
}
} {table ia1 table ia2 table ia3 table ia4}

View File

@ -128,7 +128,7 @@ ifcapable tempdb {
} {1 interrupted}
do_test interrupt-3.$i.3 {
execsql {
SELECT name FROM sqlite_temp_master;
SELECT name FROM temp.sqlite_master;
}
} {}
do_test interrupt-3.$i.4 {
@ -139,7 +139,7 @@ ifcapable tempdb {
do_test interrupt-3.$i.5 {
catchsql {SELECT name FROM sqlite_temp_master};
execsql {
SELECT name FROM sqlite_temp_master;
SELECT name FROM temp.sqlite_master;
}
} {}
}

View File

@ -122,4 +122,3 @@ do_execsql_test 3.0 {
finish_test

View File

@ -317,5 +317,3 @@ foreach {tn n sql} {
finish_test

View File

@ -299,4 +299,3 @@ do_execsql_test 7.3 {
finish_test

View File

@ -69,4 +69,3 @@ do_faultsim_test 6 -faults oom* -body {
}
finish_test

View File

@ -149,7 +149,7 @@ ifcapable altertable {
} {}
do_execsql_test schema4-2.8 {
select sql from sqlite_temp_master WHERE type='table';
select sql from temp.sqlite_master WHERE type='table';
} {{CREATE TABLE x1(x)}}
do_execsql_test schema4-2.7 { ALTER TABLE tbl RENAME TO tbl2 } {}

View File

@ -198,5 +198,3 @@ do_test 4.7 {
} {1 SQLITE_ERROR}
finish_test

View File

@ -74,4 +74,3 @@ do_execsql_test 1.4 {
} {1 1 1}
finish_test

View File

@ -236,7 +236,7 @@ do_test 5.1 {
do_execsql_test 5.2 {
SELECT * FROM sqlite_master;
SELECT * FROM sqlite_temp_master;
SELECT * FROM temp.sqlite_master;
} {
trigger tr1 t1 0
{CREATE TRIGGER tr1 BEFORE INSERT ON t1 BEGIN SELECT 1,2,3; END}

View File

@ -23,7 +23,7 @@ source $testdir/tester.tcl
do_test tkt3630-1 {
db eval {
CREATE TEMP TABLE temp1(a,b,c);
SELECT * FROM sqlite_temp_master WHERE sql GLOB '*TEMP*';
SELECT * FROM temp.sqlite_master WHERE sql GLOB '*TEMP*';
}
} {}
do_test tkt3630-2 {
@ -39,7 +39,7 @@ ifcapable altertable {
db eval {
ALTER TABLE temp2 ADD COLUMN d;
ALTER TABLE temp2 RENAME TO temp2rn;
SELECT name FROM sqlite_temp_master WHERE name LIKE 'temp2%';
SELECT name FROM temp.sqlite_master WHERE name LIKE 'temp2%';
}
} {temp2rn}
}

View File

@ -62,7 +62,7 @@ do_test tkt3810-3 {
# an orphan.
#
do_test tkt3810-4 {
execsql {SELECT name FROM sqlite_temp_master ORDER BY name}
execsql {SELECT name FROM temp.sqlite_master ORDER BY name}
} {r1}
# Because it is an orphan, it cannot be dropped.

View File

@ -1031,7 +1031,7 @@ ifcapable altertable {
PRAGMA foreign_keys = off;
ALTER TABLE t2 ADD COLUMN h DEFAULT 'text' REFERENCES t1;
PRAGMA foreign_keys = on;
SELECT sql FROM sqlite_temp_master WHERE name='t2';
SELECT sql FROM temp.sqlite_master WHERE name='t2';
}
} {{CREATE TABLE t2(a, b, c REFERENCES t1, d DEFAULT NULL REFERENCES t1, e REFERENCES t1 DEFAULT NULL, h DEFAULT 'text' REFERENCES t1)}}
@ -1064,7 +1064,7 @@ ifcapable altertable {
]
do_test without_rowid3-14.2tmp.2.2 {
execsql { ALTER TABLE t1 RENAME TO t4 }
execsql { SELECT sql FROM sqlite_temp_master WHERE type = 'table'}
execsql { SELECT sql FROM temp.sqlite_master WHERE type = 'table'}
} [list \
{CREATE TABLE "t4"(a PRIMARY KEY, b REFERENCES "t4") WITHOUT rowid} \
{CREATE TABLE t2(a PRIMARY KEY, b REFERENCES "t4", c REFERENCES t2)

View File

@ -10,6 +10,15 @@
# new pragma in ../src/pragma.c.
#
# Flag meanings:
set flagMeaning(NeedSchema) {Force schema load before running}
set flagMeaning(ReadOnly) {Read-only HEADER_VALUE}
set flagMeaning(Result0) {Acts as query when no argument}
set flagMeaning(Result1) {Acts as query when has one argument}
set flagMeaning(SchemaReq) {Schema required - "main" is default}
set flagMeaning(SchemaOpt) {Schema restricts name search if present}
set flagMeaning(NoColumns) {OP_ResultRow called with zero columns}
set pragma_def {
NAME: full_column_names
TYPE: FLAG
@ -47,6 +56,7 @@ set pragma_def {
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
NAME: cache_spill
FLAG: Result0 SchemaReq
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
NAME: reverse_unordered_selects
@ -139,50 +149,56 @@ set pragma_def {
ARG: SQLITE_CellSizeCk
NAME: default_cache_size
FLAG: NeedSchema
FLAG: NeedSchema Result0 SchemaReq
COLS: cache_size
IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS) && !defined(SQLITE_OMIT_DEPRECATED)
NAME: page_size
FLAG: Result0 SchemaReq
IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
NAME: secure_delete
FLAG: Result0
IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
NAME: page_count
FLAG: NeedSchema
FLAG: NeedSchema Result0 SchemaReq
IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
NAME: max_page_count
TYPE: PAGE_COUNT
FLAG: NeedSchema
FLAG: NeedSchema Result0 SchemaReq
IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
NAME: locking_mode
FLAG: Result0 SchemaReq
IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
NAME: journal_mode
FLAG: NeedSchema
FLAG: NeedSchema Result0 SchemaReq
IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
NAME: journal_size_limit
FLAG: Result0 SchemaReq
IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
NAME: cache_size
FLAG: NeedSchema
FLAG: NeedSchema Result0 SchemaReq
IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
NAME: mmap_size
IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
NAME: auto_vacuum
FLAG: NeedSchema
FLAG: NeedSchema Result0 SchemaReq
IF: !defined(SQLITE_OMIT_AUTOVACUUM)
NAME: incremental_vacuum
FLAG: NeedSchema
FLAG: NeedSchema NoColumns
IF: !defined(SQLITE_OMIT_AUTOVACUUM)
NAME: temp_store
FLAG: Result0
IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
NAME: temp_store_directory
@ -195,46 +211,56 @@ set pragma_def {
IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS) && SQLITE_ENABLE_LOCKING_STYLE
NAME: synchronous
FLAG: NeedSchema
FLAG: NeedSchema Result0 SchemaReq
IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
NAME: table_info
FLAG: NeedSchema
FLAG: NeedSchema Result1 SchemaOpt
COLS: cid name type notnull dflt_value pk
IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
NAME: stats
FLAG: NeedSchema
FLAG: NeedSchema Result0 SchemaReq
COLS: table index width height
IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
NAME: index_info
TYPE: INDEX_INFO
ARG: 0
FLAG: NeedSchema
FLAG: NeedSchema Result1 SchemaOpt
COLS: seqno cid name
IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
NAME: index_xinfo
TYPE: INDEX_INFO
ARG: 1
FLAG: NeedSchema
FLAG: NeedSchema Result1 SchemaOpt
COLS: seqno cid name desc coll key
IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
NAME: index_list
FLAG: NeedSchema
FLAG: NeedSchema Result1 SchemaOpt
COLS: seq name unique origin partial
IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
NAME: database_list
FLAG: NeedSchema
FLAG: NeedSchema Result0
COLS: seq name file
IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
NAME: collation_list
FLAG: Result0
COLS: seq name
IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
NAME: foreign_key_list
FLAG: NeedSchema
FLAG: NeedSchema Result1 SchemaOpt
COLS: id seq table from to on_update on_delete match
IF: !defined(SQLITE_OMIT_FOREIGN_KEY)
NAME: foreign_key_check
FLAG: NeedSchema
COLS: table rowid parent fkid
IF: !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
NAME: parser_trace
@ -252,6 +278,7 @@ set pragma_def {
IF: !defined(SQLITE_OMIT_INTEGRITY_CHECK)
NAME: encoding
FLAG: Result0
IF: !defined(SQLITE_OMIT_UTF16)
NAME: schema_version
@ -282,10 +309,12 @@ set pragma_def {
IF: !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
NAME: compile_options
FLAG: Result0
IF: !defined(SQLITE_OMIT_COMPILEOPTION_DIAGS)
NAME: wal_checkpoint
FLAG: NeedSchema
COLS: busy log checkpointed
IF: !defined(SQLITE_OMIT_WAL)
NAME: wal_autocheckpoint
@ -294,8 +323,12 @@ set pragma_def {
NAME: shrink_memory
NAME: busy_timeout
FLAG: Result0
COLS: timeout
NAME: lock_status
FLAG: Result0
COLS: database status
IF: defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
NAME: key
@ -315,8 +348,10 @@ set pragma_def {
IF: defined(SQLITE_HAS_CODEC) || defined(SQLITE_ENABLE_CEROD)
NAME: soft_heap_limit
FLAG: Result0
NAME: threads
FLAG: Result0
}
# Open the output file
@ -336,15 +371,29 @@ set name {}
set type {}
set if {}
set flags {}
set cols {}
set cols_list {}
set arg 0
proc record_one {} {
global name type if arg allbyname typebyif flags
global name type if arg allbyname typebyif flags cols allcols
global cols_list colUsedBy
if {$name==""} return
set allbyname($name) [list $type $arg $if $flags]
if {$cols!=""} {
if {![info exists allcols($cols)]} {
lappend cols_list $cols
set allcols($cols) [llength $cols_list]
}
set cx $allcols($cols)
lappend colUsedBy($cols) $name
} else {
set cx 0
}
set allbyname($name) [list $type $arg $if $flags $cx]
set name {}
set type {}
set if {}
set flags {}
set cols {}
set arg 0
}
foreach line [split $pragma_def \n] {
@ -358,8 +407,16 @@ foreach line [split $pragma_def \n] {
set type [string toupper $val]
} elseif {$id=="TYPE"} {
set type $val
if {$type=="FLAG"} {
lappend flags Result0 NoColumns
}
if {$type=="HEADER_VALUE"} {
lappend flags Result0
}
} elseif {$id=="ARG"} {
set arg $val
} elseif {$id=="COLS"} {
set cols $val
} elseif {$id=="IF"} {
lappend if $val
} elseif {$id=="FLAG"} {
@ -378,6 +435,7 @@ set allnames [lsort [array names allbyname]]
# omit in default builds (defined(SQLITE_DEBUG) and defined(SQLITE_HAS_CODEC))
# at the end.
#
puts $fd "\n/* The various pragma types */"
set pnum 0
foreach name $allnames {
set type [lindex $allbyname($name) 0]
@ -407,25 +465,58 @@ foreach name $allnames {
# Generate #defines for flags
#
puts $fd "\n/* Property flags associated with various pragma. */"
set fv 1
foreach f [lsort [array names allflags]] {
puts $fd [format {#define PragFlag_%-20s 0x%02x} $f $fv]
puts $fd [format {#define PragFlg_%-10s 0x%02x /* %s */} \
$f $fv $flagMeaning($f)]
set fv [expr {$fv*2}]
}
# Generate the array of column names used by pragmas that act like
# queries.
#
puts $fd "\n/* Names of columns for pragmas that return multi-column result"
puts $fd "** or that return single-column results where the name of the"
puts $fd "** result column is different from the name of the pragma\n*/"
puts $fd "static const char *const pragCName\[\] = {"
set offset 0
foreach cols $cols_list {
set cols_offset($allcols($cols)) $offset
set ub " /* Used by: $colUsedBy($cols) */"
foreach c $cols {
puts $fd [format " /* %3d */ %-14s%s" $offset \"$c\", $ub]
set ub ""
incr offset
}
}
puts $fd "\175;"
# Generate the lookup table
#
puts $fd "static const struct sPragmaNames \173"
puts $fd " const char *const zName; /* Name of pragma */"
puts $fd " u8 ePragTyp; /* PragTyp_XXX value */"
puts $fd " u8 mPragFlag; /* Zero or more PragFlag_XXX values */"
puts $fd " u32 iArg; /* Extra argument */"
puts $fd "\175 aPragmaNames\[\] = \173"
puts $fd "\n/* Definitions of all built-in pragmas */"
puts $fd "typedef struct PragmaName \173"
puts $fd " const char *const zName; /* Name of pragma */"
puts $fd " u8 ePragTyp; /* PragTyp_XXX value */"
puts $fd " u8 mPragFlg; /* Zero or more PragFlg_XXX values */"
puts $fd { u8 iPragCName; /* Start of column names in pragCName[] */}
puts $fd " u8 nPragCName; \
/* Num of col names. 0 means use pragma name */"
puts $fd " u32 iArg; /* Extra argument */"
puts $fd "\175 PragmaName;"
puts $fd "static const PragmaName aPragmaName\[\] = \173"
set current_if {}
set spacer [format { %26s } {}]
foreach name $allnames {
foreach {type arg if flag} $allbyname($name) break
foreach {type arg if flag cx} $allbyname($name) break
if {$cx==0} {
set cy 0
set nx 0
} else {
set cy $cols_offset($cx)
set nx [llength [lindex $cols_list [expr {$cx-1}]]]
}
if {$if!=$current_if} {
if {$current_if!=""} {
foreach this_if $current_if {
@ -443,12 +534,13 @@ foreach name $allnames {
if {$flag==""} {
set flagx "0"
} else {
set flagx PragFlag_[join $flag {|PragFlag_}]
set flagx PragFlg_[join $flag {|PragFlg_}]
}
puts $fd " \173 /* zName: */ \"$name\","
puts $fd " /* ePragTyp: */ PragTyp_$type,"
puts $fd " /* ePragFlag: */ $flagx,"
puts $fd " /* iArg: */ $arg \175,"
puts $fd " \173/* zName: */ \"$name\","
puts $fd " /* ePragTyp: */ PragTyp_$type,"
puts $fd " /* ePragFlg: */ $flagx,"
puts $fd " /* ColNames: */ $cy, $nx,"
puts $fd " /* iArg: */ $arg \175,"
}
if {$current_if!=""} {
foreach this_if $current_if {