package caqti

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

Install

dune-project
 Dependency

Authors

Maintainers

Sources

caqti-v1.6.0.tbz
sha256=1bf0c0d60547033c10d6148cf5297b25ab66c9a2832b680329df2f3816bc674d
sha512=0b03bd1788d99bbac59679338768a5633ec473346eed333fca4c104bc88f04c24e138af2228fc20dcf295b7106778328d228643ae8235a3f722f54cc69919295

doc/caqti/Caqti_query/index.html

Module Caqti_querySource

Query specification.

Sourcetype t =
  1. | L of string
    (*

    Literal code. May contain incomplete fragments.

    *)
  2. | Q of string
    (*

    Q s corresponds to a TEXT literal; passed as part of the query string if a suitable quoting function is available in the client library, otherwise passed as an additional parameter.

    *)
  3. | P of int
    (*

    P i refers to parameter number i, counting from 0.

    *)
  4. | S of t list
    (*

    S frags is the concatenation of frags.

    *)

A representation of a query string to send to a database, abstracting over parameter references and providing nested concatenation to simplify generation. For databases which only support linear parameters (typically denoted "?"), the driver will reshuffle, elide, and duplicate parameters as needed.

Sourceval normal : t -> t

normal q rewrites q to a normal form containing at most one top-level S constructor, containing no empty literals, and no consecutive literals. This function can be used to post-process queries before using equal and hash.

Sourceval equal : t -> t -> bool

Equality predicate for query.

Sourceval hash : t -> int

A hash function compatible with equal. This is currently Hashtbl.hash.

Sourceval pp : Format.formatter -> t -> unit

pp ppf q prints a human-readable representation of q on ppf. The printed string is not suitable for sending to an SQL database; doing so may lead to an SQL injection vulnerability.

Sourceval show : t -> string

show q is the same human-readable representation of q as printed by pp. The returned string is not suitable for sending to an SQL database; doing so may lead to an SQL injection vulnerability.

Sourceval concat : string -> t list -> t

concat sep frags is frags interfixed with sep if frags is non-empty and the empty string of frags is empty.