class virtual connection : ?host:string ->
?port:string -> ?user:string -> ?password:string -> string -> object end
Connection management & information
|
method id : int
method close : unit -> unit
method closed : bool
true
if this database handle has been closed. Subsequent
* operations on the handle will fail.method ping : unit -> bool
true
. If the database is down or
* unresponsive, it returns false
. This method should never throw
* an exception (unless, perhaps, there is some sort of catastrophic
* internal error in the Dbi
library or the driver).method host : string option
host
parameter.method port : string option
port
parameter.method user : string option
user
parameter.method password : string option
password
parameter.method database : string
method virtual database_type : string
method set_debug : bool -> unit
method debug : bool
Database creation, destruction & connection
|
Statement preparation
|
method virtual prepare : string -> statement
?
placeholders which can be substituted
* for values when the statement is executed.method prepare_cached : string -> statement
prepare
except that, if possible, it
* caches the statement handle with the database object. Future calls
* with the same query string return the previously prepared statement.
* For databases which support prepared statement handles, this avoids
* a round-trip to the database, and an expensive recompilation of the
* statement.method ex : string -> sql_t list -> statement
dbh#ex stm args
is a shorthand for
let sth = dbh#prepare_cached stmt in
* sth#execute args;
* sth
*
Commit and rollback
|
method commit : unit -> unit
method rollback : unit -> unit
method register_precommit : (unit -> unit) -> precommit_handle
method unregister_precommit : precommit_handle -> unit
method register_postrollback : (unit -> unit) -> postrollback_handle
method unregister_postrollback : postrollback_handle -> unit