Skip to content

Update SQLite to version 3.52.0#90

Merged
sbooth merged 2 commits intomainfrom
sqlite-3.52.0
Mar 7, 2026
Merged

Update SQLite to version 3.52.0#90
sbooth merged 2 commits intomainfrom
sqlite-3.52.0

Conversation

@sbooth
Copy link
Owner

@sbooth sbooth commented Mar 6, 2026

No description provided.

Copilot AI review requested due to automatic review settings March 6, 2026 20:57
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the vendored SQLite headers/extensions in CSQLite to align with SQLite 3.52.0, including new public APIs and extension behaviors exposed through this package.

Changes:

  • Bumps SQLite version macros/metadata and updates sqlite3_api_routines/extension macros for 3.52.0.
  • Adds support for new SQLite 3.52.0 APIs/config options (e.g., SQLITE_DBCONFIG_FP_DIGITS, sqlite3_str_free, sqlite3_str_truncate, sqlite3_carray_bind_v2).
  • Extends bundled extensions: decimal now supports a 2-argument rounding mode; ieee754 adds int<->double bit-pattern conversion functions.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
Sources/CSQLite/include/sqlite3ext.h Adds 3.52.0 extension API routine pointers/macros.
Sources/CSQLite/include/sqlite3.h Updates version metadata and public API/docs for 3.52.0 features.
Sources/CSQLite/include/csqlite_shims.h Declares new shim for SQLITE_DBCONFIG_FP_DIGITS.
Sources/CSQLite/csqlite_shims.c Implements shim for SQLITE_DBCONFIG_FP_DIGITS.
Sources/CSQLite/ieee754.c Adds new SQL functions for int/double bit-pattern conversions; tweaks INT64_MIN handling.
Sources/CSQLite/decimal.c Adds rounding to N significant digits and registers 2-arg decimal/decimal_exp.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

** inside [sqlite3_str] object X back to zero bytes in length.
**
** ^The [sqlite3_str_truncate(X,N)] method changes the length of the string
** under construction to be N bytes are less. This routine is a no-op if
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grammar: "to be N bytes are less" should be "to be N bytes or less" in this documentation for sqlite3_str_truncate.

Suggested change
** under construction to be N bytes are less. This routine is a no-op if
** under construction to be N bytes or less. This routine is a no-op if

Copilot uses AI. Check for mistakes.
UNUSED_PARAMETER(argc);
if( sqlite3_value_type(argv[0])==SQLITE_FLOAT ){
double r = sqlite3_value_double(argv[0]);
sqlite3_uint64 v;
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ieee754func_to_int stores the copied bit-pattern in a sqlite3_uint64 and then passes it to sqlite3_result_int64. If the high bit is set, converting an out-of-range unsigned 64-bit value to signed 64-bit is implementation-defined and may not preserve the intended bit pattern across platforms/compilers. To guarantee a bitwise reinterpretation, copy into a sqlite3_int64 (or use an explicit memcpy into a signed variable) before returning it.

Suggested change
sqlite3_uint64 v;
sqlite3_int64 v;

Copilot uses AI. Check for mistakes.
** of [SQLITE_UTF8], [SQLITE_UTF8_ZT], [SQLITE_UTF16], [SQLITE_UTF16BE],
** or [SQLITE_UTF16LE]. ^The special value [SQLITE_UTF8_ZT] means that
** the result text is both UTF-8 and zero-terminated. In other words,
** SQLITE_UTF8_ZT means that the Z array holds at least N+1 byes and that
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: "byes" should be "bytes" in this documentation ("N+1 bytes").

Suggested change
** SQLITE_UTF8_ZT means that the Z array holds at least N+1 byes and that
** SQLITE_UTF8_ZT means that the Z array holds at least N+1 bytes and that

Copilot uses AI. Check for mistakes.
Comment on lines +708 to +711
if( N>0 ) decimal_round(p, N);
}else{
N = 0;
}
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

decimalFunc calls decimal_round(p, N) before checking whether decimal_new(...) returned NULL. decimal_new can legitimately return NULL (e.g., SQLITE_NULL input, invalid blob length, NaN/Infinity, OOM), which makes this a NULL dereference crash when argc==2 and N>0. Move the rounding call behind the if (p) check (and ideally also skip rounding for p->isNull/p->oom).

Suggested change
if( N>0 ) decimal_round(p, N);
}else{
N = 0;
}
}else{
N = 0;
}
if( p && N>0 && !p->isNull && !p->oom ){
decimal_round(p, N);
}

Copilot uses AI. Check for mistakes.
Comment on lines 904 to +907
{ "decimal", 1, 0, decimalFunc },
{ "decimal", 2, 0, decimalFunc },
{ "decimal_exp", 1, 1, decimalFunc },
{ "decimal_exp", 2, 1, decimalFunc },
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New 2-argument overloads for decimal/decimal_exp (significant-digits rounding) are introduced here, but the existing Swift extension tests only cover the 1-argument behavior. Please add tests that exercise rounding (e.g., decimal('1.2345', 3) and decimal_exp(..., N)) including edge cases like N<=0 and NULL input.

Copilot uses AI. Check for mistakes.
Comment on lines +346 to +347
{ "ieee754_to_int", 1, 0, ieee754func_to_int },
{ "ieee754_from_int", 1, 0, ieee754func_from_int },
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New SQL functions ieee754_to_int/ieee754_from_int are registered here, but the existing Swift extension tests only cover ieee754(...). Please add coverage that validates round-trip behavior and bit-pattern preservation (including NaN payloads / sign-bit cases if applicable).

Copilot uses AI. Check for mistakes.
** [sqlite3_prepare_v3()] has an extra "prepFlags" option that is used
** for special purposes.
** [sqlite3_prepare_v3()] has an extra
** [SQLITE_PREPARE_FROM_DDL|"prepFlags" option] that is some times
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo/grammar: "some times" should be "sometimes" in this API doc string.

Suggested change
** [SQLITE_PREPARE_FROM_DDL|"prepFlags" option] that is some times
** [SQLITE_PREPARE_FROM_DDL|"prepFlags" option] that is sometimes

Copilot uses AI. Check for mistakes.
**
** See also: [sqlite3_stmt_scanstatus_reset()]
** See also: [sqlite3_stmt_scanstatus_reset()] and the
** [nexec and ncycle] columnes of the [bytecode virtual table].
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: "columnes" should be "columns" in this documentation.

Suggested change
** [nexec and ncycle] columnes of the [bytecode virtual table].
** [nexec and ncycle] columns of the [bytecode virtual table].

Copilot uses AI. Check for mistakes.
Comment on lines +11288 to +11298
** is invoked even if the call to sqlite3_carray_bind() fails. If the X
** parameter is the special-case value [SQLITE_STATIC], then SQLite assumes
** that the data static and the destructor is never invoked. If the X
** parameter is the special-case value [SQLITE_TRANSIENT], then
** sqlite3_carray_bind_v2() makes its own private copy of the data prior
** to returning and never invokes the destructor X.
**
** The sqlite3_carray_bind() function works the same as sqlite_carray_bind_v2()
** with a D parameter set to P. In other words,
** sqlite3_carray_bind(S,I,P,N,F,X) is same as
** sqlite3_carray_bind(S,I,P,N,F,X,P).
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation examples here refer to sqlite_carray_bind_v2() (missing the 3) and then show a 7-argument call as sqlite3_carray_bind(...,P), but the 7-argument API is sqlite3_carray_bind_v2(...). This mismatch is confusing for API consumers; please correct the function names in the prose/examples to match the actual exported symbols/signatures below.

Suggested change
** is invoked even if the call to sqlite3_carray_bind() fails. If the X
** parameter is the special-case value [SQLITE_STATIC], then SQLite assumes
** that the data static and the destructor is never invoked. If the X
** parameter is the special-case value [SQLITE_TRANSIENT], then
** sqlite3_carray_bind_v2() makes its own private copy of the data prior
** to returning and never invokes the destructor X.
**
** The sqlite3_carray_bind() function works the same as sqlite_carray_bind_v2()
** with a D parameter set to P. In other words,
** sqlite3_carray_bind(S,I,P,N,F,X) is same as
** sqlite3_carray_bind(S,I,P,N,F,X,P).
** is invoked even if the call to sqlite3_carray_bind_v2() fails. If the X
** parameter is the special-case value [SQLITE_STATIC], then SQLite assumes
** that the data static and the destructor is never invoked. If the X
** parameter is the special-case value [SQLITE_TRANSIENT], then
** sqlite3_carray_bind_v2() makes its own private copy of the data prior
** to returning and never invokes the destructor X.
**
** The sqlite3_carray_bind() function works the same as sqlite3_carray_bind_v2()
** with a D parameter set to P. In other words,
** sqlite3_carray_bind(S,I,P,N,F,X) is same as
** sqlite3_carray_bind_v2(S,I,P,N,F,X,P).

Copilot uses AI. Check for mistakes.
@sbooth sbooth merged commit 2bedf8d into main Mar 7, 2026
5 checks passed
@sbooth sbooth deleted the sqlite-3.52.0 branch March 7, 2026 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants