Table Lock vs. Row Lock

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
M.Schmidt-E.
Posts: 15
Joined: Fri 30 Jan 2009 11:04

Table Lock vs. Row Lock

Post by M.Schmidt-E. » Fri 30 Jan 2009 13:08

Hello,
how to implement a row lock?
I use a "select [fields] from [table] for update" in TSmartQuery.
Properties of tSmartQuery:
AutoCommit=False
Lockmode=lmNone
FetchAll=True
Properties of TOraSession:
not in transaction
Autocommit=False
Pooling=False

After Editing and Close the Query, the Table is locked by oracle.

D2009 and ODAC 6.70.0.42

Can anyone help me?
thx
Mathias

Challenger
Devart Team
Posts: 925
Joined: Thu 17 Nov 2005 10:53

Post by Challenger » Mon 02 Feb 2009 12:19

You should commit transaction in order to release locked records. Please note that when executing SELECT ... FOR UPDATE command without WHERE condition you lock all records. It is better to use the LockMode property for row locking. For more information please refer to the Odac help.

M.Schmidt-E.
Posts: 15
Joined: Fri 30 Jan 2009 11:04

Post by M.Schmidt-E. » Mon 02 Feb 2009 12:39

My test:
My steps:
1. open TOraSession, connection is not in transaction
2. select [columns] from [Table] where [statement] into TSmartQuery
3. TSmartQuery.LockMode:= lmLockDelayed
4. TSmartQuery.Autocommit:= False
5. open TSmartQuery
6. edit Data in Grid (tcxgridDBTableView, Component by DevExpress)
7. Post Data
8. Close TSmartQuery.

Table is locked, but why?
Mathias

jfudickar
Posts: 202
Joined: Fri 10 Mar 2006 13:03
Location: Oberursel / Germany

Post by jfudickar » Mon 02 Feb 2009 15:17

You must commit the changes in the database after all.

Session.Commit;

Greetings
Jens

Post Reply