exclusive record lock to prevent modif. by other session
Posted: Mon 16 Apr 2012 09:58
I use a TOraQuery, Delphi 7 on Oracle 10G
I have in a TOraQuery, beside normal select statements like
defined in SQLLock:
On before insert and edit, I've defined in Delphi:
(In short)
Another user/session tries to modify the same data, using the same code as above (same app).
The second session doesn't see a row lock? No message appears.
I see rowlevel locks in Oracle, but not on the table defined in the query...??
(If the first session issues the rowlock I see rowlocks on record(s?) in a different table as supposed.
If the second session issues a rowlock I see more rowlocks, also in a different table as supposed. Sometimes even different from the (wrong) table mentioned by session 1???)
Is this the right method doing so?
If not how to achieve this functionality? ((I can't find an definite answer in the ODAC help or forum.))
I have in a TOraQuery, beside normal select statements like
Code: Select all
select * from table where key=...Code: Select all
select * from table where key=.. FOR UPDATE NOWAIT(In short)
Code: Select all
try
starttransaction
lockmode=lmlockImmediate
Checkmode=cmException
query.lock
except
showmessage('Record in use by other session');
end;
The second session doesn't see a row lock? No message appears.
I see rowlevel locks in Oracle, but not on the table defined in the query...??
(If the first session issues the rowlock I see rowlocks on record(s?) in a different table as supposed.
If the second session issues a rowlock I see more rowlocks, also in a different table as supposed. Sometimes even different from the (wrong) table mentioned by session 1???)
Is this the right method doing so?
If not how to achieve this functionality? ((I can't find an definite answer in the ODAC help or forum.))