Updates to the documentation for sqlite3_wal_checkpoint_v2() and related
interfaces, including adding many requirements marks. FossilOrigin-Name: 1e212d9899387344fd62c7b6fbcc59ea885b6d7c
This commit is contained in:
parent
2f89546001
commit
2d2e7bfeff
13
manifest
13
manifest
@ -1,5 +1,5 @@
|
||||
C Add\ssupport\sfor\sSQLITE_CHECKPOINT_TRUNCATE.
|
||||
D 2014-12-02T20:51:52.630
|
||||
C Updates\sto\sthe\sdocumentation\sfor\ssqlite3_wal_checkpoint_v2()\sand\srelated\ninterfaces,\sincluding\sadding\smany\srequirements\smarks.
|
||||
D 2014-12-03T15:50:09.223
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in a226317fdf3f4c895fb3cfedc355b4d0868ce1fb
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
@ -230,7 +230,7 @@ F src/resolve.c 4965007d6497b6a4d7a6d98751cc39712885f952
|
||||
F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e
|
||||
F src/select.c 428165951748151e87a15295b7357221433e311b
|
||||
F src/shell.c 45d9c9bd7cde07845af957f2d849933b990773cf
|
||||
F src/sqlite.h.in 400bac7dd1294cb902b5eb85feed1689a2623ced
|
||||
F src/sqlite.h.in 7d33b94a32b013832b53ad86be543168f87f8eb7
|
||||
F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad
|
||||
F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d
|
||||
F src/sqliteInt.h c9e95b8fa9aee30d46387735c5be73fa58886e38
|
||||
@ -1223,8 +1223,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
P 61b31e771430f490fc2c4cef55046debc4a5f4f5 6ee08769f0ffbb3d620c66b89180ece7782dc820
|
||||
R 54481572fc28e1041792401f62b71701
|
||||
T +closed 6ee08769f0ffbb3d620c66b89180ece7782dc820
|
||||
P edda2b9e7a15ed486de81b10dd9bacd39c571d3f
|
||||
R d436425f6a4681c70264f79cf1bfa41d
|
||||
U drh
|
||||
Z 2b54bfeee1d348300e5d5565430bbc39
|
||||
Z 881f6486595c3b0d62652277de190ac9
|
||||
|
@ -1 +1 @@
|
||||
edda2b9e7a15ed486de81b10dd9bacd39c571d3f
|
||||
1e212d9899387344fd62c7b6fbcc59ea885b6d7c
|
111
src/sqlite.h.in
111
src/sqlite.h.in
@ -7249,7 +7249,7 @@ int sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
|
||||
** ^The [sqlite3_wal_checkpoint(D,X)] interface initiates a
|
||||
** [sqlite3_wal_checkpoint_v2|PASSIVE] checkpoint.
|
||||
** Use the [sqlite3_wal_checkpoint_v2()] interface to get a FULL
|
||||
** or RESET checkpoint.
|
||||
** or RESET or TRUNCATE checkpoint.
|
||||
**
|
||||
** ^The [wal_checkpoint pragma] can be used to invoke this interface
|
||||
** from SQL. ^The [sqlite3_wal_autocheckpoint()] interface and the
|
||||
@ -7263,79 +7263,87 @@ int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);
|
||||
/*
|
||||
** CAPI3REF: Checkpoint a database
|
||||
**
|
||||
** Run a checkpoint operation on WAL database zDb attached to database
|
||||
** handle db. The specific operation is determined by the value of the
|
||||
** eMode parameter:
|
||||
** ^(The sqlite3_wal_checkpoint_v2(D,X,M,L,C) interface runs a checkpoint operation
|
||||
** on database X of [database connection] D in mode M. Status information is
|
||||
** written back into integers pointed to by L and C.)^ ^(The M parameter must be
|
||||
** a valid [SQLITE_CHECKPOINT_PASSIVE|checkpoint mode]:)^
|
||||
**
|
||||
** <dl>
|
||||
** <dt>SQLITE_CHECKPOINT_PASSIVE<dd>
|
||||
** Checkpoint as many frames as possible without waiting for any database
|
||||
** readers or writers to finish. Sync the db file if all frames in the log
|
||||
** are checkpointed. This mode is the same as calling
|
||||
** sqlite3_wal_checkpoint(). The [sqlite3_busy_handler|busy-handler callback]
|
||||
** is never invoked.
|
||||
** ^Checkpoint as many frames as possible without waiting for any database
|
||||
** readers or writers to finish, then sync the database file if all frames
|
||||
** in the log were checkpointed. ^This mode is the same as calling
|
||||
** [sqlite3_wal_checkpoint()]. ^The [sqlite3_busy_handler|busy-handler callback]
|
||||
** is never invoked in the SQLITE_CHECKPOINT_PASSIVE mode. ^On the other hand,
|
||||
** passive mode might leave the checkpoint unfinished if there are concurrent
|
||||
** readers or writers.
|
||||
**
|
||||
** <dt>SQLITE_CHECKPOINT_FULL<dd>
|
||||
** This mode blocks (it invokes the
|
||||
** ^This mode blocks (it invokes the
|
||||
** [sqlite3_busy_handler|busy-handler callback]) until there is no
|
||||
** database writer and all readers are reading from the most recent database
|
||||
** snapshot. It then checkpoints all frames in the log file and syncs the
|
||||
** database file. This call blocks database writers while it is running,
|
||||
** but not database readers.
|
||||
** snapshot. ^It then checkpoints all frames in the log file and syncs the
|
||||
** database file. ^This mode blocks new database writers while it is pending,
|
||||
** but new database readers are allowed to continue unimpeded.
|
||||
**
|
||||
** <dt>SQLITE_CHECKPOINT_RESTART<dd>
|
||||
** This mode works the same way as SQLITE_CHECKPOINT_FULL, except after
|
||||
** checkpointing the log file it blocks (calls the
|
||||
** ^This mode works the same way as SQLITE_CHECKPOINT_FULL with the addition
|
||||
** that after checkpointing the log file it blocks (calls the
|
||||
** [sqlite3_busy_handler|busy-handler callback])
|
||||
** until all readers are reading from the database file only. This ensures
|
||||
** that the next client to write to the database file restarts the log file
|
||||
** from the beginning. This call blocks database writers while it is running,
|
||||
** but not database readers.
|
||||
** until all readers are reading from the database file only. ^This ensures
|
||||
** that the next writer will restart the log file from the beginning.
|
||||
** ^Like SQLITE_CHECKPOINT_FULL, this mode blocks new
|
||||
** database writer attempts while it is pending, but does not impede readers.
|
||||
**
|
||||
** <dt>SQLITE_CHECKPOINT_TRUNCATE<dd>
|
||||
** This mode works the same way as SQLITE_CHECKPOINT_RESTART except that,
|
||||
** if successful, it also truncates the log file to zero bytes in size.
|
||||
** ^This mode works the same way as SQLITE_CHECKPOINT_RESTART with the addition
|
||||
** that it also truncates the log file to zero bytes just prior to a successful
|
||||
** return.
|
||||
** </dl>
|
||||
**
|
||||
** If pnLog is not NULL, then *pnLog is set to the total number of frames in
|
||||
** the log file before returning. If pnCkpt is not NULL, then *pnCkpt is set to
|
||||
** the total number of checkpointed frames (including any that were already
|
||||
** checkpointed when this function is called). *pnLog and *pnCkpt may be
|
||||
** populated even if sqlite3_wal_checkpoint_v2() returns other than SQLITE_OK.
|
||||
** If no values are available because of an error, they are both set to -1
|
||||
** before returning to communicate this to the caller.
|
||||
** ^If pnLog is not NULL, then *pnLog is set to the total number of frames in
|
||||
** the log file before returning or to -1 if the checkpoint could not run because
|
||||
** of an error or because the database is not in [WAL mode]. ^If pnCkpt is not NULL,
|
||||
** then *pnCkpt is set to the total number of checkpointed frames (including any
|
||||
** that were already checkpointed before the function was called) or to -1 if the
|
||||
** checkpoint could not run due to an error or because the database is not in
|
||||
** WAL mode.
|
||||
**
|
||||
** All calls obtain an exclusive "checkpoint" lock on the database file. If
|
||||
** ^All calls obtain an exclusive "checkpoint" lock on the database file. ^If
|
||||
** any other process is running a checkpoint operation at the same time, the
|
||||
** lock cannot be obtained and SQLITE_BUSY is returned. Even if there is a
|
||||
** lock cannot be obtained and SQLITE_BUSY is returned. ^Even if there is a
|
||||
** busy-handler configured, it will not be invoked in this case.
|
||||
**
|
||||
** The SQLITE_CHECKPOINT_FULL, RESTART and TRUNCATE modes also obtain the
|
||||
** exclusive "writer" lock on the database file. If the writer lock cannot be
|
||||
** ^The SQLITE_CHECKPOINT_FULL, RESTART and TRUNCATE modes also obtain the
|
||||
** exclusive "writer" lock on the database file. ^If the writer lock cannot be
|
||||
** obtained immediately, and a busy-handler is configured, it is invoked and
|
||||
** the writer lock retried until either the busy-handler returns 0 or the lock
|
||||
** is successfully obtained. The busy-handler is also invoked while waiting for
|
||||
** database readers as described above. If the busy-handler returns 0 before
|
||||
** is successfully obtained. ^The busy-handler is also invoked while waiting for
|
||||
** database readers as described above. ^If the busy-handler returns 0 before
|
||||
** the writer lock is obtained or while waiting for database readers, the
|
||||
** checkpoint operation proceeds from that point in the same way as
|
||||
** SQLITE_CHECKPOINT_PASSIVE - checkpointing as many frames as possible
|
||||
** without blocking any further. SQLITE_BUSY is returned in this case.
|
||||
** without blocking any further. ^SQLITE_BUSY is returned in this case.
|
||||
**
|
||||
** If parameter zDb is NULL or points to a zero length string, then the
|
||||
** specified operation is attempted on all WAL databases. In this case the
|
||||
** values written to output parameters *pnLog and *pnCkpt are undefined. If
|
||||
** ^If parameter zDb is NULL or points to a zero length string, then the
|
||||
** specified operation is attempted on all WAL databases [attached] to
|
||||
** [database connection] db. In this case the
|
||||
** values written to output parameters *pnLog and *pnCkpt are undefined. ^If
|
||||
** an SQLITE_BUSY error is encountered when processing one or more of the
|
||||
** attached WAL databases, the operation is still attempted on any remaining
|
||||
** attached databases and SQLITE_BUSY is returned to the caller. If any other
|
||||
** attached databases and SQLITE_BUSY is returned at the end. ^If any other
|
||||
** error occurs while processing an attached database, processing is abandoned
|
||||
** and the error code returned to the caller immediately. If no error
|
||||
** and the error code is returned to the caller immediately. ^If no error
|
||||
** (SQLITE_BUSY or otherwise) is encountered while processing the attached
|
||||
** databases, SQLITE_OK is returned.
|
||||
**
|
||||
** If database zDb is the name of an attached database that is not in WAL
|
||||
** mode, SQLITE_OK is returned and both *pnLog and *pnCkpt set to -1. If
|
||||
** ^If database zDb is the name of an attached database that is not in WAL
|
||||
** mode, SQLITE_OK is returned and both *pnLog and *pnCkpt set to -1. ^If
|
||||
** zDb is not NULL (or a zero length string) and is not the name of any
|
||||
** attached database, SQLITE_ERROR is returned to the caller.
|
||||
**
|
||||
** ^The [PRAGMA wal_checkpoint] command can be used to invoke this interface
|
||||
** from SQL.
|
||||
*/
|
||||
int sqlite3_wal_checkpoint_v2(
|
||||
sqlite3 *db, /* Database handle */
|
||||
@ -7346,17 +7354,18 @@ int sqlite3_wal_checkpoint_v2(
|
||||
);
|
||||
|
||||
/*
|
||||
** CAPI3REF: Checkpoint operation parameters
|
||||
** CAPI3REF: Checkpoint Mode Values
|
||||
** KEYWORDS: {checkpoint mode}
|
||||
**
|
||||
** These constants can be used as the 3rd parameter to
|
||||
** [sqlite3_wal_checkpoint_v2()]. See the [sqlite3_wal_checkpoint_v2()]
|
||||
** documentation for additional information about the meaning and use of
|
||||
** each of these values.
|
||||
** These constants define all valid values for the "checkpoint mode" passed
|
||||
** as the third parameter to the [sqlite3_wal_checkpoint_v2()] interface.
|
||||
** See the [sqlite3_wal_checkpoint_v2()] documentation for details on the
|
||||
** meaning of each of these checkpoint modes.
|
||||
*/
|
||||
#define SQLITE_CHECKPOINT_PASSIVE 0
|
||||
#define SQLITE_CHECKPOINT_FULL 1
|
||||
#define SQLITE_CHECKPOINT_RESTART 2
|
||||
#define SQLITE_CHECKPOINT_TRUNCATE 3
|
||||
#define SQLITE_CHECKPOINT_PASSIVE 0 /* Do as much as possible without blocking */
|
||||
#define SQLITE_CHECKPOINT_FULL 1 /* Wait for writers to finish, then checkpoint */
|
||||
#define SQLITE_CHECKPOINT_RESTART 2 /* Like FULL but afterwards block for readers */
|
||||
#define SQLITE_CHECKPOINT_TRUNCATE 3 /* Like RESTART but also truncate the WAL file */
|
||||
|
||||
/*
|
||||
** CAPI3REF: Virtual Table Interface Configuration
|
||||
|
Loading…
Reference in New Issue
Block a user