Re: OO and relation "impedance mismatch"

From: Kenneth Downs <firstinit.lastname_at_lastnameplusfam.net>
Date: Wed, 06 Oct 2004 16:29:28 -0400
Message-ID: <8jk1kc.dob.ln_at_mercury.downsfam.net>


Laconic2 wrote:

>
> "Kenneth Downs"
>

>> The rollback is server-controlled, it has to be.  Otherwise, as you point
>> out, there is no assured integrity.  The rollback code is in the trigger
>> code I posted.

>
> I haven't done all that much with triggers, but it strikes me that you
> can let the application do the rollback.
>
> What you do is put a trigger on the commit. The commit trigger checks to
> see if any errors have been caught by the other triggers. If so, the
> commit trigger returns an error, and skips the commit. Now the
> application
> is stuck. The only way out, if commit won't work, is with a rollback. I
> certainly would try this on my DBMS. YMMV.

SQL Server does not support transaction level triggers, so you cannot use this approach, at least not if you want to support the big 3 that have the largest market share. The code I posted does account for nested triggers with rollback only occurring on the outermost, and has the benefit of being portable with small syntax changes.

-- 
Kenneth Downs
Use first initial plus last name at last name plus literal "fam.net" to
email me
Received on Wed Oct 06 2004 - 22:29:28 CEST

Original text of this message