1
0
Fork
You've already forked sigil-sqlite
0
SQLite database bindings for Sigil.
  • C 99.2%
  • Scheme 0.8%
Find a file
David Wilson 1702cc9b2c
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Relock off retired sigil-lang; build against sigil 0.17.1
Repoint the core sigil.lock entry codeberg:sigil/sigil-lang ->
codeberg:sigil/sigil and regenerate via sigil deps install. Bump the sigil
pin to ^0.17 (stdlib resolves 0.17.1). Patch version bump to 0.16.1.
2026年06月28日 16:19:56 +03:00
docs docs: Add package documentation for sigil-args, sigil-test, and sigil-sqlite 2026年02月19日 16:12:41 +02:00
native Replace sigil-internal.h with public sigil/sigil.h in native modules 2026年04月01日 12:40:59 +03:00
src/sigil Integrate content-addressable store with build system 2026年03月01日 20:48:23 +02:00
test Extract sigil-sqlite from sigil monorepo 2026年04月24日 21:48:27 +03:00
vendor Enable FTS5 in sigil-sqlite 2026年03月31日 11:18:32 +03:00
.gitignore Extract sigil-sqlite from sigil monorepo 2026年04月24日 21:48:27 +03:00
.woodpecker.yml Bump CI pin to sigil v0.14.3 2026年04月26日 20:18:13 +03:00
dev-redirects.sgl Extract sigil-sqlite from sigil monorepo 2026年04月24日 21:48:27 +03:00
manifest.scm Extract sigil-sqlite from sigil monorepo 2026年04月24日 21:48:27 +03:00
package.sgl Relock off retired sigil-lang; build against sigil 0.17.1 2026年06月28日 16:19:56 +03:00
README.md Extract sigil-sqlite from sigil monorepo 2026年04月24日 21:48:27 +03:00
sigil.lock Relock off retired sigil-lang; build against sigil 0.17.1 2026年06月28日 16:19:56 +03:00

sigil-sqlite

SQLite database bindings for Sigil.

Embeddable SQLite access backed by the SQLite amalgamation compiled in-tree. Suitable for application data, local caches, and anywhere a full relational database is overkill.

Modules

Module Purpose
(sigil sqlite) SQLite database bindings (low + high API)

API summary

Database

Procedure Purpose
sqlite-open Open database (or ":memory:")
sqlite-close Close a database handle
sqlite-exec Execute a SQL string (DDL, simple queries)
call-with-database Open + run a proc + close, with cleanup

Prepared statements

Procedure Purpose
sqlite-prepare Compile a SQL statement
sqlite-bind Bind a parameter (1-based index)
sqlite-step Advance: 'row, 'done, or #f
sqlite-reset Reset a statement to its initial state
sqlite-finalize Free a statement

Column access

Procedure Purpose
sqlite-column-count Number of columns in the current row
sqlite-column-name Column name by 0-based index
sqlite-column Column value by 0-based index

Database info

Procedure Purpose
sqlite-last-insert-rowid rowid of the last insert
sqlite-changes Rows changed by the last statement
sqlite-errmsg Last error message

High-level helpers

Procedure Purpose
sqlite-query Run query; return all rows as alists
sqlite-query-row Run query; return first row or #f
sqlite-run Run INSERT/UPDATE/DELETE with parameters

Predicates

Procedure Purpose
sqlite-db? SQLite database handle predicate
sqlite-stmt? Prepared statement predicate

System prerequisites

None beyond a working C toolchain. The SQLite amalgamation (vendor/sqlite3.c + vendor/sqlite3.h) is vendored and compiled in-tree with these build flags:

  • -DSQLITE_THREADSAFE=0
  • -DSQLITE_OMIT_LOAD_EXTENSION
  • -DSQLITE_ENABLE_FTS5

Dependencies

  • sigil-stdlib

Build

sigil deps install
sigil build
sigil test --report

The first build compiles the SQLite amalgamation (one large translation unit) plus native/sqlite.c. Subsequent builds hit the cache.

Usage

(import (sigil sqlite))
(call-with-database "app.db"
 (lambda (db)
 (sqlite-exec db "CREATE TABLE IF NOT EXISTS users
 (id INTEGER PRIMARY KEY, name TEXT)")
 (sqlite-run db "INSERT INTO users (name) VALUES (?)" "Alice")
 (sqlite-query db "SELECT * FROM users")))
;; => (((id . 1) (name . "Alice")))

License

BSD-3-Clause.

Vendored SQLite (under vendor/) is public domain. See vendor/sqlite3.c for the SQLite blessing.