March Docs

Db

lib/driver/db.march Abstract database connection — driver seam between the wire layer and all higher-level depot modules.

This module does NOT import Sqlite. SQLite dispatch is provided as a concrete SqliteOps record in SqliteConn, so the Ffi capability stays contained in lib/driver/sqlite.march. Callers that only import Db do not inherit Ffi requirements.

Adding a new backend:

  1. Add a constructor to DbConn.
  2. Provide an open_* function in the backend module (see Sqlite.open_conn).
  3. Add dispatch arms to exec/query/dialect/close/conn_key below.

Types

typeConnResultConnResult = {#
typeSqliteOpsSqliteOps = {#
typeDbConnDbConn = PostgresConn(ConnState) | SqliteConn(SqliteOps)#

Functions

fncloseclose(conn)#
fnconn_keyconn_key(conn)#
fndialectdialect(conn)#
fnexecexec(conn, sql, params)#
fnfrom_postgresfrom_postgres(c)#
fnpingping(conn)#
fnqueryquery(conn, sql)#