1.Dd March 11, 2017 2.Dt SQLITE3_SNAPSHOT_OPEN 3 3.Os 4.Sh NAME 5.Nm sqlite3_snapshot_open 6.Nd Start a read transaction on an historical snapshot 7.Sh SYNOPSIS 8.Ft int 9.Fo sqlite3_snapshot_open 10.Fa "sqlite3 *db" 11.Fa "const char *zSchema" 12.Fa "sqlite3_snapshot *pSnapshot " 13.Fc 14.Sh DESCRIPTION 15The sqlite3_snapshot_open(D,S,P) interface 16starts a read transaction for schema S of database connection 17D such that the read transaction refers to historical snapshot 18P, rather than the most recent change to the database. 19The sqlite3_snapshot_open() interface returns 20SQLITE_OK on success or an appropriate error code if it fails. 21.Pp 22In order to succeed, a call to sqlite3_snapshot_open(D,S,P) 23must be the first operation following the BEGIN that takes the 24schema S out of autocommit mode. 25In other words, schema S must not currently be in a transaction for 26sqlite3_snapshot_open(D,S,P) to work, but 27the database connection D must be out of autocommit mode. 28A snapshot will fail to open if it has been overwritten by 29a checkpoint. 30A call to sqlite3_snapshot_open(D,S,P) 31will fail if the database connection D does not know that the database 32file for schema S is in WAL mode. 33A database connection might not know that the database file is in WAL mode 34if there has been no prior I/O on that database connection, or if the 35database entered WAL mode after the most recent I/O on the 36database connection. 37(Hint: Run "PRAGMA application_id" against a newly 38opened database connection in order to make it ready to use snapshots.) 39.Pp 40The sqlite3_snapshot_open() interface is only 41available when the SQLITE_ENABLE_SNAPSHOT compile-time option is used. 42.Sh SEE ALSO 43.Xr sqlite3_get_autocommit 3 , 44.Xr sqlite3 3 , 45.Xr sqlite3_snapshot 3 , 46.Xr sqlite3_snapshot_open 3 47