[m-dev.] for review: handle exceptions in the ODBC interface

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Mar 21 15:25:25 AEDT 2000


On 21-Mar-2000, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> 
> Handle exceptions thrown by the closure passed to odbc__transaction.
> 
> extras/odbc/odbc.m:
> 	Abort the transaction if the closure passed to odbc__transaction
> 	throws an exception, and rethrow the exception to the caller.
...
> +		/*
> +		** There was a Mercury exception -- abort the transaction.
> +		*/
> +		DEBUG(printf(
> +			""Mercury exception in transaction: aborting\\n""));
> +		SQLTransact(odbc_env_handle, odbc_connection, SQL_ROLLBACK);

Here you are ignoring the return value of SQLTransact().
That is probably a reasonable thing to do under the circumstances,
but you should document this, at least by adding a cast to (void)
in front of that call, and perhaps also with a comment in the source.

Apart from that, this change looks fine.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list