Skip to content

Commit 256c6b8

Browse files
authored
Embed sqlite amalgamation 3.48.0 source code and fix Sendable warnings (#79)
* Embed sqlite amalgamation 3.48.0 source code * Bump Swift minimum to 5.9 * Fix Sendable warnings * Update API docs theme
1 parent 7353cca commit 256c6b8

File tree

8 files changed

+1292
-812
lines changed

8 files changed

+1292
-812
lines changed

Package.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.8
1+
// swift-tools-version:5.9
22
import PackageDescription
33

44
let package = Package(
@@ -21,7 +21,10 @@ let package = Package(
2121
name: "VendorSQLite",
2222
capability: .command(
2323
intent: .custom(verb: "vendor-sqlite", description: "Vendor SQLite"),
24-
permissions: [/*.writeToPackageDirectory(reason: "Update the vendored SQLite files")*/]
24+
permissions: [
25+
.allowNetworkConnections(scope: .all(ports: [443]), reason: "Retrieve the latest build of SQLite"),
26+
.writeToPackageDirectory(reason: "Update the vendored SQLite files"),
27+
]
2528
),
2629
exclude: ["001-warnings-and-data-race.patch"]
2730
),
@@ -51,8 +54,11 @@ let package = Package(
5154
)
5255

5356
var swiftSettings: [SwiftSetting] { [
57+
.enableUpcomingFeature("ExistentialAny"),
5458
.enableUpcomingFeature("ConciseMagicFile"),
5559
.enableUpcomingFeature("ForwardTrailingClosures"),
60+
.enableUpcomingFeature("DisableOutwardActorInference"),
61+
.enableExperimentalFeature("StrictConcurrency=complete"),
5662
] }
5763

5864
var sqliteCSettings: [CSetting] { [

[email protected]

Lines changed: 0 additions & 99 deletions
This file was deleted.

Sources/CSQLite/include/sqlite_nio_sqlite3.h

Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,9 @@ extern "C" {
146146
** [sqlite_nio_sqlite3_libversion_number()], [sqlite_nio_sqlite3_sourceid()],
147147
** [sqlite_version()] and [sqlite_source_id()].
148148
*/
149-
#define SQLITE_VERSION "3.47.2"
150-
#define SQLITE_VERSION_NUMBER 3047002
151-
#define SQLITE_SOURCE_ID "2024-12-07 20:39:59 2aabe05e2e8cae4847a802ee2daddc1d7413d8fc560254d93ee3e72c14685b6c"
149+
#define SQLITE_VERSION "3.48.0"
150+
#define SQLITE_VERSION_NUMBER 3048000
151+
#define SQLITE_SOURCE_ID "2025-01-14 11:05:00 d2fe6b05f38d9d7cd78c5d252e99ac59f1aea071d669830c1ffe4e8966e84010"
152152

153153
/*
154154
** CAPI3REF: Run-Time Library Version Numbers
@@ -1100,6 +1100,11 @@ struct sqlite3_io_methods {
11001100
** pointed to by the pArg argument. This capability is used during testing
11011101
** and only needs to be supported when SQLITE_TEST is defined.
11021102
**
1103+
** <li>[[SQLITE_FCNTL_NULL_IO]]
1104+
** The [SQLITE_FCNTL_NULL_IO] opcode sets the low-level file descriptor
1105+
** or file handle for the [sqlite3_file] object such that it will no longer
1106+
** read or write to the database file.
1107+
**
11031108
** <li>[[SQLITE_FCNTL_WAL_BLOCK]]
11041109
** The [SQLITE_FCNTL_WAL_BLOCK] is a signal to the VFS layer that it might
11051110
** be advantageous to block on the next WAL lock if the lock is not immediately
@@ -1253,6 +1258,7 @@ struct sqlite3_io_methods {
12531258
#define SQLITE_FCNTL_EXTERNAL_READER 40
12541259
#define SQLITE_FCNTL_CKSM_FILE 41
12551260
#define SQLITE_FCNTL_RESET_CACHE 42
1261+
#define SQLITE_FCNTL_NULL_IO 43
12561262

12571263
/* deprecated names */
12581264
#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
@@ -2631,10 +2637,14 @@ SQLITE_API void sqlite_nio_sqlite3_set_last_insert_rowid(sqlite3*,sqlite3_int64)
26312637
** deleted by the most recently completed INSERT, UPDATE or DELETE
26322638
** statement on the database connection specified by the only parameter.
26332639
** The two functions are identical except for the type of the return value
2634-
** and that if the number of rows modified by the most recent INSERT, UPDATE
2640+
** and that if the number of rows modified by the most recent INSERT, UPDATE,
26352641
** or DELETE is greater than the maximum value supported by type "int", then
26362642
** the return value of sqlite_nio_sqlite3_changes() is undefined. ^Executing any other
26372643
** type of SQL statement does not modify the value returned by these functions.
2644+
** For the purposes of this interface, a CREATE TABLE AS SELECT statement
2645+
** does not count as an INSERT, UPDATE or DELETE statement and hence the rows
2646+
** added to the new table by the CREATE TABLE AS SELECT statement are not
2647+
** counted.
26382648
**
26392649
** ^Only changes made directly by the INSERT, UPDATE or DELETE statement are
26402650
** considered - auxiliary changes caused by [CREATE TRIGGER | triggers],
@@ -4194,11 +4204,22 @@ SQLITE_API int sqlite_nio_sqlite3_limit(sqlite3*, int id, int newVal);
41944204
** <dd>The SQLITE_PREPARE_NO_VTAB flag causes the SQL compiler
41954205
** to return an error (error code SQLITE_ERROR) if the statement uses
41964206
** any virtual tables.
4207+
**
4208+
** [[SQLITE_PREPARE_DONT_LOG]] <dt>SQLITE_PREPARE_DONT_LOG</dt>
4209+
** <dd>The SQLITE_PREPARE_DONT_LOG flag prevents SQL compiler
4210+
** errors from being sent to the error log defined by
4211+
** [SQLITE_CONFIG_LOG]. This can be used, for example, to do test
4212+
** compiles to see if some SQL syntax is well-formed, without generating
4213+
** messages on the global error log when it is not. If the test compile
4214+
** fails, the sqlite_nio_sqlite3_prepare_v3() call returns the same error indications
4215+
** with or without this flag; it just omits the call to [sqlite_nio_sqlite3_log()] that
4216+
** logs the error.
41974217
** </dl>
41984218
*/
41994219
#define SQLITE_PREPARE_PERSISTENT 0x01
42004220
#define SQLITE_PREPARE_NORMALIZE 0x02
42014221
#define SQLITE_PREPARE_NO_VTAB 0x04
4222+
#define SQLITE_PREPARE_DONT_LOG 0x10
42024223

42034224
/*
42044225
** CAPI3REF: Compiling An SQL Statement
@@ -10889,7 +10910,7 @@ SQLITE_API int sqlite3_deserialize(
1088910910
#ifdef __cplusplus
1089010911
} /* End of the 'extern "C"' block */
1089110912
#endif
10892-
#endif /* SQLITE3_H */
10913+
/* #endif for SQLITE3_H will be added by mksqlite3.tcl */
1089310914

1089410915
/******** Begin file sqlite3rtree.h *********/
1089510916
/*
@@ -13140,14 +13161,29 @@ struct Fts5PhraseIter {
1314013161
** value returned by xInstCount(), SQLITE_RANGE is returned. Otherwise,
1314113162
** output variable (*ppToken) is set to point to a buffer containing the
1314213163
** matching document token, and (*pnToken) to the size of that buffer in
13143-
** bytes. This API is not available if the specified token matches a
13144-
** prefix query term. In that case both output variables are always set
13145-
** to 0.
13164+
** bytes.
1314613165
**
1314713166
** The output text is not a copy of the document text that was tokenized.
1314813167
** It is the output of the tokenizer module. For tokendata=1 tables, this
1314913168
** includes any embedded 0x00 and trailing data.
1315013169
**
13170+
** This API may be slow in some cases if the token identified by parameters
13171+
** iIdx and iToken matched a prefix token in the query. In most cases, the
13172+
** first call to this API for each prefix token in the query is forced
13173+
** to scan the portion of the full-text index that matches the prefix
13174+
** token to collect the extra data required by this API. If the prefix
13175+
** token matches a large number of token instances in the document set,
13176+
** this may be a performance problem.
13177+
**
13178+
** If the user knows in advance that a query may use this API for a
13179+
** prefix token, FTS5 may be configured to collect all required data as part
13180+
** of the initial querying of the full-text index, avoiding the second scan
13181+
** entirely. This also causes prefix queries that do not use this API to
13182+
** run more slowly and use more memory. FTS5 may be configured in this way
13183+
** either on a per-table basis using the [FTS5 insttoken | 'insttoken']
13184+
** option, or on a per-query basis using the
13185+
** [fts5_insttoken | fts5_insttoken()] user function.
13186+
**
1315113187
** This API can be quite slow if used with an FTS5 table created with the
1315213188
** "detail=none" or "detail=column" option.
1315313189
**
@@ -13581,3 +13617,4 @@ struct fts5_api {
1358113617
#endif /* _FTS5_H */
1358213618

1358313619
/******** End of fts5.h *********/
13620+
#endif /* SQLITE3_H */

0 commit comments

Comments
 (0)