package caqti
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=e1f580848faf3a54f23174067f2c75f77f6a2fe50ca8bc923428d0e1841192c5
sha512=7a11edfcfbbe4855347b066e222cf6bf46d1afedcd4978661b9a2b3931921faa1768a6bc24031fd3afa84537fe2adc8b139399deb77120461bee8fb394d68e82
doc/caqti/Caqti_query/index.html
Module Caqti_query
Source
Query specification.
type t =
| L of string
(*Literal code. May contain incomplete fragments.
*)| Q of string
(*
*)Q s
corresponds to aTEXT
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.| P of int
(*
*)P i
refers to parameter numberi
, counting from 0.| E of string
(*
*)E name
is expanded by the environemnt lookup function.| S of t list
(*
*)S frags
is the concatenation offrags
.
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.
A hash function compatible with equal
. This is currently Hashtbl.hash
.
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.
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.
concat sep frags
is frags
interfixed with sep
if frags
is non-empty and the empty string of frags
is empty.
A description of the error caused during expand
if the environment lookup function returns an invalid result or raises Not_found
for a variable when the expansion is final.
Prints an informative error.
The exception raised by expand
when there are issues expanding an environment variable using the provided callback.
expand f q
replaces each occurrence of E v
some some v
with f v
or leaves it unchanged where f v
raises Not_found
. The Not_found
exception will not escape this call.
Matches a single expression terminated by the end of input or a semicolon lookahead. The accepted languages is described in The Syntax of Query Templates.
A variant of angstrom_parser
which accepts unquoted semicolons as part of the a statement, which is allowed in some cases like for defining SQLite3 triggers. This is the parser used by Caqti_request
, where it's assumed that the input is a single SQL statement.
Parses a single expression using angstrom_parser_with_semicolon
. The error indicates the byte position of the input string where the parse failure occurred in addition to an error message. See The Syntax of Query Templates for how the input string is interpreted.