Page 1 of 1

Prevent rollback to 'LOCK_controlname' when data was not modified

Posted: Wed 23 May 2007 06:51
by Sanych
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.

Posted: Wed 23 May 2007 09:20
by Plash
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.

Posted: Wed 23 May 2007 10:42
by Sanych
Thanks!
It really works.