[m-rev.] for review: changes to odbc.m

Simon Taylor stayl at cs.mu.OZ.AU
Mon May 13 17:00:53 AEST 2002


On 13-May-2002, David Overton <dmo at cs.mu.OZ.AU> wrote:
> On Thu, May 09, 2002 at 03:40:21PM +1000, Simon Taylor wrote:
> > Now that transactions can have access to an io__state, you need
> > to check that you're not already inside a transaction before
> > starting a new one (and return an error if you are).
> 
> I've added a check for this.  I'm not all that familiar with ODBC so if
> there is a better way to do this please let me know.
> 
> --- odbc.m.old	Mon May 13 16:38:34 2002
> +++ odbc.m	Mon May 13 16:39:54 2002
> @@ -650,12 +659,14 @@
>  		Exception, IO0, IO, State0, State) :-
>  	try_io((pred(TryResult::out, IO1::di, IO2::uo) is det :-
>  		unsafe_promise_unique(State0, State1),
> -		Closure(Result, IO1, IO2, State1, ResultState),
> +		check_not_in_transaction(State1, State2),
> +		Closure(Result, IO1, IO2, State2, State3),
> +		unset_in_transaction(State3, ResultState),
>  		TryResult = Result - ResultState
>  	), ExceptResult, IO0, IO),
>  	(
> -		ExceptResult = succeeded(Results - State2),
> -		unsafe_promise_unique(State2, State),
> +		ExceptResult = succeeded(Results - State4),
> +		unsafe_promise_unique(State4, State),
>  		make_dummy_value(Exception),
>  		GotException = 0

You should check this before attempting to start a new
connection/transaction (in odbc__unsafe_io_transaction),
rather than starting a transaction and immediately rolling
it back.

Simon.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list