Re: custom locking in master-detail form

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Sun, 20 Jun 1999 21:46:30 +0800
Message-ID: <376CF0B6.39E9_at_yahoo.com>


kaiserrj_at_my-deja.com wrote:
>
> Tough one,
>
> The inserts are what really complicates things.
> There's no good way to lock an insert record that hasn't been
> created yet.
>
> If you have design priviledges, I'd add a database table to store
> the master record's identifier, and the username for the session
> modifying records.
> The client app would check the table before doing anything.
> The client app would also have to store (commit) this info when they
> select to change detail records. Later, when they're done, they
> would have to delete the record.
> Might be a nice idea to wipe out any of client's records when they
> first log in, so there'll be a way to clean up if the client
> dies in the middle of making changes.
>
> Good luck, Rich
>
> In article <7k93dv$vuj$1_at_nnrp1.deja.com>,
> bdg_at_hotmail.com wrote:
> > In a Developer/2000 master-detail form, how to you prevent users from
> > concurrently inserting/deleting/updating detail records for the same
> master
> > record?
> >
> > I would like for the first user that displays a given master record
> to have
> > exclusive DML access to the corresponding detail records. Subsequent
> users
> > should be able to view both the master and detail records, but
> perform no
> > changes.
> >
> > The master record happens to be query-only in this case if it makes
> the
> > problem easier.
> >
> > Thanks,
> > Brian Gastineau
> >
> > Sent via Deja.com http://www.deja.com/
> > Share what you know. Learn what you don't.
> >
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.

When they query the master record, use dbms_lock to hash this value into a number. Then issue a lock against this. If all users of the form follow this system, then the locking you require can be done with a minimum of fuss...

I don't think this kind of locking is a great idea though - since anyone outside the form still can basically do what they want...

HTH

-- 
===========================================
Connor McDonald
"These views mine, no-one elses etc etc"
connor_mcdonald_at_yahoo.com

"Some days you're the pigeon, and some days you're the statue."
Received on Sun Jun 20 1999 - 15:46:30 CEST

Original text of this message