class virtual connection : ?host:string ->
?port:string -> ?user:string -> ?password:string -> string -> object end
Connection managment & information
|
method id : intmethod close : unit -> unitmethod closed : booltrue if this database handle has been closed. Subsequent
operations on the handle will fail.method ping : unit -> booltrue. 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 optionhost parameter.method port : string optionport parameter.method user : string optionuser parameter.method password : string optionpassword parameter.method database : stringmethod virtual database_type : stringmethod set_debug : bool -> unitmethod 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 -> statementprepare 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 -> statementdbh#ex stm args is a shorthand for
let sth = dbh#prepare_cached stmt in
sth#execute args;
sth
Commit and rollback
|
method commit : unit -> unitmethod rollback : unit -> unitmethod register_precommit : (unit -> unit) -> precommit_handlemethod unregister_precommit : precommit_handle -> unitmethod register_postrollback : (unit -> unit) -> postrollback_handlemethod unregister_postrollback : postrollback_handle -> unit