Merge pull request #1073 from link2xt/bundled-sqlcipher-4.5.0

Upgrade bundled SQLCipher to 4.5.0
This commit is contained in:
gwenn 2022-01-04 18:46:12 +01:00 committed by GitHub
commit 3e57bf4567
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9687 additions and 5692 deletions

View File

@ -1,9 +1,9 @@
/* automatically generated by rust-bindgen 0.58.1 */ /* automatically generated by rust-bindgen 0.59.2 */
pub const SQLITE_VERSION: &'static [u8; 7usize] = b"3.34.1\0"; pub const SQLITE_VERSION: &[u8; 7usize] = b"3.36.0\0";
pub const SQLITE_VERSION_NUMBER: i32 = 3034001; pub const SQLITE_VERSION_NUMBER: i32 = 3036000;
pub const SQLITE_SOURCE_ID: &'static [u8; 85usize] = pub const SQLITE_SOURCE_ID: &[u8; 85usize] =
b"2021-01-20 14:10:07 10e20c0b43500cfb9bbc0eaa061c57514f715d87238f4d835880cd846b9ealt1\0"; b"2021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafaalt1\0";
pub const SQLITE_OK: i32 = 0; pub const SQLITE_OK: i32 = 0;
pub const SQLITE_ERROR: i32 = 1; pub const SQLITE_ERROR: i32 = 1;
pub const SQLITE_INTERNAL: i32 = 2; pub const SQLITE_INTERNAL: i32 = 2;
@ -192,6 +192,8 @@ pub const SQLITE_FCNTL_SIZE_LIMIT: i32 = 36;
pub const SQLITE_FCNTL_CKPT_DONE: i32 = 37; pub const SQLITE_FCNTL_CKPT_DONE: i32 = 37;
pub const SQLITE_FCNTL_RESERVE_BYTES: i32 = 38; pub const SQLITE_FCNTL_RESERVE_BYTES: i32 = 38;
pub const SQLITE_FCNTL_CKPT_START: i32 = 39; pub const SQLITE_FCNTL_CKPT_START: i32 = 39;
pub const SQLITE_FCNTL_EXTERNAL_READER: i32 = 40;
pub const SQLITE_FCNTL_CKSM_FILE: i32 = 41;
pub const SQLITE_GET_LOCKPROXYFILE: i32 = 2; pub const SQLITE_GET_LOCKPROXYFILE: i32 = 2;
pub const SQLITE_SET_LOCKPROXYFILE: i32 = 3; pub const SQLITE_SET_LOCKPROXYFILE: i32 = 3;
pub const SQLITE_LAST_ERRNO: i32 = 4; pub const SQLITE_LAST_ERRNO: i32 = 4;
@ -388,7 +390,9 @@ pub const SQLITE_TESTCTRL_RESULT_INTREAL: i32 = 27;
pub const SQLITE_TESTCTRL_PRNG_SEED: i32 = 28; pub const SQLITE_TESTCTRL_PRNG_SEED: i32 = 28;
pub const SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS: i32 = 29; pub const SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS: i32 = 29;
pub const SQLITE_TESTCTRL_SEEK_COUNT: i32 = 30; pub const SQLITE_TESTCTRL_SEEK_COUNT: i32 = 30;
pub const SQLITE_TESTCTRL_LAST: i32 = 30; pub const SQLITE_TESTCTRL_TRACEFLAGS: i32 = 31;
pub const SQLITE_TESTCTRL_TUNE: i32 = 32;
pub const SQLITE_TESTCTRL_LAST: i32 = 32;
pub const SQLITE_STATUS_MEMORY_USED: i32 = 0; pub const SQLITE_STATUS_MEMORY_USED: i32 = 0;
pub const SQLITE_STATUS_PAGECACHE_USED: i32 = 1; pub const SQLITE_STATUS_PAGECACHE_USED: i32 = 1;
pub const SQLITE_STATUS_PAGECACHE_OVERFLOW: i32 = 2; pub const SQLITE_STATUS_PAGECACHE_OVERFLOW: i32 = 2;
@ -444,6 +448,7 @@ pub const NOT_WITHIN: i32 = 0;
pub const PARTLY_WITHIN: i32 = 1; pub const PARTLY_WITHIN: i32 = 1;
pub const FULLY_WITHIN: i32 = 2; pub const FULLY_WITHIN: i32 = 2;
pub const __SQLITESESSION_H_: i32 = 1; pub const __SQLITESESSION_H_: i32 = 1;
pub const SQLITE_SESSION_OBJCONFIG_SIZE: i32 = 1;
pub const SQLITE_CHANGESETSTART_INVERT: i32 = 2; pub const SQLITE_CHANGESETSTART_INVERT: i32 = 2;
pub const SQLITE_CHANGESETAPPLY_NOSAVEPOINT: i32 = 1; pub const SQLITE_CHANGESETAPPLY_NOSAVEPOINT: i32 = 1;
pub const SQLITE_CHANGESETAPPLY_INVERT: i32 = 2; pub const SQLITE_CHANGESETAPPLY_INVERT: i32 = 2;
@ -4345,11 +4350,14 @@ extern "C" {
arg3: *mut *mut sqlite3_value, arg3: *mut *mut sqlite3_value,
) -> ::std::os::raw::c_int; ) -> ::std::os::raw::c_int;
} }
extern "C" {
pub fn sqlite3_preupdate_blobwrite(arg1: *mut sqlite3) -> ::std::os::raw::c_int;
}
extern "C" { extern "C" {
pub fn sqlite3_system_errno(arg1: *mut sqlite3) -> ::std::os::raw::c_int; pub fn sqlite3_system_errno(arg1: *mut sqlite3) -> ::std::os::raw::c_int;
} }
#[repr(C)] #[repr(C)]
#[derive(Copy, Clone)] #[derive(Debug, Copy, Clone)]
pub struct sqlite3_snapshot { pub struct sqlite3_snapshot {
pub hidden: [::std::os::raw::c_uchar; 48usize], pub hidden: [::std::os::raw::c_uchar; 48usize],
} }
@ -4751,6 +4759,13 @@ extern "C" {
extern "C" { extern "C" {
pub fn sqlite3session_delete(pSession: *mut sqlite3_session); pub fn sqlite3session_delete(pSession: *mut sqlite3_session);
} }
extern "C" {
pub fn sqlite3session_object_config(
arg1: *mut sqlite3_session,
op: ::std::os::raw::c_int,
pArg: *mut ::std::os::raw::c_void,
) -> ::std::os::raw::c_int;
}
extern "C" { extern "C" {
pub fn sqlite3session_enable( pub fn sqlite3session_enable(
pSession: *mut sqlite3_session, pSession: *mut sqlite3_session,
@ -4788,6 +4803,9 @@ extern "C" {
ppChangeset: *mut *mut ::std::os::raw::c_void, ppChangeset: *mut *mut ::std::os::raw::c_void,
) -> ::std::os::raw::c_int; ) -> ::std::os::raw::c_int;
} }
extern "C" {
pub fn sqlite3session_changeset_size(pSession: *mut sqlite3_session) -> sqlite3_int64;
}
extern "C" { extern "C" {
pub fn sqlite3session_diff( pub fn sqlite3session_diff(
pSession: *mut sqlite3_session, pSession: *mut sqlite3_session,
@ -4806,6 +4824,9 @@ extern "C" {
extern "C" { extern "C" {
pub fn sqlite3session_isempty(pSession: *mut sqlite3_session) -> ::std::os::raw::c_int; pub fn sqlite3session_isempty(pSession: *mut sqlite3_session) -> ::std::os::raw::c_int;
} }
extern "C" {
pub fn sqlite3session_memory_used(pSession: *mut sqlite3_session) -> sqlite3_int64;
}
extern "C" { extern "C" {
pub fn sqlite3changeset_start( pub fn sqlite3changeset_start(
pp: *mut *mut sqlite3_changeset_iter, pp: *mut *mut sqlite3_changeset_iter,

File diff suppressed because it is too large Load Diff

View File

@ -123,9 +123,9 @@ extern "C" {
** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()]. ** [sqlite_version()] and [sqlite_source_id()].
*/ */
#define SQLITE_VERSION "3.34.1" #define SQLITE_VERSION "3.36.0"
#define SQLITE_VERSION_NUMBER 3034001 #define SQLITE_VERSION_NUMBER 3036000
#define SQLITE_SOURCE_ID "2021-01-20 14:10:07 10e20c0b43500cfb9bbc0eaa061c57514f715d87238f4d835880cd846b9ealt1" #define SQLITE_SOURCE_ID "2021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafaalt1"
/* /*
** CAPI3REF: Run-Time Library Version Numbers ** CAPI3REF: Run-Time Library Version Numbers
@ -1128,6 +1128,23 @@ struct sqlite3_io_methods {
** file to the database file, but before the *-shm file is updated to ** file to the database file, but before the *-shm file is updated to
** record the fact that the pages have been checkpointed. ** record the fact that the pages have been checkpointed.
** </ul> ** </ul>
**
** <li>[[SQLITE_FCNTL_EXTERNAL_READER]]
** The EXPERIMENTAL [SQLITE_FCNTL_EXTERNAL_READER] opcode is used to detect
** whether or not there is a database client in another process with a wal-mode
** transaction open on the database or not. It is only available on unix.The
** (void*) argument passed with this file-control should be a pointer to a
** value of type (int). The integer value is set to 1 if the database is a wal
** mode database and there exists at least one client in another process that
** currently has an SQL transaction open on the database. It is set to 0 if
** the database is not a wal-mode db, or if there is no such connection in any
** other process. This opcode cannot be used to detect transactions opened
** by clients within the current process, only within other processes.
** </ul>
**
** <li>[[SQLITE_FCNTL_CKSM_FILE]]
** Used by the cksmvfs VFS module only.
** </ul>
*/ */
#define SQLITE_FCNTL_LOCKSTATE 1 #define SQLITE_FCNTL_LOCKSTATE 1
#define SQLITE_FCNTL_GET_LOCKPROXYFILE 2 #define SQLITE_FCNTL_GET_LOCKPROXYFILE 2
@ -1167,6 +1184,8 @@ struct sqlite3_io_methods {
#define SQLITE_FCNTL_CKPT_DONE 37 #define SQLITE_FCNTL_CKPT_DONE 37
#define SQLITE_FCNTL_RESERVE_BYTES 38 #define SQLITE_FCNTL_RESERVE_BYTES 38
#define SQLITE_FCNTL_CKPT_START 39 #define SQLITE_FCNTL_CKPT_START 39
#define SQLITE_FCNTL_EXTERNAL_READER 40
#define SQLITE_FCNTL_CKSM_FILE 41
/* deprecated names */ /* deprecated names */
#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE #define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
@ -2115,7 +2134,13 @@ struct sqlite3_mem_methods {
** The second parameter is a pointer to an integer into which ** The second parameter is a pointer to an integer into which
** is written 0 or 1 to indicate whether triggers are disabled or enabled ** is written 0 or 1 to indicate whether triggers are disabled or enabled
** following this call. The second parameter may be a NULL pointer, in ** following this call. The second parameter may be a NULL pointer, in
** which case the trigger setting is not reported back. </dd> ** which case the trigger setting is not reported back.
**
** <p>Originally this option disabled all triggers. ^(However, since
** SQLite version 3.35.0, TEMP triggers are still allowed even if
** this option is off. So, in other words, this option now only disables
** triggers in the main database schema or in the schemas of ATTACH-ed
** databases.)^ </dd>
** **
** [[SQLITE_DBCONFIG_ENABLE_VIEW]] ** [[SQLITE_DBCONFIG_ENABLE_VIEW]]
** <dt>SQLITE_DBCONFIG_ENABLE_VIEW</dt> ** <dt>SQLITE_DBCONFIG_ENABLE_VIEW</dt>
@ -2126,7 +2151,13 @@ struct sqlite3_mem_methods {
** The second parameter is a pointer to an integer into which ** The second parameter is a pointer to an integer into which
** is written 0 or 1 to indicate whether views are disabled or enabled ** is written 0 or 1 to indicate whether views are disabled or enabled
** following this call. The second parameter may be a NULL pointer, in ** following this call. The second parameter may be a NULL pointer, in
** which case the view setting is not reported back. </dd> ** which case the view setting is not reported back.
**
** <p>Originally this option disabled all views. ^(However, since
** SQLite version 3.35.0, TEMP views are still allowed even if
** this option is off. So, in other words, this option now only disables
** views in the main database schema or in the schemas of ATTACH-ed
** databases.)^ </dd>
** **
** [[SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER]] ** [[SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER]]
** <dt>SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER</dt> ** <dt>SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER</dt>
@ -3499,6 +3530,7 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
** that uses dot-files in place of posix advisory locking. ** that uses dot-files in place of posix advisory locking.
** <tr><td> file:data.db?mode=readonly <td> ** <tr><td> file:data.db?mode=readonly <td>
** An error. "readonly" is not a valid option for the "mode" parameter. ** An error. "readonly" is not a valid option for the "mode" parameter.
** Use "ro" instead: "file:data.db?mode=ro".
** </table> ** </table>
** **
** ^URI hexadecimal escape sequences (%HH) are supported within the path and ** ^URI hexadecimal escape sequences (%HH) are supported within the path and
@ -4166,6 +4198,15 @@ SQLITE_API const char *sqlite3_normalized_sql(sqlite3_stmt *pStmt);
** [BEGIN] merely sets internal flags, but the [BEGIN|BEGIN IMMEDIATE] and ** [BEGIN] merely sets internal flags, but the [BEGIN|BEGIN IMMEDIATE] and
** [BEGIN|BEGIN EXCLUSIVE] commands do touch the database and so ** [BEGIN|BEGIN EXCLUSIVE] commands do touch the database and so
** sqlite3_stmt_readonly() returns false for those commands. ** sqlite3_stmt_readonly() returns false for those commands.
**
** ^This routine returns false if there is any possibility that the
** statement might change the database file. ^A false return does
** not guarantee that the statement will change the database file.
** ^For example, an UPDATE statement might have a WHERE clause that
** makes it a no-op, but the sqlite3_stmt_readonly() result would still
** be false. ^Similarly, a CREATE TABLE IF NOT EXISTS statement is a
** read-only no-op if the table already exists, but
** sqlite3_stmt_readonly() still returns false for such a statement.
*/ */
SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt); SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
@ -4335,18 +4376,22 @@ typedef struct sqlite3_context sqlite3_context;
** contain embedded NULs. The result of expressions involving strings ** contain embedded NULs. The result of expressions involving strings
** with embedded NULs is undefined. ** with embedded NULs is undefined.
** **
** ^The fifth argument to the BLOB and string binding interfaces ** ^The fifth argument to the BLOB and string binding interfaces controls
** is a destructor used to dispose of the BLOB or ** or indicates the lifetime of the object referenced by the third parameter.
** string after SQLite has finished with it. ^The destructor is called ** These three options exist:
** to dispose of the BLOB or string even if the call to the bind API fails, ** ^ (1) A destructor to dispose of the BLOB or string after SQLite has finished
** except the destructor is not called if the third parameter is a NULL ** with it may be passed. ^It is called to dispose of the BLOB or string even
** pointer or the fourth parameter is negative. ** if the call to the bind API fails, except the destructor is not called if
** ^If the fifth argument is ** the third parameter is a NULL pointer or the fourth parameter is negative.
** the special value [SQLITE_STATIC], then SQLite assumes that the ** ^ (2) The special constant, [SQLITE_STATIC], may be passsed to indicate that
** information is in static, unmanaged space and does not need to be freed. ** the application remains responsible for disposing of the object. ^In this
** ^If the fifth argument has the value [SQLITE_TRANSIENT], then ** case, the object and the provided pointer to it must remain valid until
** SQLite makes its own private copy of the data immediately, before ** either the prepared statement is finalized or the same SQL parameter is
** the sqlite3_bind_*() routine returns. ** bound to something else, whichever occurs sooner.
** ^ (3) The constant, [SQLITE_TRANSIENT], may be passed to indicate that the
** object is to be copied prior to the return from sqlite3_bind_*(). ^The
** object and pointer to it must remain valid until then. ^SQLite will then
** manage the lifetime of its private copy.
** **
** ^The sixth argument to sqlite3_bind_text64() must be one of ** ^The sixth argument to sqlite3_bind_text64() must be one of
** [SQLITE_UTF8], [SQLITE_UTF16], [SQLITE_UTF16BE], or [SQLITE_UTF16LE] ** [SQLITE_UTF8], [SQLITE_UTF16], [SQLITE_UTF16BE], or [SQLITE_UTF16LE]
@ -5088,7 +5133,6 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
** within VIEWs, TRIGGERs, CHECK constraints, generated column expressions, ** within VIEWs, TRIGGERs, CHECK constraints, generated column expressions,
** index expressions, or the WHERE clause of partial indexes. ** index expressions, or the WHERE clause of partial indexes.
** **
** <span style="background-color:#ffff90;">
** For best security, the [SQLITE_DIRECTONLY] flag is recommended for ** For best security, the [SQLITE_DIRECTONLY] flag is recommended for
** all application-defined SQL functions that do not need to be ** all application-defined SQL functions that do not need to be
** used inside of triggers, view, CHECK constraints, or other elements of ** used inside of triggers, view, CHECK constraints, or other elements of
@ -5098,7 +5142,6 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
** a database file to include invocations of the function with parameters ** a database file to include invocations of the function with parameters
** chosen by the attacker, which the application will then execute when ** chosen by the attacker, which the application will then execute when
** the database file is opened and read. ** the database file is opened and read.
** </span>
** **
** ^(The fifth parameter is an arbitrary pointer. The implementation of the ** ^(The fifth parameter is an arbitrary pointer. The implementation of the
** function can gain access to this pointer using [sqlite3_user_data()].)^ ** function can gain access to this pointer using [sqlite3_user_data()].)^
@ -5976,6 +6019,19 @@ SQLITE_API int sqlite3_key_v2(
** The code to implement this API is not available in the public release ** The code to implement this API is not available in the public release
** of SQLite. ** of SQLite.
*/ */
/* SQLCipher usage note:
If the current database is plaintext SQLCipher will NOT encrypt it.
If the current database is encrypted and pNew==0 or nNew==0, SQLCipher
will NOT decrypt it.
This routine will ONLY work on an already encrypted database in order
to change the key.
Conversion from plaintext-to-encrypted or encrypted-to-plaintext should
use an ATTACHed database and the sqlcipher_export() convenience function
as per the SQLCipher Documentation.
*/
SQLITE_API int sqlite3_rekey( SQLITE_API int sqlite3_rekey(
sqlite3 *db, /* Database to be rekeyed */ sqlite3 *db, /* Database to be rekeyed */
const void *pKey, int nKey /* The new key */ const void *pKey, int nKey /* The new key */
@ -7812,7 +7868,9 @@ SQLITE_API int sqlite3_test_control(int op, ...);
#define SQLITE_TESTCTRL_PRNG_SEED 28 #define SQLITE_TESTCTRL_PRNG_SEED 28
#define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29 #define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29
#define SQLITE_TESTCTRL_SEEK_COUNT 30 #define SQLITE_TESTCTRL_SEEK_COUNT 30
#define SQLITE_TESTCTRL_LAST 30 /* Largest TESTCTRL */ #define SQLITE_TESTCTRL_TRACEFLAGS 31
#define SQLITE_TESTCTRL_TUNE 32
#define SQLITE_TESTCTRL_LAST 32 /* Largest TESTCTRL */
/* /*
** CAPI3REF: SQL Keyword Checking ** CAPI3REF: SQL Keyword Checking
@ -9564,6 +9622,15 @@ SQLITE_API int sqlite3_db_cacheflush(sqlite3*);
** triggers; or 2 for changes resulting from triggers called by top-level ** triggers; or 2 for changes resulting from triggers called by top-level
** triggers; and so forth. ** triggers; and so forth.
** **
** When the [sqlite3_blob_write()] API is used to update a blob column,
** the pre-update hook is invoked with SQLITE_DELETE. This is because the
** in this case the new values are not available. In this case, when a
** callback made with op==SQLITE_DELETE is actuall a write using the
** sqlite3_blob_write() API, the [sqlite3_preupdate_blobwrite()] returns
** the index of the column being written. In other cases, where the
** pre-update hook is being invoked for some other reason, including a
** regular DELETE, sqlite3_preupdate_blobwrite() returns -1.
**
** See also: [sqlite3_update_hook()] ** See also: [sqlite3_update_hook()]
*/ */
#if defined(SQLITE_ENABLE_PREUPDATE_HOOK) #if defined(SQLITE_ENABLE_PREUPDATE_HOOK)
@ -9584,6 +9651,7 @@ SQLITE_API int sqlite3_preupdate_old(sqlite3 *, int, sqlite3_value **);
SQLITE_API int sqlite3_preupdate_count(sqlite3 *); SQLITE_API int sqlite3_preupdate_count(sqlite3 *);
SQLITE_API int sqlite3_preupdate_depth(sqlite3 *); SQLITE_API int sqlite3_preupdate_depth(sqlite3 *);
SQLITE_API int sqlite3_preupdate_new(sqlite3 *, int, sqlite3_value **); SQLITE_API int sqlite3_preupdate_new(sqlite3 *, int, sqlite3_value **);
SQLITE_API int sqlite3_preupdate_blobwrite(sqlite3 *);
#endif #endif
/* /*
@ -9822,8 +9890,8 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const c
** SQLITE_SERIALIZE_NOCOPY bit is omitted from argument F if a memory ** SQLITE_SERIALIZE_NOCOPY bit is omitted from argument F if a memory
** allocation error occurs. ** allocation error occurs.
** **
** This interface is only available if SQLite is compiled with the ** This interface is omitted if SQLite is compiled with the
** [SQLITE_ENABLE_DESERIALIZE] option. ** [SQLITE_OMIT_DESERIALIZE] option.
*/ */
SQLITE_API unsigned char *sqlite3_serialize( SQLITE_API unsigned char *sqlite3_serialize(
sqlite3 *db, /* The database connection */ sqlite3 *db, /* The database connection */
@ -9874,8 +9942,8 @@ SQLITE_API unsigned char *sqlite3_serialize(
** SQLITE_DESERIALIZE_FREEONCLOSE bit is set in argument F, then ** SQLITE_DESERIALIZE_FREEONCLOSE bit is set in argument F, then
** [sqlite3_free()] is invoked on argument P prior to returning. ** [sqlite3_free()] is invoked on argument P prior to returning.
** **
** This interface is only available if SQLite is compiled with the ** This interface is omitted if SQLite is compiled with the
** [SQLITE_ENABLE_DESERIALIZE] option. ** [SQLITE_OMIT_DESERIALIZE] option.
*/ */
SQLITE_API int sqlite3_deserialize( SQLITE_API int sqlite3_deserialize(
sqlite3 *db, /* The database connection */ sqlite3 *db, /* The database connection */
@ -10124,6 +10192,38 @@ SQLITE_API int sqlite3session_create(
*/ */
SQLITE_API void sqlite3session_delete(sqlite3_session *pSession); SQLITE_API void sqlite3session_delete(sqlite3_session *pSession);
/*
** CAPIREF: Conigure a Session Object
** METHOD: sqlite3_session
**
** This method is used to configure a session object after it has been
** created. At present the only valid value for the second parameter is
** [SQLITE_SESSION_OBJCONFIG_SIZE].
**
** Arguments for sqlite3session_object_config()
**
** The following values may passed as the the 4th parameter to
** sqlite3session_object_config().
**
** <dt>SQLITE_SESSION_OBJCONFIG_SIZE <dd>
** This option is used to set, clear or query the flag that enables
** the [sqlite3session_changeset_size()] API. Because it imposes some
** computational overhead, this API is disabled by default. Argument
** pArg must point to a value of type (int). If the value is initially
** 0, then the sqlite3session_changeset_size() API is disabled. If it
** is greater than 0, then the same API is enabled. Or, if the initial
** value is less than zero, no change is made. In all cases the (int)
** variable is set to 1 if the sqlite3session_changeset_size() API is
** enabled following the current call, or 0 otherwise.
**
** It is an error (SQLITE_MISUSE) to attempt to modify this setting after
** the first table has been attached to the session object.
*/
SQLITE_API int sqlite3session_object_config(sqlite3_session*, int op, void *pArg);
/*
*/
#define SQLITE_SESSION_OBJCONFIG_SIZE 1
/* /*
** CAPI3REF: Enable Or Disable A Session Object ** CAPI3REF: Enable Or Disable A Session Object
@ -10368,6 +10468,22 @@ SQLITE_API int sqlite3session_changeset(
void **ppChangeset /* OUT: Buffer containing changeset */ void **ppChangeset /* OUT: Buffer containing changeset */
); );
/*
** CAPI3REF: Return An Upper-limit For The Size Of The Changeset
** METHOD: sqlite3_session
**
** By default, this function always returns 0. For it to return
** a useful result, the sqlite3_session object must have been configured
** to enable this API using sqlite3session_object_config() with the
** SQLITE_SESSION_OBJCONFIG_SIZE verb.
**
** When enabled, this function returns an upper limit, in bytes, for the size
** of the changeset that might be produced if sqlite3session_changeset() were
** called. The final changeset size might be equal to or smaller than the
** size in bytes returned by this function.
*/
SQLITE_API sqlite3_int64 sqlite3session_changeset_size(sqlite3_session *pSession);
/* /*
** CAPI3REF: Load The Difference Between Tables Into A Session ** CAPI3REF: Load The Difference Between Tables Into A Session
** METHOD: sqlite3_session ** METHOD: sqlite3_session
@ -10485,6 +10601,14 @@ SQLITE_API int sqlite3session_patchset(
*/ */
SQLITE_API int sqlite3session_isempty(sqlite3_session *pSession); SQLITE_API int sqlite3session_isempty(sqlite3_session *pSession);
/*
** CAPI3REF: Query for the amount of heap memory used by a session object.
**
** This API returns the total amount of heap memory in bytes currently
** used by the session object passed as the only argument.
*/
SQLITE_API sqlite3_int64 sqlite3session_memory_used(sqlite3_session *pSession);
/* /*
** CAPI3REF: Create An Iterator To Traverse A Changeset ** CAPI3REF: Create An Iterator To Traverse A Changeset
** CONSTRUCTOR: sqlite3_changeset_iter ** CONSTRUCTOR: sqlite3_changeset_iter
@ -10587,18 +10711,23 @@ SQLITE_API int sqlite3changeset_next(sqlite3_changeset_iter *pIter);
** call to [sqlite3changeset_next()] must have returned [SQLITE_ROW]. If this ** call to [sqlite3changeset_next()] must have returned [SQLITE_ROW]. If this
** is not the case, this function returns [SQLITE_MISUSE]. ** is not the case, this function returns [SQLITE_MISUSE].
** **
** If argument pzTab is not NULL, then *pzTab is set to point to a ** Arguments pOp, pnCol and pzTab may not be NULL. Upon return, three
** nul-terminated utf-8 encoded string containing the name of the table ** outputs are set through these pointers:
** affected by the current change. The buffer remains valid until either **
** sqlite3changeset_next() is called on the iterator or until the ** *pOp is set to one of [SQLITE_INSERT], [SQLITE_DELETE] or [SQLITE_UPDATE],
** conflict-handler function returns. If pnCol is not NULL, then *pnCol is ** depending on the type of change that the iterator currently points to;
** set to the number of columns in the table affected by the change. If **
** pbIndirect is not NULL, then *pbIndirect is set to true (1) if the change ** *pnCol is set to the number of columns in the table affected by the change; and
**
** *pzTab is set to point to a nul-terminated utf-8 encoded string containing
** the name of the table affected by the current change. The buffer remains
** valid until either sqlite3changeset_next() is called on the iterator
** or until the conflict-handler function returns.
**
** If pbIndirect is not NULL, then *pbIndirect is set to true (1) if the change
** is an indirect change, or false (0) otherwise. See the documentation for ** is an indirect change, or false (0) otherwise. See the documentation for
** [sqlite3session_indirect()] for a description of direct and indirect ** [sqlite3session_indirect()] for a description of direct and indirect
** changes. Finally, if pOp is not NULL, then *pOp is set to one of ** changes.
** [SQLITE_INSERT], [SQLITE_DELETE] or [SQLITE_UPDATE], depending on the
** type of change that the iterator currently points to.
** **
** If no error occurs, SQLITE_OK is returned. If an error does occur, an ** If no error occurs, SQLITE_OK is returned. If an error does occur, an
** SQLite error code is returned. The values of the output variables may not ** SQLite error code is returned. The values of the output variables may not

View File

@ -9,7 +9,7 @@ mkdir -p "$SCRIPT_DIR/../target" "$SCRIPT_DIR/sqlcipher"
export SQLCIPHER_LIB_DIR="$SCRIPT_DIR/sqlcipher" export SQLCIPHER_LIB_DIR="$SCRIPT_DIR/sqlcipher"
export SQLCIPHER_INCLUDE_DIR="$SQLCIPHER_LIB_DIR" export SQLCIPHER_INCLUDE_DIR="$SQLCIPHER_LIB_DIR"
SQLCIPHER_VERSION="4.4.3" SQLCIPHER_VERSION="4.5.0"
# Download and generate sqlcipher amalgamation # Download and generate sqlcipher amalgamation
mkdir -p $SCRIPT_DIR/sqlcipher.src mkdir -p $SCRIPT_DIR/sqlcipher.src
[ -e "v${SQLCIPHER_VERSION}.tar.gz" ] || curl -sfL -O "https://github.com/sqlcipher/sqlcipher/archive/v${SQLCIPHER_VERSION}.tar.gz" [ -e "v${SQLCIPHER_VERSION}.tar.gz" ] || curl -sfL -O "https://github.com/sqlcipher/sqlcipher/archive/v${SQLCIPHER_VERSION}.tar.gz"