module Pfs_db:Utility functions for database accessessig
..end
class type db_config =object
..end
val dummy_db_config : unit -> db_config
val extract_db_config : Netplex_types.config_file -> db_config
db_config
from this Netplex config file:
netplex {
...
database {
dbname = "<name of database>"; (* required *)
host = "<hostname>";
hostaddr = "<ipaddr>";
port = <port>;
user = "<user name>";
password = "<password>";
ro_connections_max = <c>;
};
...
}
See the documentation of PostgreSQL for dbname
, host
, hostaddr
,
port
, user
, and password
(but it should be obvious).
ro_connections_max
is the number of db connections dedicated for
read-only database accesses. Defaults to 20.
class type['a]
async_connection =object
..end
typeread_write =
[ `R | `W ]
mode
that is conventionally used for read-write connectionstyperead_only =
[ `R ]
mode
that is conventionally used for read-only connectionstyperw_async_connection =
read_write async_connection
typero_async_connection =
read_only async_connection
class['a]
connect :db_config ->
['a]
async_connection
class async_exec :'a async_connection -> Unixqueue.event_system -> ?expect:Postgresql.result_status list -> ?params:string array -> ?binary_params:bool array -> ?copy_in_lines:string list -> ?noprepare:bool -> string ->
[Postgresql.result]
Uq_engines.engine