Skip to content

Commit f316421

Browse files
authored
Embed sqlite amalgamation v3.45.1 source code (#63)
* Test cleanup * Speed up vendoring command by a dozen orders of magnitude * Embed sqlite amalgamation v3.45.1 source code
1 parent e998284 commit f316421

File tree

6 files changed

+147
-100
lines changed

6 files changed

+147
-100
lines changed

Plugins/VendorSQLite/VendorSQLite3.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,13 @@ struct VendorSQLite: CommandPlugin {
225225
let writer = try FileHandle(forWritingTo: outputFile.fileUrl)
226226
defer { try? writer.close() }
227227

228-
Diagnostics.verbose("Prefixing symbols in \(file.lastComponent)...")
228+
let minimalCommonPrefix = symbols.reduce(symbols[0]) { $1.commonPrefix(with: $0, options: .literal)[...] }
229+
230+
Diagnostics.verbose("Prefixing symbols in \(file.lastComponent) (minimum prefix \(minimalCommonPrefix))...")
229231
for try await line in reader.bytes.keepingEmptySubsequencesLines {
230-
let oline = line.isEmpty ? "" : symbols.reduce(line, { $0.replacingOccurrences(of: $1, with: "\(Self.vendorPrefix)_\($1)") })
232+
let oline = line.contains(minimalCommonPrefix) ?
233+
symbols.reduce(line, { $0.replacingOccurrences(of: $1, with: "\(Self.vendorPrefix)_\($1)") }) :
234+
line
231235

232236
try writer.write(contentsOf: Array("\(oline)\n".utf8))
233237
}

Sources/CSQLite/include/sqlite_nio_sqlite3.h

Lines changed: 3 additions & 3 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.45.0"
150-
#define SQLITE_VERSION_NUMBER 3045000
151-
#define SQLITE_SOURCE_ID "2024-01-15 17:01:13 1066602b2b1976fe58b5150777cced894af17c803e068f5918390d6915b46e1d"
149+
#define SQLITE_VERSION "3.45.1"
150+
#define SQLITE_VERSION_NUMBER 3045001
151+
#define SQLITE_SOURCE_ID "2024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257cc467a"
152152

153153
/*
154154
** CAPI3REF: Run-Time Library Version Numbers

0 commit comments

Comments
 (0)