Page 1 of 1

Apply Updates

Posted: Thu 19 Jan 2012 09:21
by Milan Bacik
I have problem with TOraTable when CachedUpdates are true. I have a table with primary key which is single column. Than i have unique two column index. Now when i:
Insert new record into table
Delete old record
Update inserted record so it have same unique index as deleted record
When i ApplyUpdates i get error on the unique index. Component generate insert with same index values before it deletes old record.
Is there any way to go around this behavior?

Posted: Thu 19 Jan 2012 13:41
by AlexP
Hello,

The CachedUpdates mode is oriented for minimization of load on a server, therefore, when editing one and the same record, only the last operation goes to the server. i.e. if you have inserted a record, after that edited it N times, the Insert of this record will go to the server with data from the last made Update, but not Insert from N Update.
For resolving your problem, you should specify the sequence of operations transfer to the server explicitly.

OraQuery1.ApplyUpdates([ukDelete]);
OraQuery1.ApplyUpdates([ukInsert]);
// OraQuery1.ApplyUpdates([ukUpdate]); - not necessary in your case

Posted: Fri 20 Jan 2012 09:47
by Milan Bacik
Thank you very much, this is exactly what I was looking for.

Posted: Fri 20 Jan 2012 10:18
by AlexP
Hello,

Glad to see that the problem was solved. If you have any other questions, feel free to contact us.