Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9,532 changes: 5,507 additions & 4,025 deletions sqlite3-binding.c

Large diffs are not rendered by default.

156 changes: 127 additions & 29 deletions sqlite3-binding.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,12 @@ extern "C" {
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
*/
#define SQLITE_VERSION "3.53.4"
#define SQLITE_VERSION_NUMBER 3053004
#define SQLITE_SOURCE_ID "2026-07-24 19:02:57 bf7c7f30031888f4e796e429ab3978879485813aaca6f641c7b33e4e09459bcc"
#define SQLITE_SCM_BRANCH "branch-3.53"
#define SQLITE_SCM_TAGS "release version-3.53.4"
#define SQLITE_SCM_DATETIME "2026-07-24T19:02:57.525Z"
#define SQLITE_VERSION "3.54.1"
#define SQLITE_VERSION_NUMBER 3054001
#define SQLITE_SOURCE_ID "2026-10-16 14:45:20 555e07ef33f69a0957d24d8e555b702464a131d6f1607f4c3c1e4551e8e6ca76"
#define SQLITE_SCM_BRANCH "branch-3.54"
#define SQLITE_SCM_TAGS "release version-3.54.1"
#define SQLITE_SCM_DATETIME "2026-10-16T14:45:20.546Z"

/*
** CAPI3REF: Run-Time Library Version Numbers
Expand Down Expand Up @@ -464,7 +464,7 @@ SQLITE_API int sqlite3_exec(
#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 /* Internal use only */
#define SQLITE_EMPTY 16 /* No content */
#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 */
Expand Down Expand Up @@ -2961,35 +2961,51 @@ SQLITE_API int sqlite3_is_interrupted(sqlite3*);
** These routines are useful during command-line input to determine if the
** currently entered text seems to form a complete SQL statement or
** if additional input is needed before sending the text into
** SQLite for parsing. ^These routines return 1 if the input string
** appears to be a complete SQL statement. ^A statement is judged to be
** SQLite for parsing. ^The sqlite3_complete(X) and sqlite3_complete16(X)
** routines return 1 if the input string X appears to be a complete SQL
** statement. ^A statement is judged to be
** complete if it ends with a semicolon token and is not a prefix of a
** well-formed CREATE TRIGGER statement. ^Semicolons that are embedded within
** string literals or quoted identifier names or comments are not
** independent tokens (they are part of the token in which they are
** embedded) and thus do not count as a statement terminator. ^Whitespace
** and comments that follow the final semicolon are ignored.
**
** ^These routines return 0 if the statement is incomplete. ^If a
** memory allocation fails, then SQLITE_NOMEM is returned.
**
** ^These routines do not parse the SQL statements and thus
** will not detect syntactically incorrect SQL.
** ^The sqlite3_complete(X) and sqlite3_complete16(X) routines return 0
** if the statement is incomplete. ^If a memory allocation fails, then
** SQLITE_NOMEM is returned.
**
** The [sqlite3_incomplete(X)] routine is similar to [sqlite3_complete(X)]
** except that sqlite3_incomplete(X) returns SQLITE_OK if the input X is
** complete, SQLITE_EMPTY if input X consists entirely of whitespace and/or
** comments, SQLITE_MISUSE if X is a NULL pointer, and some other non-zero
** value if X is incomplete. The non-zero return from
** sqlite3_incomplete(X) contains additional information about what is
** needed to complete the input X. See the header comment on the
** implemenation of the sqlite3_incomplete() routine for a full description
** of its non-zero return values. The sqlite3_incomplete(X) interface
** is only available for UTF-8 text.
**
** ^None of these routines do a full parse the SQL statements and thus
** will not detect syntactically incorrect SQL. They only determine if
** input text has properly terminated comments, string literals, and
** quoted identifiers, and if the statement ends with a semicolon.
**
** ^(If SQLite has not been initialized using [sqlite3_initialize()] prior
** to invoking sqlite3_complete16() then sqlite3_initialize() is invoked
** automatically by sqlite3_complete16(). If that initialization fails,
** then the return value from sqlite3_complete16() will be non-zero
** regardless of whether or not the input SQL is complete.)^
**
** The input to [sqlite3_complete()] must be a zero-terminated
** UTF-8 string.
** The X input to [sqlite3_complete(X)] and [sqlite3_incomplete(X)]
** must be a zero-terminated UTF-8 string.
**
** The input to [sqlite3_complete16()] must be a zero-terminated
** UTF-16 string in native byte order.
*/
SQLITE_API int sqlite3_complete(const char *sql);
SQLITE_API int sqlite3_complete16(const void *sql);
SQLITE_API sqlite3_int64 sqlite3_incomplete(const char *sql);

/*
** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors
Expand Down Expand Up @@ -3402,7 +3418,7 @@ SQLITE_API void sqlite3_randomness(int N, void *P);
**
** ^The first parameter to the authorizer callback is a copy of the third
** parameter to the sqlite3_set_authorizer() interface. ^The second parameter
** to the callback is an integer [SQLITE_COPY | action code] that specifies
** to the callback is an integer [SQLITE_READ | action code] that specifies
** the particular action to be authorized. ^The third through sixth parameters
** to the callback are either NULL pointers or zero-terminated strings
** that contain additional details about the action to be authorized.
Expand Down Expand Up @@ -3445,21 +3461,33 @@ SQLITE_API void sqlite3_randomness(int N, void *P);
** previous call.)^ ^Disable the authorizer by installing a NULL callback.
** The authorizer is disabled by default.
**
** The authorizer callback must not do anything that will modify
** <h3>Limitations And Caveats</h3><ul>
**
** <li>The authorizer callback must not do anything that will modify
** the database connection that invoked the authorizer callback.
** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
** database connections for the meaning of "modify" in this paragraph.
**
** ^When [sqlite3_prepare_v2()] is used to prepare a statement, the
** <li>^When [sqlite3_prepare_v2()] is used to prepare a statement, the
** statement might be re-prepared during [sqlite3_step()] due to a
** schema change. Hence, the application should ensure that the
** correct authorizer callback remains in place during the [sqlite3_step()].
**
** ^Note that the authorizer callback is invoked only during
** <li>^The authorizer callback is invoked only during
** [sqlite3_prepare()] or its variants. Authorization is not
** performed during statement evaluation in [sqlite3_step()], unless
** as stated in the previous paragraph, sqlite3_step() invokes
** sqlite3_prepare_v2() to reprepare a statement after a schema change.
**
** <li>Authorizer callbacks for the expressions of a
** [generated column] are invoked when the schema is parsed (and specifically
** when the [CREATE TABLE] statement that contains the generated column is
** parsed) not when the generated column is used in a DML statement.
** This is deliberate, as one of the purposes of generated columns
** is to give schema designers the ability to provide gated access
** to privileged columns and/or functions.
**
** </ul>
*/
SQLITE_API int sqlite3_set_authorizer(
sqlite3*,
Expand Down Expand Up @@ -3500,6 +3528,11 @@ SQLITE_API int sqlite3_set_authorizer(
** is the name of the inner-most trigger or view that is responsible for
** the access attempt or NULL if this access attempt is directly from
** top-level SQL code.
**
** The case of strings in the 3rd through the 6th argument to the
** authorization callback is arbitrary. Authorization callbacks
** implementations should use [sqlite3_stricmp()] or similar when
** doing comparisons against those values.
*/
/******************************************* 3rd ************ 4th ***********/
#define SQLITE_CREATE_INDEX 1 /* Index Name Table Name */
Expand Down Expand Up @@ -3534,9 +3567,14 @@ SQLITE_API int sqlite3_set_authorizer(
#define SQLITE_DROP_VTABLE 30 /* Table Name Module Name */
#define SQLITE_FUNCTION 31 /* NULL Function Name */
#define SQLITE_SAVEPOINT 32 /* Operation Savepoint Name */
#define SQLITE_COPY 0 /* No longer used */
#define SQLITE_RECURSIVE 33 /* NULL NULL */

/*
** Note: The SQLITE_COPY macro (with value 0) used to be one of the
** action codes above. That macro has now been repurposed as a possible
** value to the 3rd argument to sqlite3_result_str().
*/

/*
** CAPI3REF: Deprecated Tracing And Profiling Functions
** DEPRECATED
Expand Down Expand Up @@ -4043,8 +4081,7 @@ SQLITE_API int sqlite3_open_v2(
**
** The sqlite3_uri_int64(F,P,D) routine converts the value of P into a
** 64-bit signed integer and returns that integer, or D if P does not
** exist. If the value of P is something other than an integer, then
** zero is returned.
** exist or if the value of P is something other than an integer.
**
** The sqlite3_uri_key(F,N) returns a pointer to the name (not
** the value) of the N-th query parameter for filename F, or a NULL
Expand Down Expand Up @@ -4405,6 +4442,14 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
** [[SQLITE_LIMIT_WORKER_THREADS]] ^(<dt>SQLITE_LIMIT_WORKER_THREADS</dt>
** <dd>The maximum number of auxiliary worker threads that a single
** [prepared statement] may start.</dd>)^
**
** [[SQLITE_LIMIT_SCHEMA]] ^(<dt>SQLITE_LIMIT_SCHEMA</dt>
** <dd>The maximum number of objects (tables, indexes, triggers, and views)
** defined by the database schema.</dd>)^
**
** [[SQLITE_LIMIT_TRIGGER_STEPS]] ^(<dt>SQLITE_LIMIT_TRIGGER_STEPS</dt>
** <dd>The maximum number of SQL statements that can be contained within
** a single trigger.</dd>)^
** </dl>
*/
#define SQLITE_LIMIT_LENGTH 0
Expand All @@ -4420,6 +4465,8 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
#define SQLITE_LIMIT_TRIGGER_DEPTH 10
#define SQLITE_LIMIT_WORKER_THREADS 11
#define SQLITE_LIMIT_PARSER_DEPTH 12
#define SQLITE_LIMIT_SCHEMA 13
#define SQLITE_LIMIT_TRIGGER_STEPS 14

/*
** CAPI3REF: Prepare Flags
Expand Down Expand Up @@ -4531,6 +4578,8 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
** the nul-terminator.
** Note that nByte measures the length of the input in bytes, not
** characters, even for the UTF-16 interfaces.
** For the sqlite3_prepare16() and sqlite3_prepare16_v2() interfaces,
** the nByte value must be even or undefined behavior can result.
**
** ^If pzTail is not NULL then *pzTail is made to point to the first byte
** past the end of the first SQL statement in zSql. These routines only
Expand Down Expand Up @@ -5277,7 +5326,7 @@ SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
** [prepared statement]. ^In the "v2" interface,
** the more specific error code is returned directly by sqlite3_step().
**
** [SQLITE_MISUSE] means that the this routine was called inappropriately.
** [SQLITE_MISUSE] means that this routine was called inappropriately.
** Perhaps it was called on a [prepared statement] that has
** already been [sqlite3_finalize | finalized] or on one that had
** previously returned [SQLITE_ERROR] or [SQLITE_DONE]. Or it could
Expand Down Expand Up @@ -6450,7 +6499,11 @@ typedef void (*sqlite3_destructor_type)(void*);
**
** ^The sqlite3_result_zeroblob(C,N) and sqlite3_result_zeroblob64(C,N)
** interfaces set the result of the application-defined function to be
** a BLOB containing all zero bytes and N bytes in size.
** a BLOB containing all zero bytes and N bytes in size. The
** zeroblob64(C,N) interface returns a [result code], which is normally
** [SQLITE_OK] but might be some other value if the requested operation
** could not be complete, for example if insufficient memory is available
** or if the value of N is out of range.
**
** ^The sqlite3_result_double() interface sets the result from
** an application-defined function to be a floating point value specified
Expand Down Expand Up @@ -8788,8 +8841,8 @@ SQLITE_API int sqlite3_keyword_check(const char*,int);
** <li> ^The sqlite3_str object is created using [sqlite3_str_new()].
** <li> ^Text is appended to the sqlite3_str object using various
** methods, such as [sqlite3_str_appendf()].
** <li> ^The sqlite3_str object is destroyed and the string it created
** is returned using the [sqlite3_str_finish()] interface.
** <li> The sqlite3_str object is destroyed and the string it created
** is returned using [sqlite3_str_finish()] or [sqlite3_result_str()].
** </ol>
*/
typedef struct sqlite3_str sqlite3_str;
Expand Down Expand Up @@ -8841,6 +8894,40 @@ SQLITE_API sqlite3_str *sqlite3_str_new(sqlite3*);
SQLITE_API char *sqlite3_str_finish(sqlite3_str*);
SQLITE_API void sqlite3_str_free(sqlite3_str*);

/*
** CAPI3REF: Return A Dynamic String From an SQL Function
**
** The [sqlite3_result_str(C,S,F)] interface causes the
** [sqlite3_str|dynamic string] S to become the return value for the
** application-defined function or virtual table that uses
** [sqlite3_context] C. The F flag can be one of [SQLITE_COPY]
** or [SQLITE_XFER] or [SQLITE_FINISH].
**
** If the dynamic string is invalid or incomplete due to an out-of-memory
** or string-too-large error, then this routine transfers that error
** over to the SQL function.
**
** If the F argument is SQLITE_COPY, then a copy of the dynamic string
** content is made and the dynamic string object is unchanged.
** If the F argument is SQLITE_XFER, then ownership of the content
** in the dynamic is transferred to the SQL function (via a pointer copy
** rather than a string copy) and the dynamic string is reset to an
** empty string. The SQLITE_FINISH value for F works like SQLITE_RESET
** except that it also invokes the [sqlite3_str_free(S)] destructor
** on the dynamic string object.
*/
SQLITE_API void sqlite3_result_str(sqlite3_context*, sqlite3_str*, int);

/*
** CAPI3REF: Control Flags For sqlite3_result_str()
**
** The following integers can be used as the third "F" argument
** to [sqlite3_result_str(C,S,F)].
*/
#define SQLITE_COPY 0 /* Results copied. Dynamic string unchanged */
#define SQLITE_XFER 1 /* Results transfered. Dynamic string reset */
#define SQLITE_FINISH 2 /* Like SQLITE_XFER, plus dynamic string freed */

/*
** CAPI3REF: Add Content To A Dynamic String
** METHOD: sqlite3_str
Expand Down Expand Up @@ -11206,8 +11293,19 @@ SQLITE_API unsigned char *sqlite3_serialize(
** used. The serialized database P is N bytes in size. M is the size
** of the buffer P, which might be larger than N. If M is larger than
** N, and the SQLITE_DESERIALIZE_READONLY bit is not set in F, then
** SQLite is permitted to add content to the in-memory database as
** long as the total size does not exceed M bytes.
** SQLite is permitted to add content to the in-memory database, in
** page-sized chunks, as long as the total size does not exceed M bytes.
**
** The parameter M must be greater than or equal to N. Ideally, M
** should have a value which is N+(512&times;K)+20 where K determines how
** must extra space is available to hold new content as the database
** grows. K can be 0 if the database is read-only.
**
** If the database content in P is malformed in a malicious way then
** it is possible that SQLite might try to read a few more than N bytes
** from P. If the veracity of the database content P is uncertain,
** then applications are advised to allocate about 20 extra bytes on
** the end of the P buffer to avoid a memory error.
**
** If the SQLITE_DESERIALIZE_FREEONCLOSE bit is set in F, then SQLite will
** invoke sqlite3_free() on the serialization buffer when the database
Expand Down
Loading
Loading