ORM-DB-SQLite

SQLite3 backend for the orm abstract database interface.

Description

orm-db-sqlite implements the orm-db backend protocol on top of CHICKEN's sqlite3 bindings. It provides a single constructor, sqlite3-backend, which returns a backend alist suitable for db/backend. SQL is generated through the ssql egg using a registered sqlite3 dialect.

Requirements

Installation

chicken-install orm-db-sqlite

Basic Usage

(import orm-db orm-db-sqlite orm)

;; Select the backend and open a file-based database
(db/backend (sqlite3-backend))
(db/path "myapp.db")
(db/connect)

(define-model users)
(users/all)

(db/close)

The db/path value is a SQLite database file path. Use ":memory:" for a transient in-memory database.

(db/path ":memory:")

API

[procedure] (sqlite3-backend)

Returns a backend alist implementing the orm-db protocol — the keys connect, close, query, and execute — backed by the sqlite3 egg. Pass the result to db/backend.

(db/backend (sqlite3-backend))

The backend procedures are used by orm-db; you do not normally call them directly:

SQL Dialect

The backend registers an ssql sqlite3 dialect (derived from the ANSI translator) so ssql S-expression forms passed to db/query / db/execute render as SQLite-compatible SQL. Raw SQL strings are passed through unchanged.

License

Copyright © 2026 Rolando Abarca. Released under the BSD-3-Clause license.

Repository

Part of the chicken-orm-egg project. See orm for the ORM itself.