Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Re: [Caml-list] PostgreSQL-OCaml 1.0.1
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] PostgreSQL-OCaml 1.0.1
On Fri, Jan 30, 2004 at 12:56:43PM +0000, Benjamin Geer wrote:
> Richard Jones wrote:
> >It throws Sql_error when it can determine an error.
> Another thing I forgot to bring up about error handling.  If an error 
> occurs, you generally want to roll back the transaction.  If you're 

You might want to have a look at the code to see if it does what you

In practice, writing mainly CGI scripts and standalone scripts as we
do, this is never a problem for us.  Our code is structured like this:

  let dbh = (* open connection, or get connection from pool *)

  (* do work with the connection, never checking for any exceptions *)


In the case of a standalone script, the script dies (exits) when an
error occurs, printing the SQL error message.  The database then
automatically rolls back the connection.  This is just the behaviour
of PostgreSQL - if a connection is closed in the middle of a
transaction then the database gets rolled back.

In the case of CGI scripts, the Dbi Pool code automatically performs a
dbh#rollback just before taking back a connection and placing it back
into the pool.  So if an error did occur before the commit, then the
database gets rolled back.


Richard Jones.
Merjis Ltd. - improving website return on investment - management courses

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: