]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Pull all the latest trunk changes over into the apple-osx branch.
authordrh <drh@noemail.net>
Tue, 3 Jan 2012 21:54:09 +0000 (21:54 +0000)
committerdrh <drh@noemail.net>
Tue, 3 Jan 2012 21:54:09 +0000 (21:54 +0000)
FossilOrigin-Name: 8a048423f0e409d2332558cb5148e5a1d251ae30

25 files changed:
1  2 
ext/rtree/rtree.c
manifest
manifest.uuid
src/btree.c
src/main.c
src/mem1.c
src/os.c
src/os_unix.c
src/os_win.c
src/pager.c
src/select.c
src/sqlite.h.in
src/sqliteInt.h
src/test1.c
src/vdbe.c
src/vdbeapi.c
src/vdbeaux.c
src/vdbetrace.c
src/wal.c
src/wal.h
test/incrvacuum2.test
test/multiplex.test
test/pager1.test
test/superlock.test
test/wal.test

Simple merge
diff --cc manifest
index 7d4041411ee0ffdc272a2803a375889a70ab4f2d,10533ad79f3a8f8f13273a8dde9cf20578879674..fc15070f1a9fafac23e7f6e7e858f7a2f98bac78
+++ b/manifest
@@@ -1,9 -1,9 +1,9 @@@
- C Merge\sthe\slatest\strunk\schanges\sinto\sthe\sapple-osx\sbranch.
- D 2011-12-08T21:08:53.430
 -C Make\ssure\sfilenames\spassed\sinto\ssqlite3OsOpen()\salways\shave\sthe\sextra\nzero-terminators\sneeded\sby\ssqlite3_uri_parameter().
 -D 2012-01-03T14:50:45.695
++C Pull\sall\sthe\slatest\strunk\schanges\sover\sinto\sthe\sapple-osx\sbranch.
++D 2012-01-03T21:54:09.582
  F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 -F Makefile.in 5b4a3e12a850b021547e43daf886b25133b44c07
 +F Makefile.in 44bbe5a7c5c58b28d5dc310cfedcf8f35b4b39e5
  F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
- F Makefile.msc 3bd3641a345d488a9601c0cc7f9d35aeede5d12b
+ F Makefile.msc dcad80fa69f17d46fe6778ba873fc108ca16298d
  F Makefile.vxworks 1deb39c8bb047296c30161ffa10c1b5423e632f9
  F README cd04a36fbc7ea56932a4052d7d0b7f09f27c33d6
  F VERSION af03cd6400f9d71d38bdb7a9d66a1aefdc2f3e0d
@@@ -85,7 -85,7 +85,7 @@@ F ext/icu/README.txt bf8461d8cdc6b8f514
  F ext/icu/icu.c eb9ae1d79046bd7871aa97ee6da51eb770134b5a
  F ext/icu/sqliteicu.h 728867a802baa5a96de7495e9689a8e01715ef37
  F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
- F ext/rtree/rtree.c f1ce540925f2e25693ba396ed5935fcee95eb405
 -F ext/rtree/rtree.c b92ab2e91e35c4964644647322813419c65fe1ce
++F ext/rtree/rtree.c 418543c384d477cb9b6aaa0d427deaf386c645b6
  F ext/rtree/rtree.h 834dbcb82dc85b2481cde6a07cdadfddc99e9b9e
  F ext/rtree/rtree1.test 28e1b8da4da98093ce3210187434dd760a8d89d8
  F ext/rtree/rtree2.test acbb3a4ce0f4fbc2c304d2b4b784cfa161856bba
@@@ -122,38 -119,38 +122,38 @@@ F sqlite.pc.in 42b7bf0d02e08b9e77734a47
  F sqlite3.1 6be1ad09113570e1fc8dcaff84c9b0b337db5ffc
  F sqlite3.pc.in ae6f59a76e862f5c561eb32a380228a02afc3cad
  F src/alter.c ac80a0f31189f8b4a524ebf661e47e84536ee7f5
- F src/analyze.c 5a1db16a651ce6310c8b046b2cbb736e030e14b9
+ F src/analyze.c f32ff304da413851eefa562b04e61ff6cb88248b
  F src/attach.c 12c6957996908edc31c96d7c68d4942c2474405f
  F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34
- F src/backup.c 4368158da74d4711888e03264105c5c527d76caf
+ F src/backup.c 80d713109d295cc3a674f55cfe6446afb9b024ad
  F src/bitvec.c af50f1c8c0ff54d6bdb7a80e2fceca5a93670bef
  F src/btmutex.c 976f45a12e37293e32cae0281b15a21d48a8aaa7
- F src/btree.c 46eae4a082c1515ac50dd14542b7e7ae7cc7916a
 -F src/btree.c 8f683b1fcfd9ac92efa781c9c56c537e080a7117
++F src/btree.c 7cf38b094359e7ac7ec554a23f22d0afa3cbaceb
  F src/btree.h f5d775cd6cfc7ac32a2535b70e8d2af48ef5f2ce
- F src/btreeInt.h ea863a819224d3e6845ad1e39954d41558b8cd8b
+ F src/btreeInt.h 6e57bacaa4feb7dd56719678133e63a7c289c6e7
  F src/build.c 8915bb6d72ead998f94c2756ea8d143c77709b70
  F src/callback.c 0425c6320730e6d3981acfb9202c1bed9016ad1a
  F src/complete.c dc1d136c0feee03c2f7550bafc0d29075e36deac
  F src/ctime.c a9c26822515f81ec21588cbb482ca6724be02e33
  F src/date.c 067a81c9942c497aafd2c260e13add8a7d0c7dd4
  F src/delete.c 51d32f0a9c880663e54ce309f52e40c325d5e112
- F src/expr.c 9ac5831769dddee6a55b07cdd439b21929bbe4e7
+ F src/expr.c 537591e95eac74af783e4eb033954fb218cf398e
  F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
  F src/fkey.c 657212460bf5cfd3ae607d12ea62092844c227b5
 -F src/func.c 6261ce00aad9c63cd5b4219249b05683979060e9
 +F src/func.c 8c5a50e75fcc974e10aad0765d215a10038abacb
- F src/global.c 107ccaacb4b30895cf3a3a39decf417c804acfa1
+ F src/global.c 4cfdca5cb0edd33c4d021baec4ede958cb2c793b
  F src/hash.c 458488dcc159c301b8e7686280ab209f1fb915af
  F src/hash.h 2894c932d84d9f892d4b4023a75e501f83050970
  F src/hwtime.h d32741c8f4df852c7d959236615444e2b1063b08
- F src/insert.c 8f283d6734dd837ed7531b26d7622fda70874390
+ F src/insert.c ea820fe9af748075b3b6827fb6f23f25079bf1f7
  F src/journal.c 552839e54d1bf76fb8f7abe51868b66acacf6a0e
 -F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f
 +F src/legacy.c 015826a958f690302d27e096a68d50b3657e4201
  F src/lempar.c 0ee69fca0be54cd93939df98d2aca4ca46f44416
- F src/loadext.c d0d2022a5a07274d408820b978b9e549189d314f
- F src/main.c 4e8b24368b7df83e225a9bed2bd2f967cf0c57be
- F src/malloc.c 591aedb20ae40813f1045f2ef253438a334775d9
+ F src/loadext.c f20382fbaeec832438a1ba7797bee3d3c8a6d51d
 -F src/main.c e60abee4a7ca3da31b67745ccf02b8d29f138614
++F src/main.c 69330c9f9e815bb0313ea0661aeedf3cbeda4651
+ F src/malloc.c 15afac5e59b6584efe072e9933aefb4230e74f97
  F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
- F src/mem1.c c390a8fce10912a770ebe6fa031f5f463649e7ae
 -F src/mem1.c 7998e7003a3047e323c849a26dda004debc04d03
++F src/mem1.c ed2df8b1679cfcb60331fe5d76d609915cda6167
  F src/mem2.c e307323e86b5da1853d7111b68fd6b84ad6f09cf
  F src/mem3.c 61c9d47b792908c532ca3a62b999cf21795c6534
  F src/mem5.c c2c63b7067570b00bf33d751c39af24182316f7f
@@@ -165,35 -162,34 +165,35 @@@ F src/mutex_os2.c 882d735098c07c8c6a547
  F src/mutex_unix.c b4f4e923bb8de93ec3f251fadb50855f23df9579
  F src/mutex_w32.c 5e54f3ba275bcb5d00248b8c23107df2e2f73e33
  F src/notify.c 976dd0f6171d4588e89e874fcc765e92914b6d30
- F src/os.c 499fc9d390b2b2294117ec2a32740ce49158e1d5
- F src/os.h 5830d32c4dab94fa0373404a139ada670e800731
 -F src/os.c 519bdf7c608c4848024e1d87934f9305454145f4
++F src/os.c 74c5ae9955879b0f41b373a26b4f3740ddd767f3
+ F src/os.h c7d888830f168a9b681b3aec30789f4ad2445c17
  F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
  F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440
- F src/os_unix.c fa4ef25eb05312d1f9d3ef1b497004fc3a3c5271
- F src/os_win.c 4c546bde0de55f2b5e59fbf250b9e4094fc28892
- F src/pager.c 9d31fa7d47b7b534503e08110d0b2bded03143d7
 -F src/os_unix.c aff2f5e6632065dec09a53af1daf1e75fe12dce5
 -F src/os_win.c f1057db64d481dffb15776147b06b15f4f8d7b87
 -F src/pager.c 5b89ab92631a8fc488b87cc663ab064802173fec
++F src/os_unix.c fc3159578369b57acbc838fd0e5948c044d02b89
++F src/os_win.c d4eb85610ea0fb02462f9054ba4636daedbbdbb4
++F src/pager.c f87fa939f8435341256bea1711fd9dc1b32daa0e
  F src/pager.h 5cd760857707529b403837d813d86b68938d6183
- F src/parse.y d02cc7bdb9ba11fb7aa212f55f99e59e4ee55439
- F src/pcache.c 1fdd77978c1525d1ca4b9ef48eb80abca710cb4c
+ F src/parse.y fabb2e7047417d840e6fdb3ef0988a86849a08ba
+ F src/pcache.c f8043b433a57aba85384a531e3937a804432a346
  F src/pcache.h b1d8775a9bddf44e65edb0d20bfc57a4982f840f
- F src/pcache1.c 9d735349ac87ef08076c6b1230f04cd83b15c6da
+ F src/pcache1.c e1aaa3bc9bbfd8b0bc391ca731f5f8185467375d
 -F src/pragma.c dd66f21fafe7be40e1a48ad4195764cc191cf583
 -F src/prepare.c ec4989f7f480544bdc4192fe663470d2a2d7d61e
 +F src/pragma.c dae8d30795e6c3d1a5597108ed1fa00275ce339a
 +F src/prepare.c 4450a714a7ebb4b0ce4159087338e1159d083885
- F src/printf.c 03104cbff6959ff45df69dc9060ba6212f60a869
+ F src/printf.c 7ffb4ebb8b341f67e049695ba031da717b3d2699
  F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50
- F src/resolve.c 365ab1c870e38596d6869e76fb544fe6e4ffc809
+ F src/resolve.c 3d3e80a98f203ac6b9329e9621e29eda85ddfd40
  F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697
- F src/select.c 2849781d42e952a483bd029acfde69c6733fce06
- F src/shell.c 29812a900a780eb0f835c4bc65e216272689def8
- F src/sqlite.h.in 1f4434d5d28d8df0868e3dfdeb5c1a4d68f212c3
 -F src/select.c a1d075db66a0ea42807353501b62997969e5be79
++F src/select.c 3f4cdc3c4d21376ac23ae3195390cfe71a0cedcd
+ F src/shell.c aa4183d4a5243d8110b1d3d77faa4aea7e9c9c2d
 -F src/sqlite.h.in 80115fdec17acf32f93adbf950960b889de98b79
++F src/sqlite.h.in 578de223daa37be1810079ec7ccdd103644f25e5
 +F src/sqlite3_private.h e3b586e0aa329075d99be7198df9bc80c5b19e2d
  F src/sqlite3ext.h 6904f4aadf976f95241311fbffb00823075d9477
- F src/sqliteInt.h 78c821539e360e9c5b6b06526ade1e3069f90388
 -F src/sqliteInt.h b8fdd9c39c8d7f5c794f4ea917293d9c75b9aff2
++F src/sqliteInt.h 738b994ee7401b1d1353d7de6a15f3dc50d79a09
  F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
  F src/status.c 4568e72dfd36b6a5911f93457364deb072e0b03a
  F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
- F src/tclsqlite.c de581e2e71f5e7f98366156afad83b4742ac6fe0
- F src/test1.c a6fb512db6f57f5727d65455e415232d7784a89f
+ F src/tclsqlite.c bd86070f52ae3f77a2e6b3b065ff03adb9140bfa
 -F src/test1.c 1b1e514e85ffe7152b02cba38bd0a1ce8cd56113
++F src/test1.c c159dbfa54d31ae591f12183dcbbd2e0ccffb705
  F src/test2.c 80d323d11e909cf0eb1b6fbb4ac22276483bcf31
  F src/test3.c 124ff9735fb6bb7d41de180d6bac90e7b1509432
  F src/test4.c d1e5a5e904d4b444cf572391fdcb017638e36ff7
@@@ -222,41 -218,42 +222,42 @@@ F src/test_multiplex.c 2bf2eb36c9eff73c
  F src/test_multiplex.h e99c571bc4968b7a9363b661481f3934bfead61d
  F src/test_mutex.c a6bd7b9cf6e19d989e31392b06ac8d189f0d573e
  F src/test_onefile.c 40cf9e212a377a6511469384a64b01e6e34b2eec
- F src/test_osinst.c 62b0b8ef21ce754cc94e17bb42377ed8795dba32
+ F src/test_osinst.c 6abf0a37ce831120c4ef1b913afdd813e7ac1a73
  F src/test_pcache.c a5cd24730cb43c5b18629043314548c9169abb00
- F src/test_quota.c a391c866217e92986c6f523f05b08aa6956c8419
+ F src/test_quota.c 1a5874e3ee9074426f43b37e8d7404948065b585
+ F src/test_quota.h 9ffa1d3ad6d0a6a24e8670ea64b909c717ec3358
 -F src/test_rtree.c 6d06306e29946dc36f528a3a2cdc3add794656f1
 +F src/test_rtree.c a2eebb68c0f1463918cdfbe603cb2e869c551038
  F src/test_schema.c 8c06ef9ddb240c7a0fcd31bc221a6a2aade58bf0
  F src/test_server.c 2f99eb2837dfa06a4aacf24af24c6affdf66a84f
- F src/test_stat.c 69de4361c7a69fc1136d31ab7144408cd00805c7
+ F src/test_stat.c 80271ad7d776a79babe0e025bb3a1bfcd3a3cfb1
 -F src/test_superlock.c 2b97936ca127d13962c3605dbc9a4ef269c424cd
 +F src/test_superlock.c 12e2bc484c6c2ba837327d37f2e6a6fd9d1464f8
  F src/test_syscall.c a992d8c80ea91fbf21fb2dd570db40e77dd7e6ae
  F src/test_tclvar.c f4dc67d5f780707210d6bb0eb6016a431c04c7fa
  F src/test_thread.c 35022393dd54d147b998b6b7f7e945b01114d666
- F src/test_vfs.c 27b7d9de40630f603b9e2cf9ef2a7c81d31c4515
- F src/test_vfstrace.c 0b884e06094a746da729119a2cabdc7aa790063d
+ F src/test_vfs.c 07157a0bbfe161cb5e32cad2079abd26cd611c4b
+ F src/test_vfstrace.c 065c7270a614254b2c68fbc7ba8d1fb1d5cbc823
  F src/test_wholenumber.c 6129adfbe7c7444f2e60cc785927f3aa74e12290
  F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9
- F src/tokenize.c c819d9f72168a035d545a5bdafe9b085b20df705
- F src/trigger.c 1cfb80e2290ef66ea89cb4e821caae65a02c0d56
- F src/update.c 25e046a8f69d5e557aabde2000487b8545509d8d
+ F src/tokenize.c 1e86210d3976717a19238ea7b047fac481fe8c12
+ F src/trigger.c ee7e178fb9188f44b532cebd449a7c1df90fb684
+ F src/update.c d3076782c887c10e882996550345da9c4c9f9dea
  F src/utf.c 890c67dcfcc7a74623c95baac7535aadfe265e84
- F src/util.c 01238e2b0f24a14779181dbf991fe02620a80e31
+ F src/util.c ad06374bc92b98071f221f00d553daea514f2b60
  F src/vacuum.c 0c0ba2242355c6048d65e2b333abe0f7c06348fa
- F src/vdbe.c 6f7669fbd331dc01963d19850684f5252408fc98
- F src/vdbe.h f0725ee997db869ecae5bb70a71612aabeca7755
- F src/vdbeInt.h 9498fc98a2c9e349a4ef13455ff5a3e898f40176
- F src/vdbeapi.c f3e684cb2f359c8e609f048af3c14e0cf33511b5
- F src/vdbeaux.c ab25ef4df8dc4dc3f5fda6593ceb1c5ff9216877
 -F src/vdbe.c 50f0cf69eb64e11185042d15062bec8a1373a8a2
++F src/vdbe.c 9a5ea29c68fdc4da6a83bb4d64be982840d884be
+ F src/vdbe.h 18f581cac1f4339ec3299f3e0cc6e11aec654cdb
+ F src/vdbeInt.h 48c158b2fceca9682d1577e61c62da3c58cf0748
 -F src/vdbeapi.c 3662b6a468a2a4605a15dfab313baa6dff81ad91
 -F src/vdbeaux.c 01fe6e35e5923c401a912b4662f0909d62453a1d
++F src/vdbeapi.c bf1f632719ee596d43ccf6c2ed68ff8911f5b376
++F src/vdbeaux.c 9dd6bfd0ad931c4a9938aacf5db874bee21d9b1e
  F src/vdbeblob.c 32f2a4899d67f69634ea4dd93e3f651936d732cb
- F src/vdbemem.c 2fc78b3e0fabcc1eaa23cd79dd2e30e6dcfe1e56
+ F src/vdbemem.c 5e8c0831bd0a270ff81af385e891ff381dec900f
  F src/vdbesort.c 468d43c057063e54da4f1988b38b4f46d60e7790
- F src/vdbetrace.c 4b92fe7355f682368203d29b2be7125cbab85e79
 -F src/vdbetrace.c d6e50e04e1ec498150e519058f617d91b8f5c843
++F src/vdbetrace.c 2405f68d14c49d2e0a798d71e35d62b8569bfb65
  F src/vtab.c e9318d88feac85be8e27ee783ac8f5397933fc8a
- F src/wal.c 84d32c7a56f4ec44658ddb3ffcd1eb451c16af5c
- F src/wal.h e75d87752bd5df3dc4152ee2cb3b0dcd0b309e5e
 -F src/wal.c 932f09509d70fc115a7cc3d494d6fdcb825099ed
 -F src/wal.h eaa00b9a403ddda2b56d01b7afc19ef600f9363f
++F src/wal.c 59d2f71c6ffaea3b9c5d739090c4b1213b2986f0
++F src/wal.h 313ef1ffc435960563f655fec0d6e92f736946f5
  F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f
- F src/where.c f73752ca85c0ed221753fda98aeaf6b9d4616e0e
+ F src/where.c af623942514571895818b9b7ae11db95ae3b3d88
  F test/8_3_names.test 631ea964a3edb091cf73c3b540f6bcfdb36ce823
  F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
  F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87
@@@ -300,8 -297,9 +301,9 @@@ F test/badutf.test d5360fc31f643d37a973
  F test/badutf2.test f5bc7f2d280670ecd79b9cf4f0f1760c607fe51f
  F test/between.test 16b1776c6323faadb097a52d673e8e3d8be7d070
  F test/bigfile.test a8ec8073a20207456dab01a29ad9cde42b0dd103
+ F test/bigfile2.test f8e83eca9abef60692a34255a2ebcb96aff897fc
  F test/bigrow.test f0aeb7573dcb8caaafea76454be3ade29b7fc747
 -F test/bind.test 3c7b320969000c441a70952b0b15938fbb66237c
 +F test/bind.test 30af0fc61bc3836034215cdbdeca46113ca1b4a1
  F test/bindxfer.test efecd12c580c14df5f4ad3b3e83c667744a4f7e0
  F test/bitvec.test 75894a880520164d73b1305c1c3f96882615e142
  F test/blob.test e7ac6c7d3a985cc4678c64f325292529a69ae252
@@@ -517,7 -515,7 +519,7 @@@ F test/incrblob3.test 086482e7937202be9
  F test/incrblob_err.test d2562d2771ebffd4b3af89ef64c140dd44371597
  F test/incrblobfault.test 917c0292224c64a56ef7215fd633a3a82f805be0
  F test/incrvacuum.test d2a6ddf5e429720b5fe502766af747915ccf6c32
- F test/incrvacuum2.test 7072d6adb03bb452b055cdc288d88b1432aed5ef
 -F test/incrvacuum2.test 379eeb8740b0ef60c372c439ad4cbea20b34bb9b
++F test/incrvacuum2.test c776f80c2b20d4088f9ff3fd0177ff76af9f51b7
  F test/incrvacuum_ioerr.test 22f208d01c528403240e05beecc41dc98ed01637
  F test/index.test b5429732b3b983fa810e3ac867d7ca85dae35097
  F test/index2.test ee83c6b5e3173a3d7137140d945d9a5d4fdfb9d6
@@@ -547,8 -545,8 +549,8 @@@ F test/join4.test 1a352e4e267114444c292
  F test/join5.test 86675fc2919269aa923c84dd00ee4249b97990fe
  F test/join6.test bf82cf3f979e9eade83ad0d056a66c5ed71d1901
  F test/journal1.test 8b71ef1ed5798bdc0e6eb616d8694e2c2c188d4d
- F test/journal2.test 29937bdbb253bbfd92057610120bdc0aa7e84a0a
+ F test/journal2.test ae06f566c28552c313ded3fee79a6c69e6d049b1
 -F test/journal3.test 6fd28532c88b447db844186bc190523108b6dbb4
 +F test/journal3.test cd6dbabe2c3aa680e1541cdac74de9c73686feec
  F test/jrnlmode.test 9ee3a78f53d52cca737db69293d15dc41c0cbd36
  F test/jrnlmode2.test 81610545a4e6ed239ea8fa661891893385e23a1d
  F test/jrnlmode3.test 556b447a05be0e0963f4311e95ab1632b11c9eaa
@@@ -610,7 -607,9 +612,9 @@@ F test/misc5.test 528468b26d03303b1f047
  F test/misc6.test 953cc693924d88e6117aeba16f46f0bf5abede91
  F test/misc7.test eafaa41b9133d7a2ded4641bbe5f340731d35a52
  F test/misuse.test ba4fb5d1a6101d1c171ea38b3c613d0661c83054
- F test/multiplex.test bc145f28934ba677e41c618626cf6499488a59e3
 -F test/multiplex.test 8bc3c71f73fe833bc8a659d454d320044a33b5da
++F test/multiplex.test 3df42f5e7d00caa32551b35f58a78d0645ea15fd
+ F test/multiplex2.test 580ca5817c7edbe4cc68fa150609c9473393003a
+ F test/multiplex3.test 15903c343f1eaa4b00998b7ceacfc4987e4ccfe9
  F test/mutex1.test 78b2b9bb320e51d156c4efdb71b99b051e7a4b41
  F test/mutex2.test bfeaeac2e73095b2ac32285d2756e3a65e681660
  F test/nan.test e9648b9d007c7045242af35e11a984d4b169443a
@@@ -621,18 -620,18 +625,18 @@@ F test/notnull.test cc7c78340328e6112a1
  F test/null.test a8b09b8ed87852742343b33441a9240022108993
  F test/openv2.test 0d3040974bf402e19b7df4b783e447289d7ab394
  F test/oserror.test 50417780d0e0d7cd23cf12a8277bb44024765df3
- F test/pager1.test 30058ab9a507bee4ea95a6279e3fa1fac6758679
 -F test/pager1.test 9e9f5f1c6d4df4831dbff213b1262ef94bf72118
++F test/pager1.test 0b5d05d5fc747e10eb2b216b3236b617951fa9cb
  F test/pager2.test 745b911dde3d1f24ae0870bd433dfa83d7c658c1
  F test/pager3.test 3856d9c80839be0668efee1b74811b1b7f7fc95f
 -F test/pagerfault.test 452f2cc23e3bfcfa935f4442aec1da4fe1dc0442
 +F test/pagerfault.test a15ef77c8495882d7debb43794e87b6e46174c8a
  F test/pagerfault2.test 1f79ea40d1133b2683a2f811b00f2399f7ec2401
  F test/pagerfault3.test f16e2efcb5fc9996d1356f7cbc44c998318ae1d7
  F test/pageropt.test 9191867ed19a2b3db6c42d1b36b6fbc657cd1ab0
  F test/pagesize.test 1dd51367e752e742f58e861e65ed7390603827a0
  F test/pcache.test 065aa286e722ab24f2e51792c1f093bf60656b16
  F test/pcache2.test a83efe2dec0d392f814bfc998def1d1833942025
- F test/permutations.test 522823b47238cb1754198f80817fe9f9158ede55
+ F test/permutations.test 8db6d3b72e6ce423cfb94d87926e5edcb4b0078f
 -F test/pragma.test 7fa35e53085812dac94c2bfcbb02c2a4ad35df5e
 +F test/pragma.test 76d644288007c7eb74650ab6e261e6f78e48cb0f
  F test/pragma2.test 3a55f82b954242c642f8342b17dffc8b47472947
  F test/printf.test ec9870c4dce8686a37818e0bf1aba6e6a1863552
  F test/progress.test 5b075c3c790c7b2a61419bc199db87aaf48b8301
@@@ -671,10 -672,10 +677,10 @@@ F test/select7.test dad6f00f0d49728a879
  F test/select8.test 391de11bdd52339c30580dabbbbe97e3e9a3c79d
  F test/select9.test 74c0fb2c6eecb0219cbed0cbe3df136f8fbf9343
  F test/selectA.test 06d1032fa9009314c95394f2ca2e60d9f7ae8532
- F test/selectB.test 0d072c5846071b569766e6cd7f923f646a8b2bfa
+ F test/selectB.test 954e4e49cf1f896d61794e440669e03a27ceea25
  F test/selectC.test f9bf1bc4581b5b8158caa6e4e4f682acb379fb25
  F test/server1.test 46803bd3fe8b99b30dbc5ff38ffc756f5c13a118
 -F test/shared.test 34945a516532b11182c3eb26e31247eee3c9ae48
 +F test/shared.test 9d9b7085f877a8fd4bf3b353f53e52352edbf3f5
  F test/shared2.test 8f71d4eb4d5261280de92284df74172545c852cc
  F test/shared3.test ebf77f023f4bdaa8f74f65822b559e86ce5c6257
  F test/shared4.test 72d90821e8d2fc918a08f16d32880868d8ee8e9d
@@@ -703,9 -704,9 +709,9 @@@ F test/subquery.test b524f57c9574b2c034
  F test/subquery2.test edcad5c118f0531c2e21bf16a09bbb105252d4cd
  F test/subselect.test d24fd8757daf97dafd2e889c73ea4c4272dcf4e4
  F test/substr.test 18f57c4ca8a598805c4d64e304c418734d843c1a
- F test/superlock.test 942b75cfe0f939086715a5dc74fa4ba57a5e8d5e
 -F test/superlock.test 1cde669f68d2dd37d6c9bd35eee1d95491ae3fc2
++F test/superlock.test d69dcf1cd52c52c38dbb2df432233e1ecb62fd09
  F test/sync.test a34cd43e98b7fb84eabbf38f7ed8f7349b3f3d85
- F test/syscall.test 2a922050dbee032f587249b070fb42692f5e1e22
+ F test/syscall.test 265cda616f56a297406728ee1e74c9b4a93aa6dd
  F test/sysfault.test c79441d88d23696fbec7b147dba98d42a04f523f
  F test/table.test a59d985ca366e39b17b175f387f9d5db5a18d4e2
  F test/tableapi.test 2674633fa95d80da917571ebdd759a14d9819126
@@@ -900,28 -902,29 +907,29 @@@ F test/vtabF.test fd5ad376f5a34fe0891df
  F test/vtab_alter.test 9e374885248f69e251bdaacf480b04a197f125e5
  F test/vtab_err.test 0d4d8eb4def1d053ac7c5050df3024fd47a3fbd8
  F test/vtab_shared.test 0eff9ce4f19facbe0a3e693f6c14b80711a4222d
- F test/wal.test 0f5438398f60807d129134aaac62f6e7ad99f251
- F test/wal2.test cc834aa5e4361b472d115f7c8148e4d168e4db8c
- F test/wal3.test b9b6477ef354fea2066083e5badbc08bba45f5b0
 -F test/wal.test edefe316b4125d7f68004ea53c5e73c398d436cc
++F test/wal.test ed0d04a508e4e4899c688c56028f453c75f2166d
+ F test/wal2.test f11883dd3cb7f647c5d2acfd7b5c6d4ba5770cc9
+ F test/wal3.test 6504bbf348b2d6dfade64a064f1050fd617e8706
 -F test/wal4.test 4744e155cd6299c6bd99d3eab1c82f77db9cdb3c
 +F test/wal4.test 5755887f321baa4c55de0b91066fa7d0cafcac9d
- F test/wal5.test 3ef2b561d0e218b73b86f2223ec3d8f09cadc3ca
+ F test/wal5.test f58ed4b8b542f71c7441da12fbd769d99b362437
 -F test/wal6.test 2e3bc767d9c2ce35c47106148d43fcbd072a93b3
 +F test/wal6.test c561d1e44c89f9cb458a7b03003ed4baac08ba07
  F test/wal7.test 2ae8f427d240099cc4b2dfef63cff44e2a68a1bd
 -F test/wal_common.tcl a98f17fba96206122eff624db0ab13ec377be4fe
 -F test/walbak.test b9f68e39646375c2b877be906babcc15d38b4877
 -F test/walbig.test 0ab8a430ef420a3114f7092e0f30fc9585ffa155
 -F test/walcksum.test f5447800a157c9e2234fbb8e80243f0813941bde
 -F test/walcrash.test 4fcb661faf71db91214156d52d43ee327f52bde1
 -F test/walcrash2.test 019d60b89d96c1937adb2b30b850ac7e86e5a142
 +F test/wal_common.tcl 15f152fd55703975878741beca6cfa4209d5b3b3
 +F test/walbak.test b30cbbb2996947c96a2e562020dff61013a17a96
 +F test/walbig.test 44141082891fb91bcfa793fb6411605ac42830eb
 +F test/walcksum.test 3dff8817d31a4207d1ad31e7da06073a34e7fe1c
 +F test/walcrash.test e2e8de53cadda0e1c5ceb86ff762b85aed2771cc
 +F test/walcrash2.test c032d0040374ae28b41f99fc0cc290b4e2e34f17
+ F test/walcrash3.test 595e44c6197f0d0aa509fc135be2fd0209d11a2c
 -F test/walfault.test efb0d5724893133e71b8d9d90abdb781845a6bb0
 -F test/walhook.test ed00a40ba7255da22d6b66433ab61fab16a63483
 -F test/walmode.test 4022fe03ae6e830583672caa101f046438a0473c
 +F test/walfault.test c54e6a304d631565a12998fd1d4665ded7a18ee2
 +F test/walhook.test c934ac5219fee2b4e7653d291db9107b8dc73bba
 +F test/walmode.test 9308ffc25555a1c4eaa44a863792240406637496
  F test/walnoshm.test 84ca10c544632a756467336b7c3b864d493ee496
- F test/walpersist.test 710b1b6cf6f8333e984f437724d1fa9e0511c5aa
+ F test/walpersist.test 8c6b7e3ec1ba91b5e4dc4e0921d6d3f87cd356a6
  F test/walro.test e6bb27762c9f22601cbb8bff6e0acfd124e74b63
 -F test/walshared.test 6dda2293880c300baf5d791c307f653094585761
 -F test/walslow.test e7be6d9888f83aa5d3d3c7c08aa9b5c28b93609a
 -F test/walthread.test a2ed5270eb695284d4ad27d252517bdc3317ee2a
 +F test/walshared.test 0befc811dcf0b287efae21612304d15576e35417
 +F test/walslow.test 3c2475d7672511380d33cef1924a065d2ad62ff0
 +F test/walthread.test 3decc7e72594e0270dc1a1cc0984d6db7165b4cc
  F test/where.test de337a3fe0a459ec7c93db16a519657a90552330
  F test/where2.test 43d4becaf5a5df854e6c21d624a1cb84c6904554
  F test/where3.test 667e75642102c97a00bf9b23d3cb267db321d006
@@@ -982,7 -986,7 +991,7 @@@ F tool/tostr.awk e75472c2f98dd76e06b8c9
  F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
  F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a
  F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
- P dacdec78d010922b6357f5319108289d087b6028 0d955c20c02da29582b5cd8df2b7124fb9d12ebb
- R 7d02ae07e22c3d68edcb279ac80c5560
 -P 03d8362cd2cadab8e1cc5b18a3194152f2bd0a84
 -R bab430cac57fc8357d76990e6c780f64
++P 59e0d4f3d9af81d0c920812a6583228faa300cd6 d73e93cfdc9441ade77b796dcdcf6eeb753cb398
++R d791304ece26609bd6a5cb40baa3c9e2
  U drh
- Z c635329dcd75987bcf764cde7adde70c
 -Z 242be7d816ac09f954d1b623be157dd8
++Z 4de01c9ac1d1d7db944c5486add73dca
diff --cc manifest.uuid
index 2824edbc76801cfb842d630a9d3be4a3fe3c9147,9f17d9d5afb61e43bdb43a3bdd1f36a3ea2c8fd4..1a5c1692c8bebe707fa46062643ac33c130f2cde
@@@ -1,1 -1,1 +1,1 @@@
- 59e0d4f3d9af81d0c920812a6583228faa300cd6
 -d73e93cfdc9441ade77b796dcdcf6eeb753cb398
++8a048423f0e409d2332558cb5148e5a1d251ae30
diff --cc src/btree.c
Simple merge
diff --cc src/main.c
Simple merge
diff --cc src/mem1.c
index a845b292f7243aca01b4572ce3157ca03120de9d,bf84ce090981702e27eeada83fc45f705adadaf3..28ac4afb52143972a4df9f5e0c51fb4405858166
  */
  #ifdef SQLITE_SYSTEM_MALLOC
  
 -#if defined(__APPLE__)
 +#if (!defined(__APPLE__))
 +
+ /*
+ ** Windows systems have malloc_usable_size() but it is called _msize()
+ */
+ #if !defined(HAVE_MALLOC_USABLE_SIZE) && SQLITE_OS_WIN
+ # define HAVE_MALLOC_USABLE_SIZE 1
+ # define malloc_usable_size _msize
+ #endif
 +#define SQLITE_MALLOC(x) malloc(x)
 +#define SQLITE_FREE(x) free(x)
 +#define SQLITE_REALLOC(x,y) realloc((x),(y))
 +
 +#else
 +
  
 -/*
 -** Use the zone allocator available on apple products
 -*/
  #include <sys/sysctl.h>
  #include <malloc/malloc.h>
  #include <libkern/OSAtomic.h>
diff --cc src/os.c
index dc0835da3b41d7f329f9b4327ff9baf49ce4f67d,c26429bf9a027e4896b4ca7ee1979d4fe7ec69f6..fb19708d007ed851e894665c22eb817113efb48f
+++ b/src/os.c
@@@ -140,9 -140,8 +140,9 @@@ int sqlite3OsOpen
    int *pFlagsOut
  ){
    int rc;
 +  int openFlags;
    DO_OS_MALLOC_TEST(0);
-   /* 0x87f3f is a mask of SQLITE_OPEN_ flags that are valid to be passed
+   /* 0x87f7f is a mask of SQLITE_OPEN_ flags that are valid to be passed
    ** down into the VFS layer.  Some SQLITE_OPEN_ flags (for example,
    ** SQLITE_OPEN_FULLMUTEX or SQLITE_OPEN_SHAREDCACHE) are blocked before
    ** reaching the VFS. */
diff --cc src/os_unix.c
index d0626e752c4b65ac1282cec49529f7974379f3a7,e0a39882e136142f7c00b36c2909d265a17e9b4f..7f9223bef56a89b395afaf9a7991ffae7447dec2
  #include <sys/mman.h>
  #endif
  
  #if SQLITE_ENABLE_LOCKING_STYLE
  # include <sys/ioctl.h>
 +# include <uuid/uuid.h>
 +# if defined(__APPLE__) && ((__MAC_OS_X_VERSION_MIN_REQUIRED > 1050) || \
 +                            (__IPHONE_OS_VERSION_MIN_REQUIRED > 2000))
 +#  define HAVE_GETHOSTUUID 1
 +# endif
  # if OS_VXWORKS
  #  include <semaphore.h>
  #  include <limits.h>
@@@ -2375,14 -2017,10 +2378,14 @@@ static int dotlockUnlock(sqlite3_file *
    rc = osRmdir(zLockFile);
    if( rc<0 && errno==ENOTDIR ) rc = osUnlink(zLockFile);
    if( rc<0 ){
-     int rc = 0;
      int tErrno = errno;
+     rc = 0;
      if( ENOENT != tErrno ){
 +#if OSLOCKING_CHECK_BUSY_IOERR
 +      rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_UNLOCK);
 +#else
        rc = SQLITE_IOERR_UNLOCK;
 +#endif
      }
      if( IS_LOCK_ERROR(rc) ){
        pFile->lastErrno = tErrno;
@@@ -3889,425 -3500,22 +3892,441 @@@ static int fcntlSizeHint(unixFile *pFil
    return SQLITE_OK;
  }
  
 +#if (SQLITE_ENABLE_APPLE_SPI>0) && defined(__APPLE__)
 +#include "sqlite3_private.h"
 +#include <copyfile.h>
 +static int getDbPathForUnixFile(unixFile *pFile, char *dbPath);
 +#endif
 +static int isProxyLockingMode(unixFile *);
 +
 +#if (SQLITE_ENABLE_APPLE_SPI>0) && defined(__APPLE__)
 +static int unixTruncateDatabase(unixFile *pFile, int bFlags) {
 +  sqlite3_file *id = (sqlite3_file *)pFile;
 +  int rc = SQLITE_OK;
 +  void *pLock = NULL;
 +  int flags = 0;
 +  int corruptFileLock = 0;
 +  int isCorrupt = 0;
 +    
 +#if SQLITE_ENABLE_DATA_PROTECTION
 +  flags |= pFile->protFlags;
 +#endif
 +#if SQLITE_ENABLE_LOCKING_STYLE
 +  if( isProxyLockingMode(pFile) ){
 +    flags |= SQLITE_OPEN_AUTOPROXY;
 +  }
 +#endif
 +  
 +  rc = sqlite3demo_superlock(pFile->zPath, 0, flags, 0, 0, &pLock);
 +  if( rc ){
 +    if( rc==SQLITE_CORRUPT || rc==SQLITE_NOTADB ){
 +      isCorrupt = 1;
 +      rc = sqlite3demo_superlock_corrupt(id, SQLITE_LOCK_EXCLUSIVE, &corruptFileLock);
 +    }
 +    if( rc ){
 +      return rc;
 +    }
 +  }
 +  rc = pFile->pMethod->xTruncate(id, ((pFile->fsFlags & SQLITE_FSFLAGS_IS_MSDOS) != 0) ? 1L : 0L);
 +  if( rc==SQLITE_OK ){
 +    unixInvalidateSupportFiles(pFile, 0);
 +  }
 +  pFile->pMethod->xSync(id, SQLITE_SYNC_FULL);
 +
 +
 +  if( isCorrupt ){
 +    sqlite3demo_superunlock_corrupt(id, corruptFileLock);
 +  }else{
 +    sqlite3demo_superunlock(pLock);
 +  }
 +  return rc;
 +}
 +
 +static int unixInvalidateSupportFiles(unixFile *pFile, int skipWAL) {
 +  char jPath[MAXPATHLEN+9];
 +  int zLen = strlcpy(jPath, pFile->zPath, MAXPATHLEN+9);
 +  if( zLen<MAXPATHLEN ){
 +    size_t jLen;
 +    const char extensions[3][9] = { "-wal", "-journal", "-shm" };
 +    int j = (skipWAL ? 1 : 0);
 +    for( ; j<3; j++ ){
 +      
 +      /* Check to see if the shm file is already opened for this pFile */
 +      if( j==2 ){
 +        unixEnterMutex(); /* Because pFile->pInode is shared across threads */
 +        unixShmNode *pShmNode = pFile->pInode->pShmNode;
 +        if( pShmNode && !pShmNode->isReadonly ){
 +          struct stat sStat;
 +          sqlite3_mutex_enter(pShmNode->mutex);
 +          
 +          if( pShmNode->h>=0 && !osFstat(pShmNode->h, &sStat) ){
 +            unsigned long size = (sStat.st_size<4) ? sStat.st_size : 4;
 +            if( size>0 ){
 +              bzero(pShmNode->apRegion[0], size);
 +              sqlite3_mutex_leave(pShmNode->mutex);
 +              unixLeaveMutex();
 +              continue;
 +            }
 +          }
 +          sqlite3_mutex_leave(pShmNode->mutex);
 +        }
 +        unixLeaveMutex();
 +      }
 +      jLen = strlcpy(&jPath[zLen], extensions[j], 9);
 +      if( jLen < 9 ){
 +        int jflags = (j<2) ? O_TRUNC : O_RDWR;
 +        int jfd = open(jPath, jflags);
 +        if( jfd==(-1) ){
 +          if( errno!=ENOENT ){
 +            perror(jPath);
 +          }
 +        } else {
 +          if( j==2 ){
 +            struct stat sStat;
 +            if( !osFstat(jfd, &sStat) ){
 +              unsigned long size = (sStat.st_size<4) ? sStat.st_size : 4;
 +              if( size>0 ){
 +                uint32_t zero = 0;
 +                pwrite(jfd, &zero, (size_t)size, 0);
 +              }
 +            }
 +          }
 +          fsync(jfd);
 +          close(jfd);
 +        }
 +      }
 +    }
 +  }
 +  return SQLITE_OK;
 +}
 +
 +static int unixReplaceDatabase(unixFile *pFile, sqlite3 *srcdb) {
 +  sqlite3_file *id = (sqlite3_file *)pFile;
 +  Btree *pSrcBtree = NULL;
 +  sqlite3_file *src_file = NULL;
 +  unixFile *pSrcFile = NULL;
 +  char srcWalPath[MAXPATHLEN+5];
 +  int srcWalFD = -1;
 +  int rc = SQLITE_OK;
 +  void *pLock = NULL;
 +  int flags = 0;
 +  sqlite3 *srcdb2 = NULL;
 +  copyfile_state_t s;
 +  int corruptSrcFileLock = 0;
 +  int corruptDstFileLock = 0;
 +  int isSrcCorrupt = 0;
 +  int isDstCorrupt = 0;
 +  
 +  if( !sqlite3SafetyCheckOk(srcdb) ){
 +    return SQLITE_MISUSE;
 +  }
 +    
 +#if SQLITE_ENABLE_DATA_PROTECTION
 +  flags |= pFile->protFlags;
 +#endif
 +#if SQLITE_ENABLE_LOCKING_STYLE
 +  if( isProxyLockingMode(pFile) ){
 +    flags |= SQLITE_OPEN_AUTOPROXY;
 +  }
 +#endif
 +  
 +  rc = sqlite3demo_superlock(pFile->zPath, 0, flags, 0, 0, &pLock);
 +  if( rc ){
 +    if( rc==SQLITE_CORRUPT || rc==SQLITE_NOTADB ){
 +      isDstCorrupt = 1;
 +      rc = sqlite3demo_superlock_corrupt(id, SQLITE_LOCK_EXCLUSIVE, &corruptDstFileLock);
 +    }
 +    if( rc ){
 +      return rc;
 +    }
 +  }
 +  /* get the src file descriptor adhering to the db struct access rules 
 +   ** this code is modeled after sqlite3_file_control() in main.c
 +   */ 
 +  sqlite3_mutex_enter(srcdb->mutex);
 +  if( srcdb->nDb>0 ){
 +    pSrcBtree = srcdb->aDb[0].pBt;
 +  }
 +  if( pSrcBtree ){
 +    Pager *pSrcPager;
 +    sqlite3BtreeEnter(pSrcBtree);
 +    pSrcPager = sqlite3BtreePager(pSrcBtree);
 +    assert( pSrcPager!=0 );
 +    src_file = sqlite3PagerFile(pSrcPager);
 +    assert( src_file!=0 );
 +    if( src_file->pMethods ){
 +      int srcFlags = 0;
 +      pSrcFile = (unixFile *)src_file;
 +      /* wal mode db cannot be opened readonly */
 +      if ((pSrcFile->openFlags & O_RDWR) == O_RDWR) {
 +        srcFlags = SQLITE_OPEN_READWRITE;
 +      } else {
 +        srcFlags = SQLITE_OPEN_READONLY;
 +      }
 +#if SQLITE_ENABLE_DATA_PROTECTION
 +      srcFlags |= pSrcFile->protFlags;
 +#endif
 +#if SQLITE_ENABLE_LOCKING_STYLE
 +      if( isProxyLockingMode(pSrcFile) ){
 +        srcFlags |= SQLITE_OPEN_AUTOPROXY;
 +      }
 +#endif
 +      rc = sqlite3_open_v2(pSrcFile->zPath, &srcdb2, srcFlags, 0);
 +      if( rc==SQLITE_OK ){
 +        /* start a deferred transaction and read to establish a read lock */
 +        rc = sqlite3_exec(srcdb2, "BEGIN DEFERRED; PRAGMA schema_version", 0, 0, 0);
 +        if( rc==SQLITE_CORRUPT || rc==SQLITE_NOTADB ){
 +          isSrcCorrupt = 1;
 +          rc = sqlite3demo_superlock_corrupt(src_file, SQLITE_LOCK_SHARED, &corruptSrcFileLock);
 +        }
 +      }
 +    }
 +  }
 +  if( !srcdb2 || pSrcFile==NULL || pSrcFile->h<0){
 +    rc = SQLITE_INTERNAL;
 +  }
 +  if( rc!=SQLITE_OK ){
 +    goto end_replace_database;
 +  }
 +  /* both databases are locked appropriately, copy the src wal journal if 
 +   ** one exists and then the actual database file
 +   */
 +  strlcpy(srcWalPath, pSrcFile->zPath, MAXPATHLEN+5);
 +  strlcat(srcWalPath, "-wal", MAXPATHLEN+5);
 +  srcWalFD = open(srcWalPath, O_RDONLY);
 +  if( !(srcWalFD<0) ){
 +    char dstWalPath[MAXPATHLEN+5];
 +    int dstWalFD = -1;
 +    strlcpy(dstWalPath, pFile->zPath, MAXPATHLEN+5);
 +    strlcat(dstWalPath, "-wal", MAXPATHLEN+5);
 +    dstWalFD = open(dstWalPath, O_RDWR|O_CREAT, SQLITE_DEFAULT_FILE_PERMISSIONS);
 +    if( !(dstWalFD<0) ){
 +      s = copyfile_state_alloc();
 +      lseek(srcWalFD, 0, SEEK_SET);
 +      lseek(dstWalFD, 0, SEEK_SET);
 +      if( fcopyfile(srcWalFD, dstWalFD, s, COPYFILE_ALL) ){
 +        int err=errno;
 +        switch(err) {
 +          case ENOMEM:
 +            rc = SQLITE_NOMEM;
 +            break;
 +          default:
 +            pFile->lastErrno = err;
 +            rc = SQLITE_IOERR;
 +        }
 +      }
 +      copyfile_state_free(s);
 +      close(dstWalFD);
 +    }
 +    close(srcWalFD);
 +  }
 +  if( rc==SQLITE_OK ){
 +    /* before we copy, ensure that the file change counter will be modified */
 +    uint32_t srcChange = 0;
 +    uint32_t dstChange = 0;
 +    pread(pSrcFile->h, &srcChange, 4, 24);
 +    pread(pFile->h, &dstChange, 4, 24);
 +    
 +    /* copy the actual database */
 +    s = copyfile_state_alloc();
 +    lseek(pSrcFile->h, 0, SEEK_SET);
 +    lseek(pFile->h, 0, SEEK_SET);
 +    if( fcopyfile(pSrcFile->h, pFile->h, s, COPYFILE_ALL) ){
 +      int err=errno;
 +      switch(err) {
 +        case ENOMEM:
 +          rc = SQLITE_NOMEM;
 +          break;
 +        default:
 +          pFile->lastErrno = err;
 +          rc = SQLITE_IOERR;
 +      }
 +    }
 +    copyfile_state_free(s);
 +    
 +    if (srcChange == dstChange) {
 +      /* modify the change counter to force page zero to be reloaded */
 +      dstChange ++;
 +      pwrite(pFile->h, &dstChange, 4, 24);
 +    }
 +  }
 +  if( isSrcCorrupt ){
 +    sqlite3demo_superunlock_corrupt(src_file, corruptSrcFileLock);
 +  }else{
 +    /* done with the source db so end the transaction */
 +    sqlite3_exec(srcdb2, "COMMIT", 0, 0, 0);
 +  }
 +  /* zero out any old journal clutter */
 +  if( rc==SQLITE_OK ){
 +    int skipWAL = (srcWalFD<0)?0:1;
 +    unixInvalidateSupportFiles(pFile, skipWAL);
 +  }
 +  
 +end_replace_database:
 +  if( pSrcBtree ){
 +    sqlite3_close(srcdb2);
 +    sqlite3BtreeLeave(pSrcBtree);
 +  }
 +  sqlite3_mutex_leave(srcdb->mutex);
 +  if( isDstCorrupt ){
 +    sqlite3demo_superunlock_corrupt(id, corruptDstFileLock);
 +  }else{
 +    sqlite3demo_superunlock(pLock);
 +  }
 +  return rc;
 +}
 +#define SQLITE_FILE_HEADER_LEN 16
 +/* Check for a conflicting lock.  If one is found, print an this
 + ** on standard output using the format string given and return 1.
 + ** If there are no conflicting locks, return 0.
 + */
 +static int unixIsLocked(
 +  pid_t pid,            /* PID to test for lock owner */
 +  int h,                /* File descriptor to check */
 +  int type,             /* F_RDLCK or F_WRLCK */
 +  unsigned int iOfst,   /* First byte of the lock */
 +  unsigned int iCnt,    /* Number of bytes in the lock range */
 +  const char *zType     /* Type of lock */
 +){
 +  struct flock lk;
 +  int err;
 +  
 +  memset(&lk, 0, sizeof(lk));
 +  lk.l_type = type;
 +  lk.l_whence = SEEK_SET;
 +  lk.l_start = iOfst;
 +  lk.l_len = iCnt;
 +  
 +  if( pid!=SQLITE_LOCKSTATE_ANYPID ){
 +#ifndef F_GETLKPID
 +# warning F_GETLKPID undefined, _sqlite3_lockstate falling back to F_GETLK
 +    err = fcntl(h, F_GETLK, &lk);
 +#else
 +    lk.l_pid = pid;
 +    err = fcntl(h, F_GETLKPID, &lk);
 +#endif
 +  }else{
 +    err = fcntl(h, F_GETLK, &lk);
 +  }
 +  
 +  if( err==(-1) ){
 +    fprintf(stderr, "fcntl(%d) failed: errno=%d\n", h, errno);
 +    return -1;
 +  }
 +  
 +  if( lk.l_type!=F_UNLCK && (pid==SQLITE_LOCKSTATE_ANYPID || lk.l_pid==pid) ){
 +#ifdef SQLITE_DEBUG
 +    fprintf(stderr, "%s lock held by %d\n", zType, (int)lk.l_pid);
 +#endif
 +    return 1;
 +  } 
 +  return 0;
 +}
 +
 +/*
 +** This test only works for lock testing on unix/posix VFS.
 +** Adapted from tool/getlock.c f4c39b651370156cae979501a7b156bdba50e7ce
 +*/
 +static int unixLockstatePid(unixFile *pFile, pid_t pid, int *pLockstate){
 +  int hDb;        /* File descriptor for the open database file */
 +  int hShm = -1;  /* File descriptor for WAL shared-memory file */
 +  ssize_t got;    /* Bytes read from header */
 +  int isWal;                 /* True if in WAL mode */
 +  int nLock = 0;             /* Number of locks held */
 +  unsigned char aHdr[100];   /* Database header */
 +  
 +  assert(pLockstate);
 +  
 +  /* make sure we are dealing with a database file */
 +  hDb = pFile->h;
 +  if( hDb<0 ){
 +    *pLockstate = SQLITE_LOCKSTATE_ERROR;
 +    return SQLITE_ERROR;
 +  }
 +  assert( (strlen(SQLITE_FILE_HEADER)+1)==SQLITE_FILE_HEADER_LEN );
 +  got = pread(hDb, aHdr, 100, 0);
 +  if( got<0 ){
 +    *pLockstate = SQLITE_LOCKSTATE_ERROR;
 +    return SQLITE_ERROR;
 +  }
 +  if( got!=100 || memcmp(aHdr, SQLITE_FILE_HEADER, SQLITE_FILE_HEADER_LEN)!=0 ){
 +    *pLockstate = SQLITE_LOCKSTATE_NOTADB;
 +    return SQLITE_NOTADB;
 +  }
 +  
 +  /* First check for an exclusive lock */
 +  nLock += unixIsLocked(pid, hDb, F_RDLCK, SHARED_FIRST, SHARED_SIZE, "EXCLUSIVE");
 +  isWal = aHdr[18]==2;
 +  if( nLock==0 && isWal==0 ){
 +    /* Rollback mode */
 +    nLock += unixIsLocked(pid, hDb, F_WRLCK, PENDING_BYTE, SHARED_SIZE+2, "PENDING|RESERVED|SHARED");
 +  }
 +  if( nLock==0 && isWal!=0 ){
 +    /* lookup the file descriptor for the shared memory file if we have it open in this process */
 +    unixEnterMutex(); /* Because pFile->pInode is shared across threads */
 +    unixShmNode *pShmNode = pFile->pInode->pShmNode;
 +    if( pShmNode ){
 +      sqlite3_mutex_enter(pShmNode->mutex);
 +      
 +      hShm = pShmNode->h;
 +      if( hShm >= 0){
 +        if( unixIsLocked(pid, hShm, F_RDLCK, SHM_RECOVER, 1, "WAL-RECOVERY") ||
 +           unixIsLocked(pid, hShm, F_RDLCK, SHM_WRITE, 1, "WAL-WRITE") ){
 +          nLock = 1;
 +        }
 +      }
 +      
 +      sqlite3_mutex_leave(pShmNode->mutex);
 +    } 
 +    
 +    if( hShm<0 ){
 +      /* the shared memory file isn't open in this process space, open our own FD */
 +      char zShm[MAXPATHLEN];
 +      
 +      /* WAL mode */
 +      strlcpy(zShm, pFile->zPath, MAXPATHLEN);
 +      strlcat(zShm, "-shm", MAXPATHLEN);
 +      hShm = open(zShm, O_RDONLY, 0);
 +      if( hShm<0 ){
 +        *pLockstate = SQLITE_LOCKSTATE_OFF;
 +        unixLeaveMutex();
 +        return SQLITE_OK;
 +      }
 +      if( unixIsLocked(pid, hShm, F_RDLCK, SHM_RECOVER, 1, "WAL-RECOVERY") ||
 +         unixIsLocked(pid, hShm, F_RDLCK, SHM_WRITE, 1, "WAL-WRITE") ){
 +        nLock = 1;
 +      }
 +      close(hShm);
 +    }
 +    unixLeaveMutex();
 +  }
 +  if( nLock>0 ){
 +    *pLockstate = SQLITE_LOCKSTATE_ON;
 +  } else {
 +    *pLockstate = SQLITE_LOCKSTATE_OFF;
 +  }
 +  return SQLITE_OK;
 +}
 +
 +#endif /* (SQLITE_ENABLE_APPLE_SPI>0) && defined(__APPLE__) */
 +
 +
+ /*
+ ** If *pArg is inititially negative then this is a query.  Set *pArg to
+ ** 1 or 0 depending on whether or not bit mask of pFile->ctrlFlags is set.
+ **
+ ** If *pArg is 0 or 1, then clear or set the mask bit of pFile->ctrlFlags.
+ */
+ static void unixModeBit(unixFile *pFile, unsigned char mask, int *pArg){
+   if( *pArg<0 ){
+     *pArg = (pFile->ctrlFlags & mask)!=0;
+   }else if( (*pArg)==0 ){
+     pFile->ctrlFlags &= ~mask;
+   }else{
+     pFile->ctrlFlags |= mask;
+   }
+ }
  /*
  ** Information and control of an open file handle.
  */
@@@ -4664,24 -3865,10 +4698,24 @@@ static int unixOpenSharedMemory(unixFil
        goto shm_open_err;
      }
  
 +    const char *zBasePath = pDbFd->zPath;
 +#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE
 +    /* If pDbFd is configured with proxy locking mode, use the local 
 +     ** lock file path to determine the -shm file path
 +     */
 +    if( isProxyLockingMode(pDbFd) ){
 +      zBasePath = proxySharedMemoryBasePath(pDbFd);
 +      if( !zBasePath ){
 +        rc = SQLITE_CANTOPEN_BKPT;
 +        goto shm_open_err;
 +      }
 +    }
 +#endif
 +    
  #ifdef SQLITE_SHM_DIRECTORY
-     nShmFilename = sizeof(SQLITE_SHM_DIRECTORY) + 30;
+     nShmFilename = sizeof(SQLITE_SHM_DIRECTORY) + 31;
  #else
-     nShmFilename = 5 + (int)strlen(zBasePath);
 -    nShmFilename = 6 + (int)strlen(pDbFd->zPath);
++    nShmFilename = 6 + (int)strlen(zBasePath);
  #endif
      pShmNode = sqlite3_malloc( sizeof(*pShmNode) + nShmFilename );
      if( pShmNode==0 ){
diff --cc src/os_win.c
index 7baf165b035335de433e6be9d3aeec2086a0246d,e570d7fba6d80edd6e9608ac33508dcffcbbfaa1..5982873c3674456e0db642e675dd5d547eaaef8d
@@@ -2147,22 -2172,16 +2172,25 @@@ static int winFileControl(sqlite3_file 
        }
        return SQLITE_OK;
      }
 +    case SQLITE_FCNTL_PERSIST_WAL: {
 +      int bPersist = *(int*)pArg;
 +      if( bPersist<0 ){
 +        *(int*)pArg = pFile->bPersistWal;
 +      }else{
 +        pFile->bPersistWal = bPersist!=0;
 +      }
 +      return SQLITE_OK;
 +    }
      case SQLITE_FCNTL_PERSIST_WAL: {
-       int bPersist = *(int*)pArg;
-       if( bPersist<0 ){
-         *(int*)pArg = pFile->bPersistWal;
-       }else{
-         pFile->bPersistWal = bPersist!=0;
-       }
+       winModeBit(pFile, WINFILE_PERSIST_WAL, (int*)pArg);
+       return SQLITE_OK;
+     }
+     case SQLITE_FCNTL_POWERSAFE_OVERWRITE: {
+       winModeBit(pFile, WINFILE_PSOW, (int*)pArg);
+       return SQLITE_OK;
+     }
+     case SQLITE_FCNTL_VFSNAME: {
+       *(char**)pArg = sqlite3_mprintf("win32");
        return SQLITE_OK;
      }
      case SQLITE_FCNTL_SYNC_OMITTED: {
diff --cc src/pager.c
index a4bcacc90ebebcb3652d1eb1606e9c17fb3eab17,c57fe187451faf23a544c20808a4fe4a3750ad18..eaad63474fe1f6662ae161d432323a0f0b97db4b
@@@ -4545,13 -4553,17 +4565,20 @@@ int sqlite3PagerOpen
    pPager->readOnly = (u8)readOnly;
    assert( useJournal || pPager->tempFile );
    pPager->noSync = pPager->tempFile;
- #if SQLITE_DEFAULT_CKPTFULLFSYNC
-   pPager->ckptSyncFlags = pPager->noSync ? 0 : SQLITE_SYNC_FULL;
- #else
 +  pPager->fullSync = pPager->noSync ?0:1;
 +  pPager->syncFlags = pPager->noSync ? 0 : SQLITE_SYNC_NORMAL;
- #endif
 +  pPager->ckptSyncFlags = pPager->syncFlags;
+   if( pPager->noSync ){
+     assert( pPager->fullSync==0 );
+     assert( pPager->syncFlags==0 );
+     assert( pPager->walSyncFlags==0 );
+     assert( pPager->ckptSyncFlags==0 );
+   }else{
+     pPager->fullSync = 1;
+     pPager->syncFlags = SQLITE_SYNC_NORMAL;
+     pPager->walSyncFlags = SQLITE_SYNC_NORMAL | WAL_SYNC_TRANSACTIONS;
+     pPager->ckptSyncFlags = SQLITE_SYNC_NORMAL;
+   }
    /* pPager->pFirst = 0; */
    /* pPager->pFirstSynced = 0; */
    /* pPager->pLast = 0; */
diff --cc src/select.c
index 829bb5c42b4b68bbb561e6709bc9de08a40793d3,188050e8d14843ed6bd16f86003690d5d4b8acb6..025e86b3ea673f5fcbbe4a0e0af1584c1ed15d01
@@@ -4494,101 -4501,98 +4501,101 @@@ select_end
    return rc;
  }
  
- #if defined(SQLITE_DEBUG)
+ #if defined(SQLITE_ENABLE_TREE_EXPLAIN)
 +void sqlite3PrintExpr(Expr *p);
 +void sqlite3PrintExprList(ExprList *pList);
 +void sqlite3PrintSelect(Select *p, int indent);
  /*
- *******************************************************************************
- ** The following code is used for testing and debugging only.  The code
- ** that follows does not appear in normal builds.
- **
- ** These routines are used to print out the content of all or part of a 
- ** parse structures such as Select or Expr.  Such printouts are useful
- ** for helping to understand what is happening inside the code generator
- ** during the execution of complex SELECT statements.
- **
- ** These routine are not called anywhere from within the normal
- ** code base.  Then are intended to be called from within the debugger
- ** or from temporary "printf" statements inserted for debugging.
+ ** Generate a human-readable description of a the Select object.
  */
- void sqlite3PrintExpr(Expr *p){
-   if( !ExprHasProperty(p, EP_IntValue) && p->u.zToken ){
-     sqlite3DebugPrintf("(%s", p->u.zToken);
-   }else{
-     sqlite3DebugPrintf("(%d", p->op);
-   }
-   if( p->pLeft ){
-     sqlite3DebugPrintf(" ");
-     sqlite3PrintExpr(p->pLeft);
-   }
-   if( p->pRight ){
-     sqlite3DebugPrintf(" ");
-     sqlite3PrintExpr(p->pRight);
-   }
-   sqlite3DebugPrintf(")");
- }
- void sqlite3PrintExprList(ExprList *pList){
-   int i;
-   for(i=0; i<pList->nExpr; i++){
-     sqlite3PrintExpr(pList->a[i].pExpr);
-     if( i<pList->nExpr-1 ){
-       sqlite3DebugPrintf(", ");
+ static void explainOneSelect(Vdbe *pVdbe, Select *p){
+   sqlite3ExplainPrintf(pVdbe, "SELECT ");
+   if( p->selFlags & (SF_Distinct|SF_Aggregate) ){
+     if( p->selFlags & SF_Distinct ){
+       sqlite3ExplainPrintf(pVdbe, "DISTINCT ");
+     }
+     if( p->selFlags & SF_Aggregate ){
+       sqlite3ExplainPrintf(pVdbe, "agg_flag ");
      }
+     sqlite3ExplainNL(pVdbe);
+     sqlite3ExplainPrintf(pVdbe, "   ");
    }
- }
- void sqlite3PrintSelect(Select *p, int indent){
-   sqlite3DebugPrintf("%*sSELECT(%p) ", indent, "", p);
-   sqlite3PrintExprList(p->pEList);
-   sqlite3DebugPrintf("\n");
-   if( p->pSrc ){
-     char *zPrefix;
+   sqlite3ExplainExprList(pVdbe, p->pEList);
+   sqlite3ExplainNL(pVdbe);
+   if( p->pSrc && p->pSrc->nSrc ){
      int i;
-     zPrefix = "FROM";
+     sqlite3ExplainPrintf(pVdbe, "FROM ");
+     sqlite3ExplainPush(pVdbe);
      for(i=0; i<p->pSrc->nSrc; i++){
        struct SrcList_item *pItem = &p->pSrc->a[i];
-       sqlite3DebugPrintf("%*s ", indent+6, zPrefix);
-       zPrefix = "";
+       sqlite3ExplainPrintf(pVdbe, "{%d,*} = ", pItem->iCursor);
        if( pItem->pSelect ){
-         sqlite3DebugPrintf("(\n");
-         sqlite3PrintSelect(pItem->pSelect, indent+10);
-         sqlite3DebugPrintf("%*s)", indent+8, "");
+         sqlite3ExplainSelect(pVdbe, pItem->pSelect);
+         if( pItem->pTab ){
+           sqlite3ExplainPrintf(pVdbe, " (tabname=%s)", pItem->pTab->zName);
+         }
        }else if( pItem->zName ){
-         sqlite3DebugPrintf("%s", pItem->zName);
-       }
-       if( pItem->pTab ){
-         sqlite3DebugPrintf("(table: %s)", pItem->pTab->zName);
+         sqlite3ExplainPrintf(pVdbe, "%s", pItem->zName);
        }
        if( pItem->zAlias ){
-         sqlite3DebugPrintf(" AS %s", pItem->zAlias);
+         sqlite3ExplainPrintf(pVdbe, " (AS %s)", pItem->zAlias);
        }
-       if( i<p->pSrc->nSrc-1 ){
-         sqlite3DebugPrintf(",");
+       if( pItem->jointype & JT_LEFT ){
+         sqlite3ExplainPrintf(pVdbe, " LEFT-JOIN");
        }
-       sqlite3DebugPrintf("\n");
+       sqlite3ExplainNL(pVdbe);
      }
+     sqlite3ExplainPop(pVdbe);
    }
    if( p->pWhere ){
-     sqlite3DebugPrintf("%*s WHERE ", indent, "");
-     sqlite3PrintExpr(p->pWhere);
-     sqlite3DebugPrintf("\n");
+     sqlite3ExplainPrintf(pVdbe, "WHERE ");
+     sqlite3ExplainExpr(pVdbe, p->pWhere);
+     sqlite3ExplainNL(pVdbe);
    }
    if( p->pGroupBy ){
-     sqlite3DebugPrintf("%*s GROUP BY ", indent, "");
-     sqlite3PrintExprList(p->pGroupBy);
-     sqlite3DebugPrintf("\n");
+     sqlite3ExplainPrintf(pVdbe, "GROUPBY ");
+     sqlite3ExplainExprList(pVdbe, p->pGroupBy);
+     sqlite3ExplainNL(pVdbe);
    }
    if( p->pHaving ){
-     sqlite3DebugPrintf("%*s HAVING ", indent, "");
-     sqlite3PrintExpr(p->pHaving);
-     sqlite3DebugPrintf("\n");
+     sqlite3ExplainPrintf(pVdbe, "HAVING ");
+     sqlite3ExplainExpr(pVdbe, p->pHaving);
+     sqlite3ExplainNL(pVdbe);
    }
    if( p->pOrderBy ){
-     sqlite3DebugPrintf("%*s ORDER BY ", indent, "");
-     sqlite3PrintExprList(p->pOrderBy);
-     sqlite3DebugPrintf("\n");
+     sqlite3ExplainPrintf(pVdbe, "ORDERBY ");
+     sqlite3ExplainExprList(pVdbe, p->pOrderBy);
+     sqlite3ExplainNL(pVdbe);
+   }
+   if( p->pLimit ){
+     sqlite3ExplainPrintf(pVdbe, "LIMIT ");
+     sqlite3ExplainExpr(pVdbe, p->pLimit);
+     sqlite3ExplainNL(pVdbe);
+   }
+   if( p->pOffset ){
+     sqlite3ExplainPrintf(pVdbe, "OFFSET ");
+     sqlite3ExplainExpr(pVdbe, p->pOffset);
+     sqlite3ExplainNL(pVdbe);
+   }
+ }
+ void sqlite3ExplainSelect(Vdbe *pVdbe, Select *p){
+   if( p==0 ){
+     sqlite3ExplainPrintf(pVdbe, "(null-select)");
+     return;
    }
+   while( p->pPrior ) p = p->pPrior;
+   sqlite3ExplainPush(pVdbe);
+   while( p ){
+     explainOneSelect(pVdbe, p);
+     p = p->pNext;
+     if( p==0 ) break;
+     sqlite3ExplainNL(pVdbe);
+     sqlite3ExplainPrintf(pVdbe, "%s\n", selectOpName(p->op));
+   }
+   sqlite3ExplainPrintf(pVdbe, "END");
+   sqlite3ExplainPop(pVdbe);
  }
  /* End of the structure debug printing code
  *****************************************************************************/
  #endif /* defined(SQLITE_TEST) || defined(SQLITE_DEBUG) */
diff --cc src/sqlite.h.in
Simple merge
diff --cc src/sqliteInt.h
Simple merge
diff --cc src/test1.c
index 24aca31cff45eec6e65e0f27d6f4bb8d3671da46,9cc5d6347c29d5c375b5d8513cbc119779082f00..c3569bb16b59d737cfaf5a6e2e820c6f62b5cd0a
@@@ -5423,6 -5234,72 +5423,71 @@@ static int file_control_persist_wal
    Tcl_AppendResult(interp, z, (char*)0);
    return TCL_OK;  
  }
 -
+ /*
+ ** tclcmd:   file_control_powersafe_overwrite DB PSOW-FLAG
+ **
+ ** This TCL command runs the sqlite3_file_control interface with
+ ** the SQLITE_FCNTL_POWERSAFE_OVERWRITE opcode.
+ */
+ static int file_control_powersafe_overwrite(
+   ClientData clientData, /* Pointer to sqlite3_enable_XXX function */
+   Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */
+   int objc,              /* Number of arguments */
+   Tcl_Obj *CONST objv[]  /* Command arguments */
+ ){
+   sqlite3 *db;
+   int rc;
+   int b;
+   char z[100];
+   if( objc!=3 ){
+     Tcl_AppendResult(interp, "wrong # args: should be \"",
+         Tcl_GetStringFromObj(objv[0], 0), " DB FLAG", 0);
+     return TCL_ERROR;
+   }
+   if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ){
+     return TCL_ERROR;
+   }
+   if( Tcl_GetIntFromObj(interp, objv[2], &b) ) return TCL_ERROR;
+   rc = sqlite3_file_control(db,NULL,SQLITE_FCNTL_POWERSAFE_OVERWRITE,(void*)&b);
+   sqlite3_snprintf(sizeof(z), z, "%d %d", rc, b);
+   Tcl_AppendResult(interp, z, (char*)0);
+   return TCL_OK;  
+ }
+ /*
+ ** tclcmd:   file_control_vfsname DB ?AUXDB?
+ **
+ ** Return a string that describes the stack of VFSes.
+ */
+ static int file_control_vfsname(
+   ClientData clientData, /* Pointer to sqlite3_enable_XXX function */
+   Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */
+   int objc,              /* Number of arguments */
+   Tcl_Obj *CONST objv[]  /* Command arguments */
+ ){
+   sqlite3 *db;
+   const char *zDbName = "main";
+   char *zVfsName = 0;
+   if( objc!=2 && objc!=3 ){
+     Tcl_AppendResult(interp, "wrong # args: should be \"",
+         Tcl_GetStringFromObj(objv[0], 0), " DB ?AUXDB?", 0);
+     return TCL_ERROR;
+   }
+   if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ){
+     return TCL_ERROR;
+   }
+   if( objc==3 ){
+     zDbName = Tcl_GetString(objv[2]);
+   }
+   sqlite3_file_control(db, zDbName, SQLITE_FCNTL_VFSNAME,(void*)&zVfsName);
+   Tcl_AppendResult(interp, zVfsName, (char*)0);
+   sqlite3_free(zVfsName);
+   return TCL_OK;  
+ }
  
  /*
  ** tclcmd:   sqlite3_vfs_list
@@@ -6253,11 -6125,10 +6318,12 @@@ int Sqlitetest1_Init(Tcl_Interp *interp
       { "file_control_sizehint_test",  file_control_sizehint_test,   0   },
       { "file_control_win32_av_retry", file_control_win32_av_retry,  0   },
       { "file_control_persist_wal",    file_control_persist_wal,     0   },
-      { "file_control_persist_wal",    file_control_persist_wal,     0   },
+      { "file_control_powersafe_overwrite",file_control_powersafe_overwrite,0},
+      { "file_control_vfsname",        file_control_vfsname,         0   },
       { "sqlite3_vfs_list",           vfs_list,     0   },
       { "sqlite3_create_function_v2", test_create_function_v2, 0 },
 +     { "path_is_local",              path_is_local,  0   },
 +     { "path_is_dos",                path_is_dos,  0   },
  
       /* Functions from os.h */
  #ifndef SQLITE_OMIT_UTF16
diff --cc src/vdbe.c
Simple merge
diff --cc src/vdbeapi.c
Simple merge
diff --cc src/vdbeaux.c
Simple merge
diff --cc src/vdbetrace.c
Simple merge
diff --cc src/wal.c
Simple merge
diff --cc src/wal.h
Simple merge
index eb8fc89abae34670dfda09663e47883dabb0805a,6e8e1bed5e14854bf0c908e938606757dcca795a..5d3787374b280a943b7dc4dacbf9ca0869920bca
@@@ -189,12 -188,10 +189,12 @@@ ifcapable wal 
      execsql { 
        PRAGMA journal_mode = WAL;
        PRAGMA incremental_vacuum(1);
 -      PRAGMA wal_checkpoint;
      }
 +  } {wal}
 +  do_test 4.2.1 {
 +    execsql { PRAGMA wal_checkpoint }
      file size test.db-wal
-   } [wal_file_size [wal_frames db 2 1] 512]
+   } [expr {32+2*(512+24)}]
  
    do_test 4.3 {
      db close
index 0a25c3f7156ace1058625840229b125920f04132,7168e753ab1f434b67a8f5c3ec32e23417014075..aa26cccb4094849982ca660561e6f7a8331fa170
@@@ -14,12 -14,16 +14,22 @@@ set testdir [file dirname $argv0
  source $testdir/tester.tcl
  source $testdir/malloc_common.tcl
  
 +# AFP doesn't like multiplex db tests
 +if { ![path_is_local "."] } {
 +  finish_test 
 +  return 
 +}
 +
+ # The tests in this file assume that SQLite is compiled without
+ # ENABLE_8_3_NAMES.
+ #
+ ifcapable 8_3_names {
+   puts -nonewline "SQLite compiled with SQLITE_ENABLE_8_3_NAMES. "
+   puts            "Skipping tests multiplex-*."
+   finish_test
+   return
+ }
  set g_chunk_size [ expr ($::SQLITE_MAX_PAGE_SIZE*16384) ]
  set g_max_chunks 32
  
Simple merge
Simple merge
diff --cc test/wal.test
index bf639f214e9c79a9ab8e398764836a2c7cac46d3,3b63d3e792d2470309acf386abc799834a3e123b..5bb654554a42509b3bf119044a405ceebaa22657
@@@ -1059,11 -1054,10 +1058,12 @@@ foreach {tn ckpt_cmd ckpt_res ckpt_mai
        PRAGMA aux.auto_vacuum = 0;
        PRAGMA main.journal_mode = WAL;
        PRAGMA aux.journal_mode = WAL;
-       PRAGMA synchronous = NORMAL;
 +      SELECT count(*) FROM main.sqlite_master, aux.sqlite_master;
+       PRAGMA main.synchronous = NORMAL;
+       PRAGMA aux.synchronous = NORMAL;
 +      PRAGMA aux.synchronous = FULL;
      }
 -  } {wal wal}
 +  } {wal wal 0}
  
    do_test wal-16.$tn.2 {
      execsql {