Skip to content

Release/v3.47.0 #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Oct 23, 2024
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
143 changes: 78 additions & 65 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# ------------------------------------------------------------------------------

cmake_minimum_required(VERSION 3.16...3.25.2)
cmake_minimum_required(VERSION 3.23...3.30)

# -- Project -------------------------------------------------------------------

Expand Down Expand Up @@ -171,37 +171,28 @@ if(SQLITE_ENABLE_ICU)
find_package(ICU REQUIRED COMPONENTS i18n uc)
endif()

if(SQLITE_THREADSAFE STREQUAL "0")
message(STATUS "Building the SQLite3 library in single-threading mode")
set(SQLITE_THREADMODEL_SUFFIX "-st")
elseif(SQLITE_THREADSAFE STREQUAL "1")
message(STATUS "Building the SQLite3 library in serialized mode")
set(SQLITE_THREADMODEL_SUFFIX "")
elseif(SQLITE_THREADSAFE STREQUAL "2")
message(STATUS "Building the SQLite3 library in multi-threading mode")
set(SQLITE_THREADMODEL_SUFFIX "-mt")
endif()

if(UNIX)
find_library(MATH_LIBRARY m)
endif()

if(UNIX)
find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
pkg_search_module(Readline IMPORTED_TARGET readline)
endif()
endif()

find_package(ZLIB)

# -- Library -------------------------------------------------------------------

option(BUILD_SHARED_LIBS "Build using shared libraries." OFF)

add_library(SQLite3)
add_library(SQLite::SQLite3 ALIAS SQLite3)

if(SQLITE_THREADSAFE STREQUAL "0")
message(STATUS "Building the SQLite3 library in single-threading mode")
set(SQLITE_THREADMODEL_SUFFIX "-st")
elseif(SQLITE_THREADSAFE STREQUAL "1")
message(STATUS "Building the SQLite3 library in serialized mode")
set(SQLITE_THREADMODEL_SUFFIX "")
elseif(SQLITE_THREADSAFE STREQUAL "2")
message(STATUS "Building the SQLite3 library in multi-threading mode")
set(SQLITE_THREADMODEL_SUFFIX "-mt")
endif()

set_target_properties(SQLite3 PROPERTIES
OUTPUT_NAME sqlite3${SQLITE_THREADMODEL_SUFFIX}
DEBUG_POSTFIX "-dbg"
Expand All @@ -211,20 +202,36 @@ set_target_properties(SQLite3 PROPERTIES
WINDOWS_EXPORT_ALL_SYMBOLS ON)

target_sources(SQLite3
PRIVATE source/sqlite3.c)
PRIVATE source/sqlite3.c
PUBLIC FILE_SET HEADERS BASE_DIRS source
FILES source/sqlite3.h source/sqlite3ext.h)

target_include_directories(SQLite3
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/source>
$<INSTALL_INTERFACE:include>)

if(SQLITE_ENABLE_PREUPDATE_HOOK)
target_compile_definitions(SQLite3 PUBLIC SQLITE_ENABLE_PREUPDATE_HOOK)
endif()

if(SQLITE_ENABLE_SESSION)
target_compile_definitions(SQLite3 PUBLIC SQLITE_ENABLE_SESSION)
endif()

if(SQLITE_OMIT_COMPILEOPTION_DIAGS)
target_compile_definitions(SQLite3 PUBLIC SQLITE_OMIT_COMPILEOPTION_DIAGS)
endif()

if(SQLITE_OMIT_DEPRECATED)
target_compile_definitions(SQLite3 PUBLIC SQLITE_OMIT_DEPRECATED)
endif()

if(SQLITE_OMIT_LOAD_EXTENSION)
target_compile_definitions(SQLite3 PUBLIC SQLITE_OMIT_LOAD_EXTENSION)
endif()

target_compile_definitions(SQLite3
PUBLIC
$<$<BOOL:${SQLITE_ENABLE_PREUPDATE_HOOK}>:SQLITE_ENABLE_PREUPDATE_HOOK>
$<$<BOOL:${SQLITE_ENABLE_SESSION}>:SQLITE_ENABLE_SESSION>
$<$<BOOL:${SQLITE_OMIT_COMPILEOPTION_DIAGS}>:SQLITE_OMIT_COMPILEOPTION_DIAGS>
$<$<BOOL:${SQLITE_OMIT_DEPRECATED}>:SQLITE_OMIT_DEPRECATED>
$<$<BOOL:${SQLITE_OMIT_LOAD_EXTENSION}>:SQLITE_OMIT_LOAD_EXTENSION>
PRIVATE
SQLITE_DEFAULT_MEMSTATUS=${SQLITE_DEFAULT_MEMSTATUS}
SQLITE_DEFAULT_SYNCHRONOUS=${SQLITE_DEFAULT_SYNCHRONOUS}
Expand Down Expand Up @@ -291,59 +298,63 @@ target_compile_definitions(SQLite3
$<$<BOOL:${HAVE_UTIME}>:HAVE_UTIME>)

if(MATH_LIBRARY)
target_link_libraries(SQLite3
INTERFACE $<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:${MATH_LIBRARY}>
PRIVATE $<$<BOOL:${BUILD_SHARED_LIBS}>:${MATH_LIBRARY}>)
target_link_libraries(SQLite3 PUBLIC ${MATH_LIBRARY})
endif()

if(TARGET Threads::Threads)
target_link_libraries(SQLite3
INTERFACE $<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:Threads::Threads>
PRIVATE $<$<BOOL:${BUILD_SHARED_LIBS}>:Threads::Threads>)
target_link_libraries(SQLite3 PUBLIC Threads::Threads)
endif()

if(NOT SQLITE_OMIT_LOAD_EXTENSION)
target_link_libraries(SQLite3
INTERFACE $<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:${CMAKE_DL_LIBS}>
PRIVATE $<$<BOOL:${BUILD_SHARED_LIBS}>:${CMAKE_DL_LIBS}>)
target_link_libraries(SQLite3 PUBLIC ${CMAKE_DL_LIBS})
endif()

if(SQLITE_ENABLE_ICU)
target_link_libraries(SQLite3
INTERFACE $<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:ICU::i18n ICU::uc>
PRIVATE $<$<BOOL:${BUILD_SHARED_LIBS}>:ICU::i18n ICU::uc>)
target_link_libraries(SQLite3 PUBLIC ICU::i18n ICU::uc)
endif()

# -- Interactive shell ---------------------------------------------------------

add_executable(Shell)
add_executable(SQLite::Shell ALIAS Shell)
option(SQLITE_BUILD_SHELL "Build the SQLite3 interactive shell." ON)

set_target_properties(Shell PROPERTIES
OUTPUT_NAME sqlite3
INSTALL_RPATH "$ORIGIN/../lib")
if(SQLITE_BUILD_SHELL)
add_executable(Shell)
add_executable(SQLite::Shell ALIAS Shell)

target_sources(Shell
PRIVATE source/shell.c)
set_target_properties(Shell PROPERTIES
OUTPUT_NAME sqlite3
INSTALL_RPATH "$ORIGIN/../lib")

target_link_libraries(Shell
PRIVATE SQLite::SQLite3)
target_sources(Shell
PRIVATE source/shell.c)

if(TARGET PkgConfig::Readline)
target_compile_definitions(Shell PRIVATE HAVE_READLINE)
target_link_libraries(Shell PRIVATE PkgConfig::Readline)
endif()
target_link_libraries(Shell PRIVATE SQLite::SQLite3)

if(UNIX)
find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
pkg_search_module(Readline IMPORTED_TARGET readline)
endif()
endif()

find_package(ZLIB)

if(TARGET ZLIB::ZLIB)
target_compile_definitions(Shell PRIVATE SQLITE_HAVE_ZLIB)
target_link_libraries(Shell PRIVATE ZLIB::ZLIB)
if(TARGET PkgConfig::Readline)
target_compile_definitions(Shell PRIVATE HAVE_READLINE)
target_link_libraries(Shell PRIVATE PkgConfig::Readline)
endif()

if(TARGET ZLIB::ZLIB)
target_compile_definitions(Shell PRIVATE SQLITE_HAVE_ZLIB)
target_link_libraries(Shell PRIVATE ZLIB::ZLIB)
endif()
endif()

# -- Testing -------------------------------------------------------------------

option(BUILD_TESTING "Build the testing tree." ON)

if(BUILD_TESTING)
if(BUILD_TESTING AND SQLITE_BUILD_SHELL)
enable_testing()
add_test(NAME SQLiteShellCheckVersion
COMMAND SQLite::Shell -version)
Expand All @@ -355,21 +366,23 @@ endif()

include(GNUInstallDirs)

install(TARGETS SQLite3 Shell
EXPORT SQLite3Targets)
install(TARGETS SQLite3
EXPORT SQLite3Targets
FILE_SET HEADERS)

install(FILES source/sqlite3.h
source/sqlite3ext.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
if(SQLITE_BUILD_SHELL)
install(TARGETS Shell
EXPORT SQLite3Targets)
endif()

# -- Export --------------------------------------------------------------------

install(EXPORT SQLite3Targets
FILE SQLite3Targets.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/SQLite3
NAMESPACE SQLite::)
NAMESPACE SQLite::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/SQLite3)

export(EXPORT SQLite3Targets
NAMESPACE SQLite::
FILE ${CMAKE_CURRENT_BINARY_DIR}/SQLite3Targets.cmake)

include(CMakePackageConfigHelpers)
Expand Down
36 changes: 36 additions & 0 deletions source/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,41 @@
# Changelog

## SQLite Release 3.47.0 On 2024-10-21

1. Allow arbitrary expressions in the second argument to the RAISE function.
2. If the RHS of the ->> operator is negative, then access array elements counting from the right.
3. Fix a problem with rolling back hot journal files in the seldom-used unix-dotfile VFS.
4. FTS5 tables can now be dropped even if they use a non-standard tokenizer that has not been registered.
5. Fix the group_concat() aggregate function so that it returns an empty string, not a NULL, if it receives a single input value which is an empty string.
6. Enhance the generate_series() table-valued function so that it is able to recognize and use constraints on its output value.
7. Preupdate hooks now recognize when a column added by ALTER TABLE ADD COLUMN has a non-null default value.
8. Performance optimizations:
1. Improved reuse of subqueries associated with the IN operator, especially when the IN operator has been duplicated due to predicate push-down.
2. Use a Bloom filter on subqueries on the right-hand side of the IN operator, in cases where that seems likely to improve performance.
3. Ensure that queries like "SELECT func(a) FROM tab GROUP BY 1" only invoke the func() function once per row.
4. No attempt is made to create automatic indexes on a column that is known to be non-selective because of its use in other indexes that have been analyzed.
5. Adjustments to the query planner so that it produces better plans for star queries with a large number of dimension tables.
6. Add the "order-by-subquery" optimization, that seeks to disable sort operations in outer queries if the desired order is obtained naturally due to ORDER BY clauses in subqueries.
7. The "indexed-subtype-expr" optimization strives to use expressions that are part of an index rather than recomputing the expression based on table values, as long as the query planner can prove that the subtype of the expression will never be used.
8. Miscellaneous coding tweaks for faster runtimes.
9. Enhancements to SQLite-related command-line programs:
1. Add the experimental sqlite3_rsync program.
2. Add extension functions median(), percentile(), percentile_cont(), and percentile_disc() to the CLI.
3. Add the .www dot-command to the CLI.
4. The sqlite3_analyzer utility now provides a break-out of statistics for WITHOUT ROWID tables.
5. The sqldiff utility avoids creating an empty database if its second argument does not exist.
10. Enhance the sqlite_dbpage table-valued function such that INSERT can be used to increase or decrease the size of the database file.
11. SQLite no longer makes any use of the "long double" data type, as hardware support for long double is becoming less common and long double creates challenges for some compiler tool chains. Instead, SQLite uses [Dekker's algorithm](https://csclub.uwaterloo.ca/~pbarfuss/dekker1971.pdf) when extended precision is needed.
12. The TCL Interface for SQLite supports TCL9. Everything probably still works for TCL 8.5 and later, though this is not guaranteed. Users are encouraged to upgrade to TCL9.
13. JavaScript/WASM:
1. Fix a corruption-causing bug in the JavaScript "opfs" VFS.
2. Correct "mode=ro" handling for the "opfs" VFS.
3. Work around a couple of browser-specific OPFS quirks.
14. FTS5 Changes:
1. Add the fts5_tokenizer_v2 API and the locale=1 option, for creating custom locale-aware tokenizers and fts5 tables that may take advantage of them.
2. Add the contentless_unindexed=1 option, for creating contentless fts5 tables that store the values of any UNINDEXED columns persistently in the database.
3. Allow an FTS5 table to be dropped even if it uses a custom tokenizer whose implementation is not available.

## SQLite Release 3.46.1 On 2024-08-13

1. Improved robustness while parsing the tokenize= arguments in FTS5. Forum post 171bcc2bcd.
Expand Down
16 changes: 8 additions & 8 deletions source/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Download: https://sqlite.org/2024/sqlite-amalgamation-3460100.zip
Download: https://sqlite.org/2024/sqlite-amalgamation-3470000.zip

```
Archive: sqlite-amalgamation-3460100.zip
Archive: sqlite-amalgamation-3470000.zip
Length Method Size Cmpr Date Time CRC-32 Name
-------- ------ ------- ---- ---------- ----- -------- ----
0 Stored 0 0% 2024-08-13 13:02 00000000 sqlite-amalgamation-3460100/
9089564 Defl:N 2341816 74% 2024-08-13 13:02 a9a33f43 sqlite-amalgamation-3460100/sqlite3.c
958266 Defl:N 247900 74% 2024-08-13 13:02 2a9cd0d9 sqlite-amalgamation-3460100/shell.c
644069 Defl:N 166685 74% 2024-08-13 13:02 e4c8855a sqlite-amalgamation-3460100/sqlite3.h
38149 Defl:N 6615 83% 2024-08-13 13:02 c5ea7fc8 sqlite-amalgamation-3460100/sqlite3ext.h
0 Stored 0 0% 2024-10-21 18:48 00000000 sqlite-amalgamation-3470000/
9193275 Defl:N 2367775 74% 2024-10-21 18:48 771e2638 sqlite-amalgamation-3470000/sqlite3.c
1044127 Defl:N 267023 74% 2024-10-21 18:48 c073b82b sqlite-amalgamation-3470000/shell.c
650689 Defl:N 168160 74% 2024-10-21 18:48 33ab194f sqlite-amalgamation-3470000/sqlite3.h
38149 Defl:N 6615 83% 2024-10-21 18:48 c5ea7fc8 sqlite-amalgamation-3470000/sqlite3ext.h
-------- ------- --- -------
10730048 2763016 74% 5 files
10926240 2809573 74% 5 files
```
Loading