Module SkhcDb.DatabaseSource

Primitive operations on the database.

Sourcetype t

type of a database handler.

Sourceval open' : ?mode:[ `NO_CREATE | `READONLY ] -> ?uri:bool -> ?memory:bool -> ?mutex:[ `FULL | `NO ] -> ?cache:[ `PRIVATE | `SHARED ] -> ?vfs:string -> string -> t

open' filename opens the database at filename and returns a database handler.

see Sqlite3.db_open for details of all parameters.

Sourceval create_tables : t -> Sqlite3.Rc.t

create_tables db creates the tables used by shakuhachi in db.

Sourceval close : t -> bool

close db closes the database handler.

Sourceval transaction : t -> (t -> ('a, 'b) result) -> ('a, 'b) result

transaction db f runs f inside a transaction block. If f returns Result.Ok, modifications applied to db are commited. Otherwise, modifications are rollbacked.

Sourceval errmsg : t -> string

errmsg db returns the error message of the last operation on database db.

Sourceval sqlite3 : t -> Sqlite3.db
  • since 0.3.0