Available

amalgame-sqlite

Embedded SQLite 3, public domain, zero system deps.

amc package add sqlite GitHub ↗ ← Back to the ecosystem

Overview

Direct binding to SQLite 3 vendored inside the package. No system library to install — the SQLite C code is compiled once, when the package is installed, then linked into your binary. Ideal for single-node apps, local development, and anything that does not need a separate DB server.

Features

  • ✓SQLite.Open(path), Exec, QueryAll, LastInsertId, Changes API
  • ✓Explicit transactions via SQLite.Begin / Commit / Rollback
  • ✓Parameterised queries (?) with ExecBind and QueryBindAll
  • ✓Public domain — no license friction
  • ✓Vendored: a single amc package add sqlite and it compiles

Planned

  • ◐Typed column accessors: today every cell comes back as text
  • ◐Prepared-statement reuse
  • ◐BLOBs and named parameters
  • ◐WAL mode helpers

Example

Minimal usage example — copy-paste runnable after install.

import Amalgame.Database.SQLite

public class Program {
    public static void Main() {
        let db = SQLite.Open("data.db")
        if (!SQLite.IsOpen(db)) {
            Console.WriteLine("open failed: " + SQLite.LastError(db))
            return
        }
        SQLite.Exec(db, "CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT)")

        let params = new List<string>()
        params.Add("Alice")
        SQLite.ExecBind(db, "INSERT INTO users (name) VALUES (?)", params)

        let rows = SQLite.QueryAll(db, "SELECT id, name FROM users")
        for row in rows {
            Console.WriteLine(row.Get(0) + " : " + row.Get(1))
        }
        SQLite.Close(db)
    }
}

At a glance

Related packages