Re: OO and relation "impedance mismatch"

From: Kenneth Downs <firstinit.lastname_at_lastnameplusfam.net>
Date: Tue, 05 Oct 2004 13:03:35 -0400
Message-ID: <75kujc.gh3.ln_at_mercury.downsfam.net>


Tony Andrews wrote:

> Kenneth Downs wrote:

>>         -- This is an RI error trap.  Note that it is set-oriented,
>>         -- and keeps going afterward, even if every row failed.
>>         -- This trigger also assumes the use of my standard surrogate
>>         -- key column "skey".
>>         insert into zuuxtrxerr

> (skeytrx,errnum,errop,tabname,errpkey,errdsc)
>> select _at_trxNum,13100,_at_errOp,_at_errTab,'NO PKEY', >> 'Department Code is not valid' >> FROM inserted i >> WHERE i.custcode NOT IN ( >> SELECT i.custcode FROM inserted i JOIN acrmcust t >> ON i.custcode = t.custcode)

>
> Now, what happens if another session deletes (tries to delete) the
> parent record AFTER this trigger fires, but BEFORE this transaction
> commits? If this is the only child record for that parent, will the
> other session succeed in deleting the parent, or are you using a "dirty
> read" to see the uncommitted record from this session (and vice versa)?

You always want to err on the side of correct data, which leads to dirty reads, which leads to the possibility that you will have spurious failures.

I don't like that anymore than you do, but at the moment my feeling is that it is superior to the collection of problems you get with fail-on-first.

-- 
Kenneth Downs
Use first initial plus last name at last name plus literal "fam.net" to
email me
Received on Tue Oct 05 2004 - 19:03:35 CEST

Original text of this message