UCE Docs / sqlite_connect

Signature

SQLite* sqlite_connect(String path)

Parameters

path : filesystem path to the SQLite database file
return value : pointer to a SQLite connection struct

Opens an SQLite database file and returns a connection handle.

UCE opens SQLite with serialized/full-mutex connection mode, sets a busy timeout, enables foreign keys, and applies WAL-oriented defaults:

PRAGMA busy_timeout = 5000;
PRAGMA foreign_keys = ON;
PRAGMA journal_mode = WAL;
PRAGMA synchronous = NORMAL;

SQLite itself handles file locking and one-writer/many-reader concurrency. UCE does not add a separate app-level database lock.

Connections are registered for request cleanup, but explicit sqlite_disconnect() is still preferred when you are done with the handle.

Example

SQLite* db = sqlite_connect("/tmp/doc-sqlite-connect.db");
sqlite_query(db, "create table if not exists t(id integer primary key, name text)");
print(db != 0 ? "connected" : "failed to connect", "\n");
sqlite_disconnect(db);
Output
connected