package caqti-driver-postgresql
Module Caqti_driver_postgresqlSource
PostgreSQL driver for Caqti (bindings).
This driver is implemented in terms of the postgresql OPAM package which provides bindings for the PostgreSQL C client library.
It handles URIs of the form
postgresql://<user>:<password>@<host>:<port>/<rest>which are passed verbatim to Postgresql.connection, except as noted below, and URIs of the form postgresql://<query> which are first split into <key> = '<value>' form.
In addition to libpq parameters, the following will be interpreted by Caqti and stripped of before passing the URI to libpq:
notice_processingcan be set toquite(the default) to suppress notices or tostderrto let libpq emit notices to standard error.
use_single_row_modecan be set totrueto enable single row mode for queries which may return more than one row. The default isfalsebecause it is significantly faster. Single row mode is needed if query results may exceed whan can be stored in memory, but consider batching the results withLIMITandOFFSETinstead for better perfomance.
The interface provided by this module should normally not be used by applications, but provides access to some PostgreSQL specifics in case they are needed.
Error Details
The following gives access to diagnostics collected from the PostgreSQL connection and result objects.
type Caqti_error.msg += | Connect_error_msg of {error : Postgresql.error;(*The exception raised by postgresql-ocaml.
*)
}(*An exception was raised while attempting to connect to the database.
*)| Connection_error_msg of {error : Postgresql.error;(*The exception raised by postgresql-ocaml.
*)connection_status : Postgresql.connection_status;(*The connection status reported by
*)PQstatus.
}(*An exception was raised while operating on the database connection.
*)| Result_error_msg of {error_message : string;(*The error message from
*)PQresultErrorMessage.sqlstate : string;(*The SQLSTATE error field.
*)
}(*An error was reported on the result from a database operation.
*)