package caqti

  1. Overview
  2. Docs
Unified interface to relational database libraries

Install

Dune Dependency

Authors

Maintainers

Sources

caqti-v2.0.1.tbz
sha256=7eb57225c521fe25395653d960b1c381bb2b2ccae47bc2a827bb16611988da8b
sha512=eeafaf495b08fb8620ddee1711b8f9fa2ca0c79fb450a905c8d071806b7046d665e1e2ac0e7d3c7ca1258455decbf184e689e9ecb2453ec9d952b864f9dd14f4

doc/caqti.platform/Caqti_platform/Connection_utils/Make_convenience/argument-2-C/index.html

Parameter Make_convenience.C

Query

module Response : Caqti_response_sig.S with type 'a fiber := 'a Sys.Fiber.t and type ('a, 'err) stream := ('a, 'err) Sys.Stream.t
val call : f:(('b, 'm) Response.t -> ('c, 'e) result Sys.Fiber.t) -> ('a, 'b, 'm) Caqti_request.t -> 'a -> ('c, [> Caqti_error.call ] as 'e) result Sys.Fiber.t

call ~f request params executes request with parameters params invoking f to process the result; except the driver may postpone the request until f attempts to retrieve the result.

One of the result retrieval functions must be called exactly once before f returns a non-error result. If a result retrieval function is not called, it is unspecified whether the database query has been issued.

The argument of f is only valid during the call to f, and must not be returned or operated on by other threads.

val set_statement_timeout : float option -> (unit, [> Caqti_error.call ]) result Sys.Fiber.t

Set or clear the timeout after which a running SQL statement will be terminated if supported by the driver. This is currently supported for MariaDB (using max_statement_time) and PostgreSQL (using statement_timeout) and has no effect for SQLite3.

Transactions

val start : unit -> (unit, [> Caqti_error.transact ]) result Sys.Fiber.t

Starts a transaction if supported by the underlying database, otherwise does nothing.

val commit : unit -> (unit, [> Caqti_error.transact ]) result Sys.Fiber.t

Commits the current transaction if supported by the underlying database, otherwise does nothing.

val rollback : unit -> (unit, [> Caqti_error.transact ]) result Sys.Fiber.t

Rolls back a transaction if supported by the underlying database, otherwise does nothing.

Disconnection and Reuse

val deallocate : ('a, 'b, 'm) Caqti_request.t -> (unit, [> Caqti_error.call ]) result Sys.Fiber.t

deallocate req deallocates the prepared query for req if it was allocated. The request must not be oneshot.

val disconnect : unit -> unit Sys.Fiber.t

Calling disconnect () closes the connection to the database and frees up related resources.

val validate : unit -> bool Sys.Fiber.t

For internal use by pool implementations. Tries to ensure the validity of the connection and must return false if unsuccessful.

val check : (bool -> unit) -> unit

For internal use by pool implementations. Called after a connection has been used. check f must call f () exactly once with an argument indicating whether to keep the connection in the pool or discard it.

OCaml

Innovation. Community. Security.