]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Merge recent enhancements from trunk.
authordrh <drh@noemail.net>
Wed, 16 Dec 2015 19:47:54 +0000 (19:47 +0000)
committerdrh <drh@noemail.net>
Wed, 16 Dec 2015 19:47:54 +0000 (19:47 +0000)
FossilOrigin-Name: f6c9273cab877b8b6b327250195f3392393d060a

1  2 
Makefile.in
main.mk
manifest
manifest.uuid
src/main.c
src/shell.c
src/sqlite.h.in
src/sqliteInt.h
src/test_config.c
src/vdbe.c
src/vdbeaux.c

diff --cc Makefile.in
Simple merge
diff --cc main.mk
Simple merge
diff --cc manifest
index 78db225910b26668e37a64df39ea408b83a5c24c,249e331ec1a2cbb39b7763e7937c5565f34928fd..57073352a766b5ef87c00c109fa3ab39d1e67b89
+++ b/manifest
@@@ -1,8 -1,8 +1,8 @@@
 -C Make\sgreater\suse\sof\sthe\sSQLITE_WITHIN\smacro.
 -D 2015-12-16T13:07:35.753
 -F Makefile.in 28bcd6149e050dff35d4dcfd97e890cd387a499d
 +C Merge\srecent\senhancements\sfrom\strunk.
- D 2015-12-02T20:40:26.162
- F Makefile.in e7d3be066453d66f333e7cb98f4c9d3e700bfc09
++D 2015-12-16T19:47:54.677
++F Makefile.in 321a54f5a2843b6752b21f7bd66ce5f96444d1ab
  F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 -F Makefile.msc e8fdca1cb89a1b58b5f4d3a130ea9a3d28cb314d
 +F Makefile.msc 820453f6340c500e2377a6ebd681cecfa92afd79
  F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7
  F VERSION 8b9d3ac6f1962f94e06ba05462422a544f9c4e36
  F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50
@@@ -283,7 -257,7 +277,7 @@@ F ext/userauth/userauth.c 5fa3bdb492f48
  F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
  F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
  F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60
- F main.mk 65524a49d6bbeb624b5953ed50a8c84d9dc34d16
 -F main.mk ed77cbb97848c8dae1ab928245432f74b0580162
++F main.mk 238ecdee438a8b0ff662ac9e739899cacaae668c
  F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83
  F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271
  F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504
@@@ -308,11 -282,11 +302,11 @@@ F src/btreeInt.h 3ab435ed27adea54d04058
  F src/build.c e83da4d004a4e050c01acbb821ff7a7b1019c29b
  F src/callback.c 7b44ce59674338ad48b0e84e7b72f935ea4f68b0
  F src/complete.c addcd8160b081131005d5bc2d34adf20c1c5c92f
- F src/ctime.c 58eda76364fb6f374e044aa4493219b13abf9400
+ F src/ctime.c 60e135af364d777a9ab41c97e5e89cd224da6198
  F src/date.c fb1c99172017dcc8e237339132c91a21a0788584
  F src/dbstat.c ffd63fc8ba7541476ced189b95e95d7f2bc63f78
 -F src/delete.c 00af9f08a15ddc5cba5962d3d3e5bf2d67b2e7da
 +F src/delete.c 86e3940d07fe69a40270c2aaf6ca6c7adf19246c
- F src/expr.c cb1a419508e5b27769a91e00e36e94724e7b1d51
+ F src/expr.c ccb93d7b7e1ac5d187c9b153bae145933f93ee5c
  F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
  F src/fkey.c 31900763094a3736a5fc887469202eb579fef2d0
  F src/func.c fe50a9ab977acc0bb0fcd46741e0071fa388888e
@@@ -320,12 -294,12 +314,12 @@@ F src/global.c 508e4087f7b41d688e4762dc
  F src/hash.c 4263fbc955f26c2e8cdc0cf214bc42435aa4e4f5
  F src/hash.h c8f3c31722cf3277d03713909761e152a5b81094
  F src/hwtime.h d32741c8f4df852c7d959236615444e2b1063b08
 -F src/insert.c e1d20ae8979e25519c2670233718676bedcfedc9
 +F src/insert.c 8ab83219eb56a103edb73bb0a1e9057c4d3b976b
  F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d
  F src/legacy.c ba1863ea58c4c840335a84ec276fc2b25e22bc4e
- F src/loadext.c 18586e45a215325f15096821e9c082035d4fb810
- F src/main.c cf9fcb71ea8ea46ad20b37dc1af67c1a17cf73b5
- F src/malloc.c 337bbe9c7d436ef9b7d06b5dd10bbfc8f3025972
+ F src/loadext.c 84996d7d70a605597d79c1f1d7b2012a5fd34f2b
 -F src/main.c 2f33510a6a392c606fe64964e695e55ad124242f
++F src/main.c 955f7b9d30aa7c3d7c391c0717662b21c55ff371
+ F src/malloc.c 8f787669e79de26efc42272b5797bc00fff527c6
  F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
  F src/mem1.c 6919bcf12f221868ea066eec27e579fed95ce98b
  F src/mem2.c f1940d9e91948dd6a908fbb9ce3835c36b5d83c3
@@@ -351,25 -325,25 +345,25 @@@ F src/pager.h bf25005b4656cd805af43487c
  F src/parse.y 23737e649c26ce327603799e57f5c2ff50e5e6ba
  F src/pcache.c 73895411fa6b7bd6f0091212feabbe833b358d23
  F src/pcache.h 1ff11adce609ba7de139b6abfabaf9a2bac947b5
- F src/pcache1.c 46a110be31a8d9f9b41431733836822ca0dd27ab
+ F src/pcache1.c 72f644dc9e1468c72922eff5904048427b817051
  F src/pragma.c f3e7147299ca05ef4304a36f1fd6e002729c72c6
- F src/pragma.h 3d94aebbebd2089899fecc01909bf2608b39507d
+ F src/pragma.h 64c78a648751b9f4f297276c4eb7507b14b4628c
  F src/prepare.c 82e5db1013846a819f198336fed72c44c974e7b1
- F src/printf.c ca05561795ad6c2fa47acdd007702586282f7feb
+ F src/printf.c af589a27b7d40f6f4f704e9eea99f02f18ad6d32
  F src/random.c ba2679f80ec82c4190062d756f22d0c358180696
- F src/resolve.c f4c897ca76ca6d5e0b3f0499c627392ffe657c8e
+ F src/resolve.c a83b41104e6ff69855d03cd0aaa09e93927ec39f
  F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e
- F src/select.c 1611828a7116e5f6cc1e69cd07d59b0d2c662ea9
- F src/shell.c 98bf4a35a121c9d4b91940a53794f2cbc354c45c
- F src/sqlite.h.in fc89d305439df88cfe018dbbaf1770645766fa2f
+ F src/select.c f8fded11fc443a9f5a73cc5db069d06b34460e2f
 -F src/shell.c abbc74ea43dbf2f306ea18282d666683fb5efab2
 -F src/sqlite.h.in 7d87d71b9a4689c51fa092f48f16590ff71558e3
++F src/shell.c 341bfd2d86b806318cb24f8202fa58dc85f9f2e8
++F src/sqlite.h.in 686be87fcbaea46b1aa8197a17b7a437d39764fc
  F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad
- F src/sqlite3ext.h 41ef50b0418a7c5ad1337bb80db5a7928dee764f
- F src/sqliteInt.h 0bf170994dbc42d4344eed5d59d88ed0631aa4d1
+ F src/sqlite3ext.h dfbe62ffd95b99afe2140d8c35b180d11924072d
 -F src/sqliteInt.h beb4a63b94428f52a3d7c7af2ba8bdc7d4682a03
++F src/sqliteInt.h 109deba7548c27ea534de0dde6729620103cbe87
  F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46
  F src/status.c 70912d7be68e9e2dbc4010c93d344af61d4c59ba
  F src/table.c 51b46b2a62d1b3a959633d593b89bab5e2c9155e
 -F src/tclsqlite.c d9439b6a910985b7fff43ba6756bcef00de22649
 +F src/tclsqlite.c e2344bee0d192397f555a24ef3fab26f2ed93bcc
- F src/test1.c 4004bcc1b3b361a9137acd1d875599ecbdd6f961
+ F src/test1.c 4f1b42699068b7806af3111786f5ad760c2c1ff7
  F src/test2.c 5586f43fcd9a1be0830793cf9d354082c261b25b
  F src/test3.c a8887dabbbee3059af338f20d290084a63ed1b0f
  F src/test4.c d168f83cc78d02e8d35567bb5630e40dcd85ac1e
@@@ -383,10 -357,10 +377,10 @@@ F src/test_autoext.c dea8a01a7153b9adc9
  F src/test_backup.c 2e6e6a081870150f20c526a2e9d0d29cda47d803
  F src/test_blob.c e5a7a81d61a780da79101aeb1e60d300af169e07
  F src/test_btree.c 2e9978eca99a9a4bfa8cae949efb00886860a64f
- F src/test_config.c bae65b68a216f31e225a46187497bdc007c1c5e5
 -F src/test_config.c 0dee90328e3dedf8ba002ee94b6a7e7ea7726fe4
++F src/test_config.c a0e8eeb86a7d9393f3bbf7315932c1cccd0e8010
  F src/test_demovfs.c 0de72c2c89551629f58486fde5734b7d90758852
  F src/test_devsym.c e7498904e72ba7491d142d5c83b476c4e76993bc
- F src/test_fs.c aab47ac456316502faa265daadf9ac832fea12b9
+ F src/test_fs.c 993c7eab65bed6add4bb48cca29775e963f710cf
  F src/test_func.c 0d9c25956152adefee8881c6fadc8354793764d0
  F src/test_hexio.c abfdecb6fa58c354623978efceb088ca18e379cd
  F src/test_init.c 66b33120ffe9cd853b5a905ec850d51151337b32
@@@ -419,18 -393,18 +413,18 @@@ F src/test_wsd.c 41cadfd9d97fe8e3e4e44f
  F src/threads.c bbfb74450643cb5372a43ad4f6cffd7e9dfcecb0
  F src/tokenize.c 5606871a377f390af7040ec3c12e0d183512d785
  F src/treeview.c 78842e90c1f71269e7a73a1d4221b6fe360bab66
- F src/trigger.c 322f23aad694e8f31d384dcfa386d52a48d3c52f
+ F src/trigger.c de3ed31ad3218a20d7d7e18bf1b3b734e78bda66
 -F src/update.c 17332f9fe818cbc0444c36a811800af8498af4c3
 +F src/update.c d8d675aa299336ac086ad2039d7e812cd6237db0
  F src/utf.c fc6b889ba0779b7722634cdeaa25f1930d93820c
  F src/util.c e802e8e311a0d6c48cd1b3e89db164f6f0248d70
  F src/vacuum.c 2ddd5cad2a7b9cef7f9e431b8c7771634c6b1701
- F src/vdbe.c 5c3dd0f49bfebfddbfa4d389ed394b2b28d48cbf
 -F src/vdbe.c 0bc683e68a71d5151898b6b13cfeb277337335a4
 -F src/vdbe.h efb7a8c1459e31f3ea4377824c6a7e4cb5068637
 -F src/vdbeInt.h 75c2e82ee3357e9210c06474f8d9bdf12c81105d
 -F src/vdbeapi.c 020681b943e77766b32ae1cddf86d7831b7374ca
 -F src/vdbeaux.c 68082d9991fc1b8625d34c8b5db1775c9dee426e
 -F src/vdbeblob.c fdc4a81605ae7a35ae94a55bd768b66d6be16f15
 -F src/vdbemem.c fdd1578e47bea61390d472de53c565781d81e045
++F src/vdbe.c c47b3bfcb4fcf1f24457eb505da229c4fb035a60
 +F src/vdbe.h bfe3f80dba435377cdb64fd917f2529f0f48ab77
 +F src/vdbeInt.h 4f3b46806b93faa92f0511c7ce30ed31aaec65be
 +F src/vdbeapi.c ab2cb8fe23fb9f3195f1311eaa800495d83b6118
- F src/vdbeaux.c 514e93b162bf3e84c82478f174728cda9135b558
++F src/vdbeaux.c 6783ed3936bc484c2252523c82e9a14888fed936
 +F src/vdbeblob.c cc13eca96b8ec51b6248de785a1aec5df11f5805
 +F src/vdbemem.c 25b6cfd665b5073480452426e84136edd94140c0
  F src/vdbesort.c a7ec02da4494c59dfd071126dd3726be5a11459d
  F src/vdbetrace.c 8befe829faff6d9e6f6e4dee5a7d3f85cc85f1a0
  F src/vtab.c 2a8b44aa372c33f6154208e7a7f6c44254549806
@@@ -952,9 -926,9 +946,9 @@@ F test/parser1.test 222b5cbf3e2e659fec1
  F test/pcache.test c8acbedd3b6fd0f9a7ca887a83b11d24a007972b
  F test/pcache2.test af7f3deb1a819f77a6d0d81534e97d1cf62cd442
  F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff
 -F test/permutations.test 4ea119731c62d2f7d0aa86dd5b184cbb61ca411b
 +F test/permutations.test 63cb93f915b4056463cef8ad035082e9f1cb524e
  F test/pragma.test a44253f911e7d50127d4a08f927f47c861a4c772
- F test/pragma2.test 00065068eeab2d15ea55465ec0f1e0a70e2c369e
+ F test/pragma2.test a9400a7289605280576098b97f5cde3f204075c0
  F test/pragma3.test 6f849ccffeee7e496d2f2b5e74152306c0b8757c
  F test/printf.test b3ff34e73d59124140eaf89f7672e21bc2ca5fcc
  F test/printf2.test 0b61566dd1c0f0b802f59dffa228c5dc5aa6b054
@@@ -1391,11 -1366,11 +1387,11 @@@ F tool/mkkeywordhash.c 06ec0b78bd4fa68c
  F tool/mkopcodec.tcl edde8adc42621b5e598127f8cdc6d52cfe21f52b
  F tool/mkopcodeh.tcl e04177031532b7aa9379ded50e820231ac4abd6e
  F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e
- F tool/mkpragmatab.tcl e94e55d247d4fe3be34f2a4f4edb03fdcd09ce5b
+ F tool/mkpragmatab.tcl f0d5bb266d1d388cf86fce5ba01a891e95d72d41
  F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97
  F tool/mksqlite3c-noext.tcl 87240b09c20042999b41d5fabe091b7111287835
 -F tool/mksqlite3c.tcl b66b4170f693602cd6985aed15d9509fe2f18c84
 -F tool/mksqlite3h.tcl 1d41ab59bffb025121f75b76e183125ce41b3ec8
 +F tool/mksqlite3c.tcl a52d7e8c0888f9384fbfa2c6ddd5f357409758b9
 +F tool/mksqlite3h.tcl e7b106fc4f29fbc258e8ba9b88d9108332ea2ade
  F tool/mksqlite3internalh.tcl eb994013e833359137eb53a55acdad0b5ae1049b
  F tool/mkvsix.tcl bbe57cd9ae11c6cc70319241101ef8d2b8c3765b
  F tool/offsets.c fe4262fdfa378e8f5499a42136d17bf3b98f6091
@@@ -1429,7 -1404,7 +1425,7 @@@ F tool/vdbe_profile.tcl 246d0da094856d7
  F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
  F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
  F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
- P 7d6cfc79e7e5534ebacd980479917bc528a638f7 4f2bcff94c672312805be1400050a7026f93a9d7
- R 50fae771d9c27e855af8c38f94348078
 -P 1928f8945b7cdf733129619b7ab02d1addf63478
 -R 66e8a449a1ea9e4af724bc52e4baa50a
++P d1a1278d7f3306536dc9cbd8fb300898f1e373e8 f2fc3aede55c8fa0351697f9f5ce4e544334c9af
++R 517371cdb369ee85515a09f103cedd2b
  U drh
- Z 355385643ee65578020d9d55249a7cd0
 -Z dcd4ad4bd65fd6c947db9b3e37840361
++Z 301e77e09a4ba74f7629e4b1c4e7cf3d
diff --cc manifest.uuid
index ca5a2e055331e3a78888846415a93c7c24196eb3,d77b5aa4be25aa7cfc2cc8b98b48fb37d565e5b9..1ec9cd8112c95b7e971dbc409df57fbee7bd876a
@@@ -1,1 -1,1 +1,1 @@@
- d1a1278d7f3306536dc9cbd8fb300898f1e373e8
 -f2fc3aede55c8fa0351697f9f5ce4e544334c9af
++f6c9273cab877b8b6b327250195f3392393d060a
diff --cc src/main.c
Simple merge
diff --cc src/shell.c
Simple merge
diff --cc src/sqlite.h.in
index c10aadd9041240bde7c322b86baf5ff14fbd73bb,be58c7cd1f8878e702c6b6ef65fff5ba9ccd8bdd..ac2e07c67a3ec9f1906aefc882ed37effc72805f
@@@ -7878,101 -7880,98 +7880,193 @@@ void sqlite3_stmt_scanstatus_reset(sqli
  */
  int sqlite3_db_cacheflush(sqlite3*);
  
 +/*
 +** CAPI3REF: The pre-update hook.
 +** EXPERIMENTAL
 +**
 +** ^These interfaces are only available if SQLite is compiled using the
 +** [SQLITE_ENABLE_UPDATE_HOOK] compile-time option.
 +**
 +** ^The [sqlite3_preupdate_hook()] interface registers a callback function
 +** that is invoked prior to each [INSERT], [UPDATE], and [DELETE] operation.
 +** ^At most one preupdate hook may be registered at a time on a single
 +** [database connection]; each call to [sqlite3_preupdate_hook()] overrides
 +** the previous setting.
 +** ^The preupdate hook is disabled by invoking [sqlite3_preupdate_hook()]
 +** with a NULL pointer as the second parameter.
 +** ^The third parameter to [sqlite3_preupdate_hook()] is passed through as
 +** the first parameter to callbacks.
 +**
 +** ^The preupdate hook only fires for changes to real tables; the preupdate
 +** hook is not invoked for changes to virtual tables.
 +**
 +** ^The second parameter to the preupdate callback is a pointer to
 +** the [database connection] that registered the preupdate hook.
 +** ^The third parameter to the preupdate callback is one of the constants
 +** [SQLITE_INSERT], [SQLITE_DELETE], or [SQLITE_UPDATE] to indentify the
 +** kind of update operation that is about to occur.
 +** ^(The fourth parameter to the preupdate callback is the name of the
 +** database within the database connection that is being modified.  This
 +** will be "main" for the main database or "temp" for TEMP tables or 
 +** the name given after the AS keyword in the [ATTACH] statement for attached
 +** databases.)^
 +** ^The fifth parameter to the preupdate callback is the name of the
 +** table that is being modified.
 +** ^The sixth parameter to the preupdate callback is the initial [rowid] of the
 +** row being changes for SQLITE_UPDATE and SQLITE_DELETE changes and is
 +** undefined for SQLITE_INSERT changes.
 +** ^The seventh parameter to the preupdate callback is the final [rowid] of
 +** the row being changed for SQLITE_UPDATE and SQLITE_INSERT changes and is
 +** undefined for SQLITE_DELETE changes.
 +**
 +** The [sqlite3_preupdate_old()], [sqlite3_preupdate_new()],
 +** [sqlite3_preupdate_count()], and [sqlite3_preupdate_depth()] interfaces
 +** provide additional information about a preupdate event. These routines
 +** may only be called from within a preupdate callback.  Invoking any of
 +** these routines from outside of a preupdate callback or with a
 +** [database connection] pointer that is different from the one supplied
 +** to the preupdate callback results in undefined and probably undesirable
 +** behavior.
 +**
 +** ^The [sqlite3_preupdate_count(D)] interface returns the number of columns
 +** in the row that is being inserted, updated, or deleted.
 +**
 +** ^The [sqlite3_preupdate_old(D,N,P)] interface writes into P a pointer to
 +** a [protected sqlite3_value] that contains the value of the Nth column of
 +** the table row before it is updated.  The N parameter must be between 0
 +** and one less than the number of columns or the behavior will be
 +** undefined. This must only be used within SQLITE_UPDATE and SQLITE_DELETE
 +** preupdate callbacks; if it is used by an SQLITE_INSERT callback then the
 +** behavior is undefined.  The [sqlite3_value] that P points to
 +** will be destroyed when the preupdate callback returns.
 +**
 +** ^The [sqlite3_preupdate_new(D,N,P)] interface writes into P a pointer to
 +** a [protected sqlite3_value] that contains the value of the Nth column of
 +** the table row after it is updated.  The N parameter must be between 0
 +** and one less than the number of columns or the behavior will be
 +** undefined. This must only be used within SQLITE_INSERT and SQLITE_UPDATE
 +** preupdate callbacks; if it is used by an SQLITE_DELETE callback then the
 +** behavior is undefined.  The [sqlite3_value] that P points to
 +** will be destroyed when the preupdate callback returns.
 +**
 +** ^The [sqlite3_preupdate_depth(D)] interface returns 0 if the preupdate
 +** callback was invoked as a result of a direct insert, update, or delete
 +** operation; or 1 for inserts, updates, or deletes invoked by top-level 
 +** triggers; or 2 for changes resulting from triggers called by top-level
 +** triggers; and so forth.
 +**
 +** See also:  [sqlite3_update_hook()]
 +*/
 +SQLITE_EXPERIMENTAL void *sqlite3_preupdate_hook(
 +  sqlite3 *db,
 +  void(*xPreUpdate)(
 +    void *pCtx,                   /* Copy of third arg to preupdate_hook() */
 +    sqlite3 *db,                  /* Database handle */
 +    int op,                       /* SQLITE_UPDATE, DELETE or INSERT */
 +    char const *zDb,              /* Database name */
 +    char const *zName,            /* Table name */
 +    sqlite3_int64 iKey1,          /* Rowid of row about to be deleted/updated */
 +    sqlite3_int64 iKey2           /* New rowid value (for a rowid UPDATE) */
 +  ),
 +  void*
 +);
 +SQLITE_EXPERIMENTAL int sqlite3_preupdate_old(sqlite3 *, int, sqlite3_value **);
 +SQLITE_EXPERIMENTAL int sqlite3_preupdate_count(sqlite3 *);
 +SQLITE_EXPERIMENTAL int sqlite3_preupdate_depth(sqlite3 *);
 +SQLITE_EXPERIMENTAL int sqlite3_preupdate_new(sqlite3 *, int, sqlite3_value **);
 +
+ /*
+ ** CAPI3REF: Database Snapshot
+ ** KEYWORDS: {snapshot}
+ ** EXPERIMENTAL
+ **
+ ** An instance of the snapshot object records the state of a [WAL mode]
+ ** database for some specific point in history.
+ **
+ ** In [WAL mode], multiple [database connections] that are open on the
+ ** same database file can each be reading a different historical version
+ ** of the database file.  When a [database connection] begins a read
+ ** transaction, that connection sees an unchanging copy of the database
+ ** as it existed for the point in time when the transaction first started.
+ ** Subsequent changes to the database from other connections are not seen
+ ** by the reader until a new read transaction is started.
+ **
+ ** The sqlite3_snapshot object records state information about an historical
+ ** version of the database file so that it is possible to later open a new read
+ ** transaction that sees that historical version of the database rather than
+ ** the most recent version.
+ **
+ ** The constructor for this object is [sqlite3_snapshot_get()].  The
+ ** [sqlite3_snapshot_open()] method causes a fresh read transaction to refer
+ ** to an historical snapshot (if possible).  The destructor for 
+ ** sqlite3_snapshot objects is [sqlite3_snapshot_free()].
+ */
+ typedef struct sqlite3_snapshot sqlite3_snapshot;
+ /*
+ ** CAPI3REF: Record A Database Snapshot
+ ** EXPERIMENTAL
+ **
+ ** ^The [sqlite3_snapshot_get(D,S,P)] interface attempts to make a
+ ** new [sqlite3_snapshot] object that records the current state of
+ ** schema S in database connection D.  ^On success, the
+ ** [sqlite3_snapshot_get(D,S,P)] interface writes a pointer to the newly
+ ** created [sqlite3_snapshot] object into *P and returns SQLITE_OK.
+ ** ^If schema S of [database connection] D is not a [WAL mode] database
+ ** that is in a read transaction, then [sqlite3_snapshot_get(D,S,P)]
+ ** leaves the *P value unchanged and returns an appropriate [error code].
+ **
+ ** The [sqlite3_snapshot] object returned from a successful call to
+ ** [sqlite3_snapshot_get()] must be freed using [sqlite3_snapshot_free()]
+ ** to avoid a memory leak.
+ **
+ ** The [sqlite3_snapshot_get()] interface is only available when the
+ ** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
+ */
+ SQLITE_EXPERIMENTAL int sqlite3_snapshot_get(
+   sqlite3 *db,
+   const char *zSchema,
+   sqlite3_snapshot **ppSnapshot
+ );
+ /*
+ ** CAPI3REF: Start a read transaction on an historical snapshot
+ ** EXPERIMENTAL
+ **
+ ** ^The [sqlite3_snapshot_open(D,S,P)] interface attempts to move the
+ ** read transaction that is currently open on schema S of
+ ** [database connection] D so that it refers to historical [snapshot] P.
+ ** ^The [sqlite3_snapshot_open()] interface returns SQLITE_OK on success
+ ** or an appropriate [error code] if it fails.
+ **
+ ** ^In order to succeed, a call to [sqlite3_snapshot_open(D,S,P)] must be
+ ** the first operation, apart from other sqlite3_snapshot_open() calls,
+ ** following the [BEGIN] that starts a new read transaction.
+ ** ^A [snapshot] will fail to open if it has been overwritten by a 
+ ** [checkpoint].  
+ **
+ ** The [sqlite3_snapshot_open()] interface is only available when the
+ ** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
+ */
+ SQLITE_EXPERIMENTAL int sqlite3_snapshot_open(
+   sqlite3 *db,
+   const char *zSchema,
+   sqlite3_snapshot *pSnapshot
+ );
+ /*
+ ** CAPI3REF: Destroy a snapshot
+ ** EXPERIMENTAL
+ **
+ ** ^The [sqlite3_snapshot_free(P)] interface destroys [sqlite3_snapshot] P.
+ ** The application must eventually free every [sqlite3_snapshot] object
+ ** using this routine to avoid a memory leak.
+ **
+ ** The [sqlite3_snapshot_free()] interface is only available when the
+ ** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
+ */
+ SQLITE_EXPERIMENTAL void sqlite3_snapshot_free(sqlite3_snapshot*);
  /*
  ** Undo the hack that converts floating point types to integer for
  ** builds on processors without floating point support.
diff --cc src/sqliteInt.h
Simple merge
index 2e87788758eefe0d90ab09bc6c00e58ce1fb1fbb,30b421e00b693566d26a09c18afa0ba9ae970051..f712ebac63dfebde4219f69c643a55fbc840fcac
@@@ -143,12 -143,12 +143,18 @@@ static void set_options(Tcl_Interp *int
    Tcl_SetVar2(interp, "sqlite_options", "mem5", "0", TCL_GLOBAL_ONLY);
  #endif
  
 +#ifdef SQLITE_ENABLE_PREUPDATE_HOOK
 +  Tcl_SetVar2(interp, "sqlite_options", "preupdate", "1", TCL_GLOBAL_ONLY);
 +#else
 +  Tcl_SetVar2(interp, "sqlite_options", "preupdate", "0", TCL_GLOBAL_ONLY);
 +#endif
 +
+ #ifdef SQLITE_ENABLE_SNAPSHOT
+   Tcl_SetVar2(interp, "sqlite_options", "snapshot", "1", TCL_GLOBAL_ONLY);
+ #else
+   Tcl_SetVar2(interp, "sqlite_options", "snapshot", "0", TCL_GLOBAL_ONLY);
+ #endif
  #ifdef SQLITE_MUTEX_OMIT
    Tcl_SetVar2(interp, "sqlite_options", "mutex", "0", TCL_GLOBAL_ONLY);
  #else
diff --cc src/vdbe.c
Simple merge
diff --cc src/vdbeaux.c
Simple merge