package postgres_async

  1. Overview
  2. Docs

Module Postgres_async.PrivateSource

Sourcemodule Protocol : sig ... end
Sourcemodule Types : sig ... end
Sourceval pgasync_error_of_error : Core.Error.t -> Pgasync_error.t
Sourceval pq_cancel : t -> unit Core.Or_error.t Async.Deferred.t
Sourcemodule Simple_query_result : sig ... end
Sourceval simple_query : ?handle_columns:(Column_metadata.t array -> unit) -> t -> string -> handle_row:(column_names:string array -> values:string option array -> unit) -> Simple_query_result.t Async.Deferred.t

Executes a query according to the Postgres Simple Query protocol. As specified in the protocol, multiple commands can be chained together using semicolons and executed in one operation. If not already in a transaction, the query is treated as transaction and all commands within it are executed atomically.

handle_columns is called on each column row description message. Note that with simple_query, it's possible that multiple row description messages are sent (as a simple query can contain multiple statements that return rows).

handle_row is called for every row returned by the query.

If a Pgasync_error.t is returned, this indicates that the connection was closed during processing. The query may or may not have successfully ran from the server's perspective.

Queries containing COPY FROM STDIN will fail as this function does not support this operation. Queries containing COPY TO STDOUT will succeed, but the copydata will not be delivered to handle_row, and a warning will appear in Simple_query_status

Sourceval execute_simple : t -> string -> Simple_query_result.t Async.Deferred.t

Executes a query that should not return any rows using the Postgres Simple Query Protocol . As with simple_query, multiple commands can be chained together using semicolons. Inherits the transaction behavior of simple_query.

If any of the queries fails, or returns at least one row, an error will be returned and the transaction will be aborted.

As with simple_query, queries containing COPY FROM STDIN will fail.

OCaml

Innovation. Community. Security.