=1400
+-# define _CRT_RAND_S
+-#endif
+-
+-/*
+ ** Include the header file used to customize the compiler options for MSVC.
+ ** This should be done first so that it can successfully prevent spurious
+ ** compiler warnings due to subsequent content in this file and other files
+@@ -1144,15 +1154,17 @@
+ ** a string which identifies a particular check-in of SQLite
+ ** within its configuration management system. ^The SQLITE_SOURCE_ID
+ ** string contains the date and time of the check-in (UTC) and a SHA1
+-** or SHA3-256 hash of the entire source tree.
++** or SHA3-256 hash of the entire source tree. If the source code has
++** been edited in any way since it was last checked in, then the last
++** four hexadecimal digits of the hash may be modified.
+ **
+ ** See also: [sqlite3_libversion()],
+ ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
+ ** [sqlite_version()] and [sqlite_source_id()].
+ */
+-#define SQLITE_VERSION "3.20.0"
+-#define SQLITE_VERSION_NUMBER 3020000
+-#define SQLITE_SOURCE_ID "2017-08-01 13:24:15 9501e22dfeebdcefa783575e47c60b514d7c2e0cad73b2a496c0bc4b680900a8"
++#define SQLITE_VERSION "3.26.0"
++#define SQLITE_VERSION_NUMBER 3026000
++#define SQLITE_SOURCE_ID "2018-12-01 12:34:55 bf8c1b2b7a5960c282e543b9c293686dccff272512d08865f4600fb58238b4f9"
+
+ /*
+ ** CAPI3REF: Run-Time Library Version Numbers
+@@ -1168,7 +1180,7 @@
+ **
+ **
+ ** assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER );
+-** assert( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)==0 );
++** assert( strncmp(sqlite3_sourceid(),SQLITE_SOURCE_ID,80)==0 );
+ ** assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 );
+ **
)^
+ **
+@@ -1178,9 +1190,11 @@
+ ** function is provided for use in DLLs since DLL users usually do not have
+ ** direct access to string constants within the DLL. ^The
+ ** sqlite3_libversion_number() function returns an integer equal to
+-** [SQLITE_VERSION_NUMBER]. ^The sqlite3_sourceid() function returns
++** [SQLITE_VERSION_NUMBER]. ^(The sqlite3_sourceid() function returns
+ ** a pointer to a string constant whose value is the same as the
+-** [SQLITE_SOURCE_ID] C preprocessor macro.
++** [SQLITE_SOURCE_ID] C preprocessor macro. Except if SQLite is built
++** using an edited copy of [the amalgamation], then the last four characters
++** of the hash might be different from [SQLITE_SOURCE_ID].)^
+ **
+ ** See also: [sqlite_version()] and [sqlite_source_id()].
+ */
+@@ -1461,7 +1475,7 @@
+ #define SQLITE_FULL 13 /* Insertion failed because database is full */
+ #define SQLITE_CANTOPEN 14 /* Unable to open the database file */
+ #define SQLITE_PROTOCOL 15 /* Database lock protocol error */
+-#define SQLITE_EMPTY 16 /* Not used */
++#define SQLITE_EMPTY 16 /* Internal use only */
+ #define SQLITE_SCHEMA 17 /* The database schema changed */
+ #define SQLITE_TOOBIG 18 /* String or BLOB exceeds size limit */
+ #define SQLITE_CONSTRAINT 19 /* Abort due to constraint violation */
+@@ -1495,6 +1509,9 @@
+ ** the most recent error can be obtained using
+ ** [sqlite3_extended_errcode()].
+ */
++#define SQLITE_ERROR_MISSING_COLLSEQ (SQLITE_ERROR | (1<<8))
++#define SQLITE_ERROR_RETRY (SQLITE_ERROR | (2<<8))
++#define SQLITE_ERROR_SNAPSHOT (SQLITE_ERROR | (3<<8))
+ #define SQLITE_IOERR_READ (SQLITE_IOERR | (1<<8))
+ #define SQLITE_IOERR_SHORT_READ (SQLITE_IOERR | (2<<8))
+ #define SQLITE_IOERR_WRITE (SQLITE_IOERR | (3<<8))
+@@ -1523,7 +1540,11 @@
+ #define SQLITE_IOERR_CONVPATH (SQLITE_IOERR | (26<<8))
+ #define SQLITE_IOERR_VNODE (SQLITE_IOERR | (27<<8))
+ #define SQLITE_IOERR_AUTH (SQLITE_IOERR | (28<<8))
++#define SQLITE_IOERR_BEGIN_ATOMIC (SQLITE_IOERR | (29<<8))
++#define SQLITE_IOERR_COMMIT_ATOMIC (SQLITE_IOERR | (30<<8))
++#define SQLITE_IOERR_ROLLBACK_ATOMIC (SQLITE_IOERR | (31<<8))
+ #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8))
++#define SQLITE_LOCKED_VTAB (SQLITE_LOCKED | (2<<8))
+ #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8))
+ #define SQLITE_BUSY_SNAPSHOT (SQLITE_BUSY | (2<<8))
+ #define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8))
+@@ -1530,11 +1551,15 @@
+ #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8))
+ #define SQLITE_CANTOPEN_FULLPATH (SQLITE_CANTOPEN | (3<<8))
+ #define SQLITE_CANTOPEN_CONVPATH (SQLITE_CANTOPEN | (4<<8))
++#define SQLITE_CANTOPEN_DIRTYWAL (SQLITE_CANTOPEN | (5<<8)) /* Not Used */
+ #define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1<<8))
++#define SQLITE_CORRUPT_SEQUENCE (SQLITE_CORRUPT | (2<<8))
+ #define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8))
+ #define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2<<8))
+ #define SQLITE_READONLY_ROLLBACK (SQLITE_READONLY | (3<<8))
+ #define SQLITE_READONLY_DBMOVED (SQLITE_READONLY | (4<<8))
++#define SQLITE_READONLY_CANTINIT (SQLITE_READONLY | (5<<8))
++#define SQLITE_READONLY_DIRECTORY (SQLITE_READONLY | (6<<8))
+ #define SQLITE_ABORT_ROLLBACK (SQLITE_ABORT | (2<<8))
+ #define SQLITE_CONSTRAINT_CHECK (SQLITE_CONSTRAINT | (1<<8))
+ #define SQLITE_CONSTRAINT_COMMITHOOK (SQLITE_CONSTRAINT | (2<<8))
+@@ -1609,6 +1634,11 @@
+ ** SQLITE_IOCAP_IMMUTABLE flag indicates that the file is on
+ ** read-only media and cannot be changed even by processes with
+ ** elevated privileges.
++**
++** The SQLITE_IOCAP_BATCH_ATOMIC property means that the underlying
++** filesystem supports doing multiple write operations atomically when those
++** write operations are bracketed by [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] and
++** [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE].
+ */
+ #define SQLITE_IOCAP_ATOMIC 0x00000001
+ #define SQLITE_IOCAP_ATOMIC512 0x00000002
+@@ -1624,6 +1654,7 @@
+ #define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 0x00000800
+ #define SQLITE_IOCAP_POWERSAFE_OVERWRITE 0x00001000
+ #define SQLITE_IOCAP_IMMUTABLE 0x00002000
++#define SQLITE_IOCAP_BATCH_ATOMIC 0x00004000
+
+ /*
+ ** CAPI3REF: File Locking Levels
+@@ -1758,6 +1789,7 @@
+ ** [SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN]
+ ** [SQLITE_IOCAP_POWERSAFE_OVERWRITE]
+ ** [SQLITE_IOCAP_IMMUTABLE]
++** [SQLITE_IOCAP_BATCH_ATOMIC]
+ **
+ **
+ ** The SQLITE_IOCAP_ATOMIC property means that all writes of
+@@ -1895,7 +1927,8 @@
+ ** [[SQLITE_FCNTL_PERSIST_WAL]]
+ ** ^The [SQLITE_FCNTL_PERSIST_WAL] opcode is used to set or query the
+ ** persistent [WAL | Write Ahead Log] setting. By default, the auxiliary
+-** write ahead log and shared memory files used for transaction control
++** write ahead log ([WAL file]) and shared memory
++** files used for transaction control
+ ** are automatically deleted when the latest connection to the database
+ ** closes. Setting persistent WAL mode causes those files to persist after
+ ** close. Persisting the files is useful when other processes that do not
+@@ -2041,6 +2074,66 @@
+ ** The [SQLITE_FCNTL_RBU] opcode is implemented by the special VFS used by
+ ** the RBU extension only. All other VFS should return SQLITE_NOTFOUND for
+ ** this opcode.
++**
++** [[SQLITE_FCNTL_BEGIN_ATOMIC_WRITE]]
++** If the [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] opcode returns SQLITE_OK, then
++** the file descriptor is placed in "batch write mode", which
++** means all subsequent write operations will be deferred and done
++** atomically at the next [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]. Systems
++** that do not support batch atomic writes will return SQLITE_NOTFOUND.
++** ^Following a successful SQLITE_FCNTL_BEGIN_ATOMIC_WRITE and prior to
++** the closing [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] or
++** [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE], SQLite will make
++** no VFS interface calls on the same [sqlite3_file] file descriptor
++** except for calls to the xWrite method and the xFileControl method
++** with [SQLITE_FCNTL_SIZE_HINT].
++**
++** [[SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]]
++** The [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] opcode causes all write
++** operations since the previous successful call to
++** [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] to be performed atomically.
++** This file control returns [SQLITE_OK] if and only if the writes were
++** all performed successfully and have been committed to persistent storage.
++** ^Regardless of whether or not it is successful, this file control takes
++** the file descriptor out of batch write mode so that all subsequent
++** write operations are independent.
++** ^SQLite will never invoke SQLITE_FCNTL_COMMIT_ATOMIC_WRITE without
++** a prior successful call to [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE].
++**
++** [[SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE]]
++** The [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE] opcode causes all write
++** operations since the previous successful call to
++** [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] to be rolled back.
++** ^This file control takes the file descriptor out of batch write mode
++** so that all subsequent write operations are independent.
++** ^SQLite will never invoke SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE without
++** a prior successful call to [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE].
++**
++** [[SQLITE_FCNTL_LOCK_TIMEOUT]]
++** The [SQLITE_FCNTL_LOCK_TIMEOUT] opcode causes attempts to obtain
++** a file lock using the xLock or xShmLock methods of the VFS to wait
++** for up to M milliseconds before failing, where M is the single
++** unsigned integer parameter.
++**
++** [[SQLITE_FCNTL_DATA_VERSION]]
++** The [SQLITE_FCNTL_DATA_VERSION] opcode is used to detect changes to
++** a database file. The argument is a pointer to a 32-bit unsigned integer.
++** The "data version" for the pager is written into the pointer. The
++** "data version" changes whenever any change occurs to the corresponding
++** database file, either through SQL statements on the same database
++** connection or through transactions committed by separate database
++** connections possibly in other processes. The [sqlite3_total_changes()]
++** interface can be used to find if any database on the connection has changed,
++** but that interface responds to changes on TEMP as well as MAIN and does
++** not provide a mechanism to detect changes to MAIN only. Also, the
++** [sqlite3_total_changes()] interface responds to internal changes only and
++** omits changes made by other database connections. The
++** [PRAGMA data_version] command provide a mechanism to detect changes to
++** a single attached database that occur due to other database connections,
++** but omits changes implemented by the database connection on which it is
++** called. This file control is the only mechanism to detect changes that
++** happen either internally or externally and that are associated with
++** a particular attached database.
+ **
+ */
+ #define SQLITE_FCNTL_LOCKSTATE 1
+@@ -2072,6 +2165,11 @@
+ #define SQLITE_FCNTL_JOURNAL_POINTER 28
+ #define SQLITE_FCNTL_WIN32_GET_HANDLE 29
+ #define SQLITE_FCNTL_PDB 30
++#define SQLITE_FCNTL_BEGIN_ATOMIC_WRITE 31
++#define SQLITE_FCNTL_COMMIT_ATOMIC_WRITE 32
++#define SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE 33
++#define SQLITE_FCNTL_LOCK_TIMEOUT 34
++#define SQLITE_FCNTL_DATA_VERSION 35
+
+ /* deprecated names */
+ #define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
+@@ -2109,12 +2207,18 @@
+ ** in the name of the object stands for "virtual file system". See
+ ** the [VFS | VFS documentation] for further information.
+ **
+-** The value of the iVersion field is initially 1 but may be larger in
+-** future versions of SQLite. Additional fields may be appended to this
+-** object when the iVersion value is increased. Note that the structure
+-** of the sqlite3_vfs object changes in the transaction between
+-** SQLite version 3.5.9 and 3.6.0 and yet the iVersion field was not
+-** modified.
++** The VFS interface is sometimes extended by adding new methods onto
++** the end. Each time such an extension occurs, the iVersion field
++** is incremented. The iVersion value started out as 1 in
++** SQLite [version 3.5.0] on [dateof:3.5.0], then increased to 2
++** with SQLite [version 3.7.0] on [dateof:3.7.0], and then increased
++** to 3 with SQLite [version 3.7.6] on [dateof:3.7.6]. Additional fields
++** may be appended to the sqlite3_vfs object and the iVersion value
++** may increase again in future versions of SQLite.
++** Note that the structure
++** of the sqlite3_vfs object changes in the transition from
++** SQLite [version 3.5.9] to [version 3.6.0] on [dateof:3.6.0]
++** and yet the iVersion field was not modified.
+ **
+ ** The szOsFile field is the size of the subclassed [sqlite3_file]
+ ** structure used by this VFS. mxPathname is the maximum length of
+@@ -2642,6 +2746,16 @@
+ ** routines with a wrapper that simulations memory allocation failure or
+ ** tracks memory usage, for example.
+ **
++** [[SQLITE_CONFIG_SMALL_MALLOC]] SQLITE_CONFIG_SMALL_MALLOC
++** ^The SQLITE_CONFIG_SMALL_MALLOC option takes single argument of
++** type int, interpreted as a boolean, which if true provides a hint to
++** SQLite that it should avoid large memory allocations if possible.
++** SQLite will run faster if it is free to make large memory allocations,
++** but some application might prefer to run slower in exchange for
++** guarantees about memory fragmentation that are possible if large
++** allocations are avoided. This hint is normally off.
++**
++**
+ ** [[SQLITE_CONFIG_MEMSTATUS]] SQLITE_CONFIG_MEMSTATUS
+ ** ^The SQLITE_CONFIG_MEMSTATUS option takes single argument of type int,
+ ** interpreted as a boolean, which enables or disables the collection of
+@@ -2659,25 +2773,7 @@
+ **
+ **
+ ** [[SQLITE_CONFIG_SCRATCH]] SQLITE_CONFIG_SCRATCH
+-** ^The SQLITE_CONFIG_SCRATCH option specifies a static memory buffer
+-** that SQLite can use for scratch memory. ^(There are three arguments
+-** to SQLITE_CONFIG_SCRATCH: A pointer an 8-byte
+-** aligned memory buffer from which the scratch allocations will be
+-** drawn, the size of each scratch allocation (sz),
+-** and the maximum number of scratch allocations (N).)^
+-** The first argument must be a pointer to an 8-byte aligned buffer
+-** of at least sz*N bytes of memory.
+-** ^SQLite will not use more than one scratch buffers per thread.
+-** ^SQLite will never request a scratch buffer that is more than 6
+-** times the database page size.
+-** ^If SQLite needs needs additional
+-** scratch memory beyond what is provided by this configuration option, then
+-** [sqlite3_malloc()] will be used to obtain the memory needed.
+-** ^When the application provides any amount of scratch memory using
+-** SQLITE_CONFIG_SCRATCH, SQLite avoids unnecessary large
+-** [sqlite3_malloc|heap allocations].
+-** This can help [Robson proof|prevent memory allocation failures] due to heap
+-** fragmentation in low-memory embedded systems.
++**
The SQLITE_CONFIG_SCRATCH option is no longer used.
+ **
+ **
+ ** [[SQLITE_CONFIG_PAGECACHE]] SQLITE_CONFIG_PAGECACHE
+@@ -2713,8 +2809,7 @@
+ ** [[SQLITE_CONFIG_HEAP]] SQLITE_CONFIG_HEAP
+ ** ^The SQLITE_CONFIG_HEAP option specifies a static memory buffer
+ ** that SQLite will use for all of its dynamic memory allocation needs
+-** beyond those provided for by [SQLITE_CONFIG_SCRATCH] and
+-** [SQLITE_CONFIG_PAGECACHE].
++** beyond those provided for by [SQLITE_CONFIG_PAGECACHE].
+ ** ^The SQLITE_CONFIG_HEAP option is only available if SQLite is compiled
+ ** with either [SQLITE_ENABLE_MEMSYS3] or [SQLITE_ENABLE_MEMSYS5] and returns
+ ** [SQLITE_ERROR] if invoked otherwise.
+@@ -2900,6 +2995,22 @@
+ ** I/O required to support statement rollback.
+ ** The default value for this setting is controlled by the
+ ** [SQLITE_STMTJRNL_SPILL] compile-time option.
++**
++** [[SQLITE_CONFIG_SORTERREF_SIZE]]
++** SQLITE_CONFIG_SORTERREF_SIZE
++** The SQLITE_CONFIG_SORTERREF_SIZE option accepts a single parameter
++** of type (int) - the new value of the sorter-reference size threshold.
++** Usually, when SQLite uses an external sort to order records according
++** to an ORDER BY clause, all fields required by the caller are present in the
++** sorted records. However, if SQLite determines based on the declared type
++** of a table column that its values are likely to be very large - larger
++** than the configured sorter-reference size threshold - then a reference
++** is stored in each sorted record and the required column values loaded
++** from the database as records are returned in sorted order. The default
++** value for this option is to never use this optimization. Specifying a
++** negative value for this option restores the default behaviour.
++** This option is only available if SQLite is compiled with the
++** [SQLITE_ENABLE_SORTER_REFERENCES] compile-time option.
+ **
+ */
+ #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
+@@ -2907,7 +3018,7 @@
+ #define SQLITE_CONFIG_SERIALIZED 3 /* nil */
+ #define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */
+ #define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */
+-#define SQLITE_CONFIG_SCRATCH 6 /* void*, int sz, int N */
++#define SQLITE_CONFIG_SCRATCH 6 /* No longer used */
+ #define SQLITE_CONFIG_PAGECACHE 7 /* void*, int sz, int N */
+ #define SQLITE_CONFIG_HEAP 8 /* void*, int nByte, int min */
+ #define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */
+@@ -2928,6 +3039,8 @@
+ #define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */
+ #define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */
+ #define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */
++#define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */
++#define SQLITE_CONFIG_SORTERREF_SIZE 28 /* int nByte */
+
+ /*
+ ** CAPI3REF: Database Connection Configuration Options
+@@ -2943,6 +3056,7 @@
+ ** is invoked.
+ **
+ **
++** [[SQLITE_DBCONFIG_LOOKASIDE]]
+ ** - SQLITE_DBCONFIG_LOOKASIDE
+ ** - ^This option takes three additional arguments that determine the
+ ** [lookaside memory allocator] configuration for the [database connection].
+@@ -2965,6 +3079,7 @@
+ ** memory is in use leaves the configuration unchanged and returns
+ ** [SQLITE_BUSY].)^
+ **
++** [[SQLITE_DBCONFIG_ENABLE_FKEY]]
+ ** - SQLITE_DBCONFIG_ENABLE_FKEY
+ ** - ^This option is used to enable or disable the enforcement of
+ ** [foreign key constraints]. There should be two additional arguments.
+@@ -2975,6 +3090,7 @@
+ ** following this call. The second parameter may be a NULL pointer, in
+ ** which case the FK enforcement setting is not reported back.
+ **
++** [[SQLITE_DBCONFIG_ENABLE_TRIGGER]]
+ ** - SQLITE_DBCONFIG_ENABLE_TRIGGER
+ ** - ^This option is used to enable or disable [CREATE TRIGGER | triggers].
+ ** There should be two additional arguments.
+@@ -2985,6 +3101,7 @@
+ ** following this call. The second parameter may be a NULL pointer, in
+ ** which case the trigger setting is not reported back.
+ **
++** [[SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER]]
+ ** - SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER
+ ** - ^This option is used to enable or disable the two-argument
+ ** version of the [fts3_tokenizer()] function which is part of the
+@@ -2998,6 +3115,7 @@
+ ** following this call. The second parameter may be a NULL pointer, in
+ ** which case the new setting is not reported back.
+ **
++** [[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION]]
+ ** - SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION
+ ** - ^This option is used to enable or disable the [sqlite3_load_extension()]
+ ** interface independently of the [load_extension()] SQL function.
+@@ -3015,7 +3133,7 @@
+ ** be a NULL pointer, in which case the new setting is not reported back.
+ **
+ **
+-** - SQLITE_DBCONFIG_MAINDBNAME
++** [[SQLITE_DBCONFIG_MAINDBNAME]] - SQLITE_DBCONFIG_MAINDBNAME
+ ** - ^This option is used to change the name of the "main" database
+ ** schema. ^The sole argument is a pointer to a constant UTF8 string
+ ** which will become the new schema name in place of "main". ^SQLite
+@@ -3024,6 +3142,7 @@
+ ** until after the database connection closes.
+ **
+ **
++** [[SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE]]
+ ** - SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE
+ ** - Usually, when a database in wal mode is closed or detached from a
+ ** database handle, SQLite checks if this will mean that there are now no
+@@ -3030,13 +3149,14 @@
+ ** connections at all to the database. If so, it performs a checkpoint
+ ** operation before closing the connection. This option may be used to
+ ** override this behaviour. The first parameter passed to this operation
+-** is an integer - non-zero to disable checkpoints-on-close, or zero (the
+-** default) to enable them. The second parameter is a pointer to an integer
++** is an integer - positive to disable checkpoints-on-close, or zero (the
++** default) to enable them, and negative to leave the setting unchanged.
++** The second parameter is a pointer to an integer
+ ** into which is written 0 or 1 to indicate whether checkpoints-on-close
+ ** have been disabled - 0 if they are not disabled, 1 if they are.
+ **
+ **
+-** - SQLITE_DBCONFIG_ENABLE_QPSG
++** [[SQLITE_DBCONFIG_ENABLE_QPSG]] - SQLITE_DBCONFIG_ENABLE_QPSG
+ ** - ^(The SQLITE_DBCONFIG_ENABLE_QPSG option activates or deactivates
+ ** the [query planner stability guarantee] (QPSG). When the QPSG is active,
+ ** a single SQL query statement will always use the same algorithm regardless
+@@ -3045,8 +3165,57 @@
+ ** slower. But the QPSG has the advantage of more predictable behavior. With
+ ** the QPSG active, SQLite will always use the same query plan in the field as
+ ** was used during testing in the lab.
++** The first argument to this setting is an integer which is 0 to disable
++** the QPSG, positive to enable QPSG, or negative to leave the setting
++** unchanged. The second parameter is a pointer to an integer into which
++** is written 0 or 1 to indicate whether the QPSG is disabled or enabled
++** following this call.
+ **
+ **
++** [[SQLITE_DBCONFIG_TRIGGER_EQP]] - SQLITE_DBCONFIG_TRIGGER_EQP
++** - By default, the output of EXPLAIN QUERY PLAN commands does not
++** include output for any operations performed by trigger programs. This
++** option is used to set or clear (the default) a flag that governs this
++** behavior. The first parameter passed to this operation is an integer -
++** positive to enable output for trigger programs, or zero to disable it,
++** or negative to leave the setting unchanged.
++** The second parameter is a pointer to an integer into which is written
++** 0 or 1 to indicate whether output-for-triggers has been disabled - 0 if
++** it is not disabled, 1 if it is.
++**
++**
++** [[SQLITE_DBCONFIG_RESET_DATABASE]] - SQLITE_DBCONFIG_RESET_DATABASE
++** - Set the SQLITE_DBCONFIG_RESET_DATABASE flag and then run
++** [VACUUM] in order to reset a database back to an empty database
++** with no schema and no content. The following process works even for
++** a badly corrupted database file:
++**
++** - If the database connection is newly opened, make sure it has read the
++** database schema by preparing then discarding some query against the
++** database, or calling sqlite3_table_column_metadata(), ignoring any
++** errors. This step is only necessary if the application desires to keep
++** the database in WAL mode after the reset if it was in WAL mode before
++** the reset.
++**
- sqlite3_db_config(db, SQLITE_DBCONFIG_RESET_DATABASE, 1, 0);
++**
- [sqlite3_exec](db, "[VACUUM]", 0, 0, 0);
++**
- sqlite3_db_config(db, SQLITE_DBCONFIG_RESET_DATABASE, 0, 0);
++**
++** Because resetting a database is destructive and irreversible, the
++** process requires the use of this obscure API and multiple steps to help
++** ensure that it does not happen by accident.
++**
++** [[SQLITE_DBCONFIG_DEFENSIVE]] - SQLITE_DBCONFIG_DEFENSIVE
++** - The SQLITE_DBCONFIG_DEFENSIVE option activates or deactivates the
++** "defensive" flag for a database connection. When the defensive
++** flag is enabled, language features that allow ordinary SQL to
++** deliberately corrupt the database file are disabled. The disabled
++** features include but are not limited to the following:
++**
++** - The [PRAGMA writable_schema=ON] statement.
++**
- Writes to the [sqlite_dbpage] virtual table.
++**
- Direct writes to [shadow tables].
++**
++**
+ **
+ */
+ #define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */
+@@ -3057,8 +3226,11 @@
+ #define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005 /* int int* */
+ #define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE 1006 /* int int* */
+ #define SQLITE_DBCONFIG_ENABLE_QPSG 1007 /* int int* */
++#define SQLITE_DBCONFIG_TRIGGER_EQP 1008 /* int int* */
++#define SQLITE_DBCONFIG_RESET_DATABASE 1009 /* int int* */
++#define SQLITE_DBCONFIG_DEFENSIVE 1010 /* int int* */
++#define SQLITE_DBCONFIG_MAX 1010 /* Largest DBCONFIG */
+
+-
+ /*
+ ** CAPI3REF: Enable Or Disable Extended Result Codes
+ ** METHOD: sqlite3
+@@ -3185,12 +3357,17 @@
+ ** program, the value returned reflects the number of rows modified by the
+ ** previous INSERT, UPDATE or DELETE statement within the same trigger.
+ **
+-** See also the [sqlite3_total_changes()] interface, the
+-** [count_changes pragma], and the [changes() SQL function].
+-**
+ ** If a separate thread makes changes on the same database connection
+ ** while [sqlite3_changes()] is running then the value returned
+ ** is unpredictable and not meaningful.
++**
++** See also:
++**
++** - the [sqlite3_total_changes()] interface
++**
- the [count_changes pragma]
++**
- the [changes() SQL function]
++**
- the [data_version pragma]
++**
+ */
+ SQLITE_API int sqlite3_changes(sqlite3*);
+
+@@ -3208,13 +3385,26 @@
+ ** count, but those made as part of REPLACE constraint resolution are
+ ** not. ^Changes to a view that are intercepted by INSTEAD OF triggers
+ ** are not counted.
++**
++** This the [sqlite3_total_changes(D)] interface only reports the number
++** of rows that changed due to SQL statement run against database
++** connection D. Any changes by other database connections are ignored.
++** To detect changes against a database file from other database
++** connections use the [PRAGMA data_version] command or the
++** [SQLITE_FCNTL_DATA_VERSION] [file control].
+ **
+-** See also the [sqlite3_changes()] interface, the
+-** [count_changes pragma], and the [total_changes() SQL function].
+-**
+ ** If a separate thread makes changes on the same database connection
+ ** while [sqlite3_total_changes()] is running then the value
+ ** returned is unpredictable and not meaningful.
++**
++** See also:
++**
++** - the [sqlite3_changes()] interface
++**
- the [count_changes pragma]
++**
- the [changes() SQL function]
++**
- the [data_version pragma]
++**
- the [SQLITE_FCNTL_DATA_VERSION] [file control]
++**
+ */
+ SQLITE_API int sqlite3_total_changes(sqlite3*);
+
+@@ -3463,16 +3653,16 @@
+ **
+ ** These routines are work-alikes of the "printf()" family of functions
+ ** from the standard C library.
+-** These routines understand most of the common K&R formatting options,
+-** plus some additional non-standard formats, detailed below.
+-** Note that some of the more obscure formatting options from recent
+-** C-library standards are omitted from this implementation.
++** These routines understand most of the common formatting options from
++** the standard library printf()
++** plus some additional non-standard formats ([%q], [%Q], [%w], and [%z]).
++** See the [built-in printf()] documentation for details.
+ **
+ ** ^The sqlite3_mprintf() and sqlite3_vmprintf() routines write their
+-** results into memory obtained from [sqlite3_malloc()].
++** results into memory obtained from [sqlite3_malloc64()].
+ ** The strings returned by these two routines should be
+ ** released by [sqlite3_free()]. ^Both routines return a
+-** NULL pointer if [sqlite3_malloc()] is unable to allocate enough
++** NULL pointer if [sqlite3_malloc64()] is unable to allocate enough
+ ** memory to hold the resulting string.
+ **
+ ** ^(The sqlite3_snprintf() routine is similar to "snprintf()" from
+@@ -3496,71 +3686,7 @@
+ **
+ ** ^The sqlite3_vsnprintf() routine is a varargs version of sqlite3_snprintf().
+ **
+-** These routines all implement some additional formatting
+-** options that are useful for constructing SQL statements.
+-** All of the usual printf() formatting options apply. In addition, there
+-** is are "%q", "%Q", "%w" and "%z" options.
+-**
+-** ^(The %q option works like %s in that it substitutes a nul-terminated
+-** string from the argument list. But %q also doubles every '\'' character.
+-** %q is designed for use inside a string literal.)^ By doubling each '\''
+-** character it escapes that character and allows it to be inserted into
+-** the string.
+-**
+-** For example, assume the string variable zText contains text as follows:
+-**
+-**
+-** char *zText = "It's a happy day!";
+-**
+-**
+-** One can use this text in an SQL statement as follows:
+-**
+-**
+-** char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES('%q')", zText);
+-** sqlite3_exec(db, zSQL, 0, 0, 0);
+-** sqlite3_free(zSQL);
+-**
+-**
+-** Because the %q format string is used, the '\'' character in zText
+-** is escaped and the SQL generated is as follows:
+-**
+-**
+-** INSERT INTO table1 VALUES('It''s a happy day!')
+-**
+-**
+-** This is correct. Had we used %s instead of %q, the generated SQL
+-** would have looked like this:
+-**
+-**
+-** INSERT INTO table1 VALUES('It's a happy day!');
+-**
+-**
+-** This second example is an SQL syntax error. As a general rule you should
+-** always use %q instead of %s when inserting text into a string literal.
+-**
+-** ^(The %Q option works like %q except it also adds single quotes around
+-** the outside of the total string. Additionally, if the parameter in the
+-** argument list is a NULL pointer, %Q substitutes the text "NULL" (without
+-** single quotes).)^ So, for example, one could say:
+-**
+-**
+-** char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES(%Q)", zText);
+-** sqlite3_exec(db, zSQL, 0, 0, 0);
+-** sqlite3_free(zSQL);
+-**
+-**
+-** The code above will render a correct SQL statement in the zSQL
+-** variable even if the zText variable is a NULL pointer.
+-**
+-** ^(The "%w" formatting option is like "%q" except that it expects to
+-** be contained within double-quotes instead of single quotes, and it
+-** escapes the double-quote character instead of the single-quote
+-** character.)^ The "%w" formatting option is intended for safely inserting
+-** table and column names into a constructed SQL statement.
+-**
+-** ^(The "%z" formatting option works like "%s" but with the
+-** addition that after the string has been read and copied into
+-** the result, [sqlite3_free()] is called on the input string.)^
++** See also: [built-in printf()], [printf() SQL function]
+ */
+ SQLITE_API char *sqlite3_mprintf(const char*,...);
+ SQLITE_API char *sqlite3_vmprintf(const char*, va_list);
+@@ -3918,8 +4044,8 @@
+ ** KEYWORDS: SQLITE_TRACE
+ **
+ ** These constants identify classes of events that can be monitored
+-** using the [sqlite3_trace_v2()] tracing logic. The third argument
+-** to [sqlite3_trace_v2()] is an OR-ed combination of one or more of
++** using the [sqlite3_trace_v2()] tracing logic. The M argument
++** to [sqlite3_trace_v2(D,M,X,P)] is an OR-ed combination of one or more of
+ ** the following constants. ^The first argument to the trace callback
+ ** is one of the following constants.
+ **
+@@ -4128,10 +4254,10 @@
+ ** ^If [URI filename] interpretation is enabled, and the filename argument
+ ** begins with "file:", then the filename is interpreted as a URI. ^URI
+ ** filename interpretation is enabled if the [SQLITE_OPEN_URI] flag is
+-** set in the fourth argument to sqlite3_open_v2(), or if it has
++** set in the third argument to sqlite3_open_v2(), or if it has
+ ** been enabled globally using the [SQLITE_CONFIG_URI] option with the
+ ** [sqlite3_config()] method or by the [SQLITE_USE_URI] compile-time option.
+-** As of SQLite version 3.7.7, URI filename interpretation is turned off
++** URI filename interpretation is turned off
+ ** by default, but future releases of SQLite might enable URI filename
+ ** interpretation by default. See "[URI filenames]" for additional
+ ** information.
+@@ -4334,13 +4460,24 @@
+ ** [database connection] D failed, then the sqlite3_errcode(D) interface
+ ** returns the numeric [result code] or [extended result code] for that
+ ** API call.
+-** If the most recent API call was successful,
+-** then the return value from sqlite3_errcode() is undefined.
+ ** ^The sqlite3_extended_errcode()
+ ** interface is the same except that it always returns the
+ ** [extended result code] even when extended result codes are
+ ** disabled.
+ **
++** The values returned by sqlite3_errcode() and/or
++** sqlite3_extended_errcode() might change with each API call.
++** Except, there are some interfaces that are guaranteed to never
++** change the value of the error code. The error-code preserving
++** interfaces are:
++**
++**
++** - sqlite3_errcode()
++**
- sqlite3_extended_errcode()
++**
- sqlite3_errmsg()
++**
- sqlite3_errmsg16()
++**
++**
+ ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
+ ** text that describes the error, as either UTF-8 or UTF-16 respectively.
+ ** ^(Memory to hold the error message string is managed internally.
+@@ -4530,9 +4667,19 @@
+ ** on this hint by avoiding the use of [lookaside memory] so as not to
+ ** deplete the limited store of lookaside memory. Future versions of
+ ** SQLite may act on this hint differently.
++**
++** [[SQLITE_PREPARE_NORMALIZE]] ^(SQLITE_PREPARE_NORMALIZE
++** The SQLITE_PREPARE_NORMALIZE flag indicates that a normalized
++** representation of the SQL statement should be calculated and then
++** associated with the prepared statement, which can be obtained via
++** the [sqlite3_normalized_sql()] interface.)^ The semantics used to
++** normalize a SQL statement are unspecified and subject to change.
++** At a minimum, literal values will be replaced with suitable
++** placeholders.
+ **
+ */
+ #define SQLITE_PREPARE_PERSISTENT 0x01
++#define SQLITE_PREPARE_NORMALIZE 0x02
+
+ /*
+ ** CAPI3REF: Compiling An SQL Statement
+@@ -4626,6 +4773,7 @@
+ ** or [GLOB] operator or if the parameter is compared to an indexed column
+ ** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled.
+ **
++**
+ **
+ ** ^sqlite3_prepare_v3() differs from sqlite3_prepare_v2() only in having
+ ** the extra prepFlags parameter, which is a bit array consisting of zero or
+@@ -4632,7 +4780,6 @@
+ ** more of the [SQLITE_PREPARE_PERSISTENT|SQLITE_PREPARE_*] flags. ^The
+ ** sqlite3_prepare_v2() interface works exactly the same as
+ ** sqlite3_prepare_v3() with a zero prepFlags parameter.
+-**
+ */
+ SQLITE_API int sqlite3_prepare(
+ sqlite3 *db, /* Database handle */
+@@ -4690,6 +4837,11 @@
+ ** ^The sqlite3_expanded_sql(P) interface returns a pointer to a UTF-8
+ ** string containing the SQL text of prepared statement P with
+ ** [bound parameters] expanded.
++** ^The sqlite3_normalized_sql(P) interface returns a pointer to a UTF-8
++** string containing the normalized SQL text of prepared statement P. The
++** semantics used to normalize a SQL statement are unspecified and subject
++** to change. At a minimum, literal values will be replaced with suitable
++** placeholders.
+ **
+ ** ^(For example, if a prepared statement is created using the SQL
+ ** text "SELECT $abc,:xyz" and if parameter $abc is bound to integer 2345
+@@ -4705,8 +4857,9 @@
+ ** bound parameter expansions. ^The [SQLITE_OMIT_TRACE] compile-time
+ ** option causes sqlite3_expanded_sql() to always return NULL.
+ **
+-** ^The string returned by sqlite3_sql(P) is managed by SQLite and is
+-** automatically freed when the prepared statement is finalized.
++** ^The strings returned by sqlite3_sql(P) and sqlite3_normalized_sql(P)
++** are managed by SQLite and are automatically freed when the prepared
++** statement is finalized.
+ ** ^The string returned by sqlite3_expanded_sql(P), on the other hand,
+ ** is obtained from [sqlite3_malloc()] and must be free by the application
+ ** by passing it to [sqlite3_free()].
+@@ -4713,6 +4866,7 @@
+ */
+ SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt);
+ SQLITE_API char *sqlite3_expanded_sql(sqlite3_stmt *pStmt);
++SQLITE_API const char *sqlite3_normalized_sql(sqlite3_stmt *pStmt);
+
+ /*
+ ** CAPI3REF: Determine If An SQL Statement Writes The Database
+@@ -4805,8 +4959,9 @@
+ ** implementation of [application-defined SQL functions] are protected.
+ ** ^The sqlite3_value object returned by
+ ** [sqlite3_column_value()] is unprotected.
+-** Unprotected sqlite3_value objects may only be used with
+-** [sqlite3_result_value()] and [sqlite3_bind_value()].
++** Unprotected sqlite3_value objects may only be used as arguments
++** to [sqlite3_result_value()], [sqlite3_bind_value()], and
++** [sqlite3_value_dup()].
+ ** The [sqlite3_value_blob | sqlite3_value_type()] family of
+ ** interfaces require protected sqlite3_value objects.
+ */
+@@ -5228,7 +5383,7 @@
+ ** other than [SQLITE_ROW] before any subsequent invocation of
+ ** sqlite3_step(). Failure to reset the prepared statement using
+ ** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from
+-** sqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1]),
++** sqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1],
+ ** sqlite3_step() began
+ ** calling [sqlite3_reset()] automatically in this circumstance rather
+ ** than returning [SQLITE_MISUSE]. This is not considered a compatibility
+@@ -5493,11 +5648,25 @@
+ ** from [sqlite3_column_blob()], [sqlite3_column_text()], etc. into
+ ** [sqlite3_free()].
+ **
+-** ^(If a memory allocation error occurs during the evaluation of any
+-** of these routines, a default value is returned. The default value
+-** is either the integer 0, the floating point number 0.0, or a NULL
+-** pointer. Subsequent calls to [sqlite3_errcode()] will return
+-** [SQLITE_NOMEM].)^
++** As long as the input parameters are correct, these routines will only
++** fail if an out-of-memory error occurs during a format conversion.
++** Only the following subset of interfaces are subject to out-of-memory
++** errors:
++**
++**
++** - sqlite3_column_blob()
++**
- sqlite3_column_text()
++**
- sqlite3_column_text16()
++**
- sqlite3_column_bytes()
++**
- sqlite3_column_bytes16()
++**
++**
++** If an out-of-memory error occurs, then the return value from these
++** routines is the same as if the column had contained an SQL NULL value.
++** Valid SQL NULL returns can be distinguished from out-of-memory errors
++** by invoking the [sqlite3_errcode()] immediately after the suspect
++** return value is obtained and before any
++** other SQLite interface is called on the same [database connection].
+ */
+ SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol);
+ SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol);
+@@ -5574,11 +5743,13 @@
+ **
+ ** ^These functions (collectively known as "function creation routines")
+ ** are used to add SQL functions or aggregates or to redefine the behavior
+-** of existing SQL functions or aggregates. The only differences between
+-** these routines are the text encoding expected for
+-** the second parameter (the name of the function being created)
+-** and the presence or absence of a destructor callback for
+-** the application data pointer.
++** of existing SQL functions or aggregates. The only differences between
++** the three "sqlite3_create_function*" routines are the text encoding
++** expected for the second parameter (the name of the function being
++** created) and the presence or absence of a destructor callback for
++** the application data pointer. Function sqlite3_create_window_function()
++** is similar, but allows the user to supply the extra callback functions
++** needed by [aggregate window functions].
+ **
+ ** ^The first parameter is the [database connection] to which the SQL
+ ** function is to be added. ^If an application uses more than one database
+@@ -5624,7 +5795,8 @@
+ ** ^(The fifth parameter is an arbitrary pointer. The implementation of the
+ ** function can gain access to this pointer using [sqlite3_user_data()].)^
+ **
+-** ^The sixth, seventh and eighth parameters, xFunc, xStep and xFinal, are
++** ^The sixth, seventh and eighth parameters passed to the three
++** "sqlite3_create_function*" functions, xFunc, xStep and xFinal, are
+ ** pointers to C-language functions that implement the SQL function or
+ ** aggregate. ^A scalar SQL function requires an implementation of the xFunc
+ ** callback only; NULL pointers must be passed as the xStep and xFinal
+@@ -5633,16 +5805,25 @@
+ ** SQL function or aggregate, pass NULL pointers for all three function
+ ** callbacks.
+ **
+-** ^(If the ninth parameter to sqlite3_create_function_v2() is not NULL,
+-** then it is destructor for the application data pointer.
+-** The destructor is invoked when the function is deleted, either by being
+-** overloaded or when the database connection closes.)^
+-** ^The destructor is also invoked if the call to
+-** sqlite3_create_function_v2() fails.
+-** ^When the destructor callback of the tenth parameter is invoked, it
+-** is passed a single argument which is a copy of the application data
+-** pointer which was the fifth parameter to sqlite3_create_function_v2().
++** ^The sixth, seventh, eighth and ninth parameters (xStep, xFinal, xValue
++** and xInverse) passed to sqlite3_create_window_function are pointers to
++** C-language callbacks that implement the new function. xStep and xFinal
++** must both be non-NULL. xValue and xInverse may either both be NULL, in
++** which case a regular aggregate function is created, or must both be
++** non-NULL, in which case the new function may be used as either an aggregate
++** or aggregate window function. More details regarding the implementation
++** of aggregate window functions are
++** [user-defined window functions|available here].
+ **
++** ^(If the final parameter to sqlite3_create_function_v2() or
++** sqlite3_create_window_function() is not NULL, then it is destructor for
++** the application data pointer. The destructor is invoked when the function
++** is deleted, either by being overloaded or when the database connection
++** closes.)^ ^The destructor is also invoked if the call to
++** sqlite3_create_function_v2() fails. ^When the destructor callback is
++** invoked, it is passed a single argument which is a copy of the application
++** data pointer which was the fifth parameter to sqlite3_create_function_v2().
++**
+ ** ^It is permitted to register multiple implementations of the same
+ ** functions with the same name but with either differing numbers of
+ ** arguments or differing preferred text encodings. ^SQLite will use
+@@ -5694,6 +5875,18 @@
+ void (*xFinal)(sqlite3_context*),
+ void(*xDestroy)(void*)
+ );
++SQLITE_API int sqlite3_create_window_function(
++ sqlite3 *db,
++ const char *zFunctionName,
++ int nArg,
++ int eTextRep,
++ void *pApp,
++ void (*xStep)(sqlite3_context*,int,sqlite3_value**),
++ void (*xFinal)(sqlite3_context*),
++ void (*xValue)(sqlite3_context*),
++ void (*xInverse)(sqlite3_context*,int,sqlite3_value**),
++ void(*xDestroy)(void*)
++);
+
+ /*
+ ** CAPI3REF: Text Encodings
+@@ -5764,6 +5957,9 @@
+ ** datatype of the value
+ ** sqlite3_value_numeric_type
+ ** | → | Best numeric datatype of the value
++** |
sqlite3_value_nochange
++** | → | True if the column is unchanged in an UPDATE
++** against a virtual table.
+ ** |