Prevent rollback to 'LOCK_controlname' when data was not modified

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Sanych
Posts: 2
Joined: Wed 23 May 2007 06:31

Prevent rollback to 'LOCK_controlname' when data was not modified

Post by Sanych » Wed 23 May 2007 06:51

Hi All!

Is there any solutions to prevent components to rollback to LOCK_controlname savepoint when data was not modified?

Now I have to recreate that savepoint exactly before calling POST method.

Example:

Code: Select all

OraSes.Savepoint('MySP'); // SQL monitor shows installation of MySP
OraTable1.Edit;  // SQL monitor shows installation of LOCK_OraTable1 savepoint
OraTable2.Insert; // its child table connected with master-details relationship
...
OraTable2.Post;

OraTable1.Post; // Here, if non of the OraTable1 fields were modified, rollback to 'LOCK_OraTable1' is calling and changes made for OraTable2 are not saved.

To prevent this I use following code

Code: Select all

...
OraSes.SavePoint('LOCK_controlname');
OraTable1.Post; 
and in any case data in child table are saved.

I think its not a good idea. Is there any more correct ways to achieve it?

Thanks in advance.

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Wed 23 May 2007 09:20

You should change the LockMode property of the TOraTable component to lmNone. By default LockMode is set to lmLockImmediate. This means that the TOraTable component locks record in the database before editing. Rollback is required to remove this lock.

Sanych
Posts: 2
Joined: Wed 23 May 2007 06:31

Post by Sanych » Wed 23 May 2007 10:42

Thanks!
It really works.

Post Reply