libs/sql
SQLite3 Database Driver & Fluent Query Builder
Embedded relational database connectivity for Kale applications. Provides safe wrappers for SQLite3 connection handles, parameterized prepared statements with positional and named bindings, transaction rollbacks, and a fluent query builder.

High-Throughput Systems Foundation
Engineered to maximize CPU instruction pipelining and data cache locality. Every algorithm avoids heap pointer indirection wherever contiguous stack or arena buffers can be employed.

import "libs/sql/db.kl" as sql;
fn main() -> int32 {
let db: sql.Database = sql.open("data/kale.db");
sql.exec(&db, "CREATE TABLE IF NOT EXISTS projects (id INTEGER PRIMARY KEY, name TEXT, tier TEXT);");
let stmt: sql.Statement = sql.prepare(&db, "INSERT INTO projects (name, tier) VALUES (?, ?);");
sql.bind_text(&stmt, 1, "libs/render");
sql.bind_text(&stmt, 2, "Foundation");
sql.step(&stmt);
sql.finalize(&stmt);
sql.close(&db);
return 0;
}Deterministic command-line invocations to build, link native dynamic dependencies, and run automated regression tests:
kale build tests/test_sql.kl -o bin/test_sql.exe -lsqlite3./bin/test_sql.exeGPG Key 1B917D4779A6102E • Continuous integration with automated symbol verification.
Zero-allocation statement execution with parameterized value binding to prevent SQL injection.
Construct SELECT, INSERT, UPDATE, and DELETE queries through a type-checked builder interface.
Iterate across millions of database rows with minimal memory footprint.