class virtual statement : connection -> object end
method virtual execute : sql_t list -> unit
Execute the statement with the given list of arguments substituted
* for ?
placeholders in the query string. This method should
* be executed before trying to fetch data.
*
* This command can throw a variety of SQL-specific exceptions.
method virtual fetch1 : unit -> sql_t list
Fetches one row from the result set and returns it.
*
RaisesNot_found
if no tuple is returned by the database.
*
Failure
if #execute
has not been issued before.
method fetch1int : unit -> int
This fetches a single integer field.
*
RaisesNot_found
if no tuples are remaining.
*
Invalid_argument
if the tuple does not contain a single integer.
*
Failure
if #execute
has not been issued before.
method fetch1string : unit -> string
This fetches a single string field.
*
RaisesNot_found
if no tuples are remaining.
*
Invalid_argument
if the tuple does not contain a single string.
*
Failure
if #execute
has not been issued before.
method fetchall : unit -> sql_t list list
This returns a list of all tuples returned from the query. Note
* that this may be less efficient than reading them one at a time.
*
Raises Failure
if #execute
has not been issued before.
method iter : (sql_t list -> unit) -> unit
Iterate over the result tuples.
*
Raises Failure
if #execute
has not been issued before.
method map : 'a. (sql_t list -> 'a) -> 'a list
Map over the result tuples.
*
Raises Failure
if #execute
has not been issued before.
method fold_left : 'b. ('b -> sql_t list -> 'b) -> 'b -> 'b
Fold left over the result tuples.
*
Raises Failure
if #execute
has not been issued before.
method fold_right : 'c. (sql_t list -> 'c -> 'c) -> 'c -> 'c
Fold right over the result tuples. Not tail-recursive.
*
Raises Failure
if #execute
has not been issued before.
method virtual names : string list
Returns the names of the columns of the result.
*
Raises Failure
if #execute
has not been issued before.
method fetch1hash : unit -> (string * sql_t) list
Fetches a row and return it as an association list of pairs
* (column name, value).
*
Raises Not_found
if there are no more rows to fetch.
method virtual serial : string -> int
If the statement is an INSERT and has been executed, then some
* databases support retrieving the serial number of the INSERT
* statement (assuming there is a SERIAL column or SEQUENCE attached
* to the table). The string parameter is the sequence name, which
* is only required by some database types. See the specific documentation
* for your database for more information.
*
RaisesNot_found
if the serial number is not available.
*
Failure
if #execute
has not been issued before.
method finish : unit -> unit
"Finishes" the statement. This basically just frees up any memory
* associated with the statement (this memory would be freed up by the
* GC later anyway). After calling #finish
you may call #execute
to
* begin executing another query.
method connection : connection
Return the database handle associated with this statement handle.