Apply Updates

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Milan Bacik
Posts: 28
Joined: Fri 28 Apr 2006 08:59
Location: Czech Republic
Contact:

Apply Updates

Post by Milan Bacik » Thu 19 Jan 2012 09:21

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?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Thu 19 Jan 2012 13:41

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

Milan Bacik
Posts: 28
Joined: Fri 28 Apr 2006 08:59
Location: Czech Republic
Contact:

Post by Milan Bacik » Fri 20 Jan 2012 09:47

Thank you very much, this is exactly what I was looking for.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Fri 20 Jan 2012 10:18

Hello,

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

Post Reply