|
NAMEksql —
yet another SQLite wrapper
LIBRARYlibrary “ksql”SYNOPSIS#include <sys/types.h>
#include <stdint.h>
#include <ksql.h>
DESCRIPTIONTheksql library is a “lazy man's” wrapper
of a minimal subset of the SQLite C API. It makes interfacing with SQLite easy
and fast for you, and safe for your database.
The typical usage scenario is as follows:
There's also support for maintaining transactional consistency with ksql_trans_open(3) and ksql_trans_commit(3). Invoke “apropos ksql” to see all functions. The current version of the database is defined in
Database safetyBy default (see ksql_alloc(3) and ksql_alloc_child(3)), the library will invoke exit(3) if any of the database functions fail. “Failure” means that any SQLite function (for example, stepping for result rows or binding parameters) that fails will trigger exit.It will also register an atexit(3) hook that will clean up any open database connections, transactions, and open statements. Lastly, it will intercept the All of these safety measures can be disabled by providing the appropriate flags to ksql_alloc(3) or ksql_alloc_child(3). Compiling and linkingTo compile withksql , use the header file
<ksql.h> . For linking, use
-l ksql
-l sqlite3.
Access protocolSince SQLite uses a busy-wait approach,ksql will sleep
for random intervals between attempts returning
SQLITE_BUSY or SQLITE_LOCKED .
Within the first 10 attempts, the random interval is within 1/4 second. Within
the 10–100 attempts, within 1/10 second. Greater than 100 attempts,
1/100 second. This scheme benefits longer waiters.
Functions using this algorithm are ksql_exec(3), ksql_stmt_step(3) and ksql_stmt_cstep(3), and ksql_stmt_alloc(3). Pledge PromisesTheksql library is built to operate in
security-sensitive environments, including
pledge(2)
on OpenBSD.
If running in single-process mode (i.e., with ksql_alloc(3)), the stdio rpath cpath wpath flock fattr pledges are required for all functions. If in split-process mode (with ksql_alloc_child(3)), then stdio rpath cpath wpath flock proc fattr is required for ksql_alloc_child(3), and only stdio otherwise. SEE ALSOksql_alloc(3), ksql_alloc_child(3), ksql_bind_blob(3), ksql_bind_bytes(3), ksql_bind_double(3), ksql_bind_int(3), ksql_bind_str(3), ksql_bind_zblob(3), ksql_cfg_defaults(3), ksql_close(3), ksql_exec(3), ksql_free(3), ksql_lastid(3), ksql_open(3), ksql_role(3), ksql_stmt_alloc(3), ksql_stmt_blob(3), ksql_stmt_bytes(3), ksql_stmt_cstep(3), ksql_stmt_double(3), ksql_stmt_free(3), ksql_stmt_int(3), ksql_stmt_isnull(3), ksql_stmt_reset(3), ksql_stmt_step(3), ksql_stmt_str(3), ksql_trans_commit(3), ksql_trans_exclopen(3), ksql_trans_functions(3), ksql_trans_open(3), ksql_trans_rollback(3), sqlite3(3)CAVEATSThis library is not thread-safe and does not plan to be.
Visit the GSP FreeBSD Man Page Interface. |