uce/site/doc/pages/sqlite_connect.txt
2026-06-16 12:21:31 +00:00

32 lines
937 B
Plaintext

:sig
SQLite* sqlite_connect(String path)
:params
path : filesystem path to the SQLite database file
return value : pointer to a SQLite connection struct
:see
>sqlite
sqlite_query
sqlite_error
sqlite_disconnect
:content
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:
```sql
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
print("sqlite_connect is resource-bound; configure the service or connection, then call it in request code.\n");