Skip to content

Custom SQL functions, schema builder, CI, and cross-platform build support - #2

Merged
colemancda merged 18 commits into
masterfrom
feature/android
Jul 17, 2026
Merged

colemancda merged 18 commits into
masterfrom
feature/android

Conversation

@colemancda

@colemancda colemancda commented Jul 16, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Add Connection.createFunction/createAggregateFunction/createWindowFunction/createCollation (and matching removal methods), wrapping sqlite3_create_function_v2, sqlite3_create_window_function, and sqlite3_create_collation_v2 for scalar, aggregate, window, and collation SQL extensions.
  • Add Connection.run/scalar/transaction, a PreparedStatement cursor (prepare, failableNext, rowDictionaries), a Blob convenience type, and a minimal SchemaChanger/ColumnDefinition DDL builder (CREATE TABLE, primary key, foreign key, unique, default, nullable).
  • Fix Connection.init(path:isReadOnly:), which never forwarded isReadOnly to sqlite3_open_v2, and a related crash reading filename on connections with no backing file (e.g. :memory:).
  • Depend on PureSwift/swift-sqlcipher for the C SQLite implementation on non-Darwin platforms (Linux, Android, Windows, WASI, OpenBSD); Darwin keeps linking the system SQLite3 framework.
  • Prefer FoundationEssentials over full Foundation where sufficient (Data, UUID, Date, URLComponents), falling back to Foundation only where needed (ISO8601DateFormatter).
  • Support building as a dynamic library via SWIFT_BUILD_DYNAMIC_LIBRARY, for Skip Tools interop.
  • Add CI: macOS (macos-26), Linux (swift:6.3.3 container), and Android (via skiptools/swift-android-action) jobs, running on every push.
  • Port relevant tests from stephencelis/SQLite.swift's suite adapted to this package's API, plus new tests covering aggregate/window/collation functions.

Test plan

  • swift build / swift test on macOS — all tests pass.
  • swift build / swift test under docker run swift:6.3.3 — all tests pass, including the swift-sqlcipher dependency and FoundationEssentials imports.

Mirrors colemancda/junkbot-swift's swift-windows.yml pattern: installs
the toolchain via compnerd/gha-setup-swift, then builds and tests.
sqlite3_db_filename() returns the OS-native path, which on Windows uses
backslashes, while Bundle.module.path(forResource:) returns a forward-slash
path. Normalize before comparing so these tests pass on Windows too.
/tmp isn't a valid path on Windows, so opening a read-write connection
there fails at connection time (SQLITE_CANTOPEN) rather than exercising
the intended statement-prepare failure the tests were checking for.
@colemancda
colemancda merged commit 10157d6 into master Jul 17, 2026
8 checks passed
@colemancda
colemancda deleted the feature/android branch July 17, 2026 00:26
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.

1 participant