Functor CamlGI.DbiPool.DbiPool


module DbiPool: 
functor (Dbi_driver : DbiDriverT) -> sig .. end
module MyPool = DbiPool(Dbi_postgresql) creates a pool of PostgreSQL database handles. To use them:

let dbh = MyPool.get request "database_name"

Returns an unused or newly created Dbi.connection handle dbh from the pool of database handles which is valid until the end of the current request.

The parameters uniquely identify the database name. Separate pools are maintained for each combination of parameters.

The connection is automatically returned to the pool at the end of the current request. After this time the connection may be given away to another user. For this reason, the calling code must NEVER stash the connection across requests (instead, call get to get a new handle each time).

On returning the handle to the pool, the pool performs a ROLLBACK operation on the handle, thus losing any changes (INSERT, etc.) made to the database. If the program wants to preserve changes, it must perform a COMMIT operation itself, by calling Dbi.connection.commit.
Parameters:
Dbi_driver : DbiDriverT


type connection = Dbi_driver.connection 
val get : CamlGI.Cgi.Request.t ->
?host:string ->
?port:string ->
?user:string ->
?password:string -> string -> connection