module Sqlite3EZ:sig..end
Sqlite3 with a simplified interfacemodule Rc:sig..end
module Data:sig..end
exception Rc of Rc.t
exception Finally of exn * exn
type db
val db_open : ?mode:[ `NO_CREATE | `READONLY ] ->
?mutex:[ `FULL | `NO ] ->
?cache:[ `PRIVATE | `SHARED ] -> ?vfs:string -> string -> dbas Sqlite3.db_openval db_close : db -> unitval with_db : ?mode:[ `NO_CREATE | `READONLY ] ->
?mutex:[ `FULL | `NO ] ->
?cache:[ `PRIVATE | `SHARED ] ->
?vfs:string -> string -> (db -> 'a) -> 'awith_db filename f opens a database, applies f, and returns the
result. The database is closed after f is evaluated, even if it raises an
exception.val transact : db -> (db -> 'a) -> 'atransact db f evaluates f db within a BEGIN..COMMIT transaction. If f
db evaluates successfully to y, the transaction is committed and y is
returned. If the evaluation of f db raises an exception, the transaction is
rolled back and the exception is re-raised.
Note that BEGIN..COMMIT transactions cannot be nested in SQLite. Any attempt
to make a nested call to transact will raise an exception.
val atomically : db -> (db -> 'a) -> 'aatomically db f evaluates f db within a SAVEPOINT..RELEASE
transaction, which may be nested.
This implementation allows only parenthetically nested transactions, so there
is no need to name savepoints.
val exec : db -> string -> unitval last_insert_rowid : db -> Int64.tSqlite3.last_insert_rowidval changes : db -> intSqlite3.changestype statement
val make_statement : db -> string -> statementSqlite3.reset are handled automatically). The statement is not actually
compiled until its first use.val statement_exec : statement -> Data.t array -> unitval statement_query : statement ->
Data.t array ->
(Data.t array -> 'a) -> ('a -> 'b -> 'b) -> 'b -> 'bstatement_query stmt params cons fold init binds the given parameters
and executes a query. Each result row is first passed to cons, which will
usually construct a value from the data. This value is then passed to fold
along with an intermediate value, which is init for the first row. This can
used to build a list or other data structure from all the results.val statement_finalize : statement -> unit