Access Violation on deleting records in CachedUpdates mode

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
jeff_alieffson
Posts: 2
Joined: Tue 30 Oct 2012 02:54

Access Violation on deleting records in CachedUpdates mode

Post by jeff_alieffson » Tue 30 Oct 2012 03:31

Hello,
I'm using ODAC 8.1.4 with Embarcadero RAD Studio 2010 Version 14.0.3513.24210
I use TOraQuery in CachedUpdates mode. I use TOraUpdateSQL with DeleteSQL, ModifySQL and InsertSQL set.
1)
1.1) When I delete the last record from q:TOraQuery and call ApplyUpdates and get no exception from Oracle, it works fine
1.2) When I get EDatabaseError during call of q.ApplyUpdates, because of my integrity constraints on Oracle, I handle it in q.OnUpdateError and give to user meaningful Warning and write UpdateAction :=uaSkip;
1.3) After showing my dialog box, it raises Access Violation exception.
"Access Violation at address 006149FF ...".
1.4) When I have more than one record in dataset, this exception does not take place.
1.5) I copied Insert,Update,Delete statements into TOraQuery corresponding fields and deleted TOraUpdateSQL. It has no effect. AV Exception remains.

2) The same thing occurs, when I call ApplyUpdates on an empty dataset. But I can prevent it by checking
if q.UpdatesPending then q.ApplyUpdates.

Please help me what to do in first case?

I read in history, that in version
"6.00.0.6 20-Apr-07"
- AV failure with deleting records in CachedUpdates mode fixed
But it still occurs.

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

Re: Access Violation on deleting records in CachedUpdates mode

Post by AlexP » Tue 30 Oct 2012 10:41

Hello,

We cannot reproduce the problem. AV doesn't occur when calling the ApplyUpdates method when the error occurs and is handled in the UpdateError event in the following way:

Code: Select all

procedure TForm1.OraQuery1UpdateError(DataSet: TDataSet; E: EDatabaseError;
  UpdateKind: TUpdateKind; var UpdateAction: TUpdateAction);
begin
  if MessageDlg('continue?', mtConfirmation, [mbYes, mbNo], 0) = mrYes then
    UpdateAction := uaSkip;
end;
Please try to reproduce the problem on the latest ODAC version 8.5.9, if the error can be reproduced, send a project demonstrating the problem and a script for creating DB objects to alexp*devart*com

jeff_alieffson
Posts: 2
Joined: Tue 30 Oct 2012 02:54

Re: Access Violation on deleting records in CachedUpdates mode

Post by jeff_alieffson » Tue 30 Oct 2012 20:13

Error occurs, only when I delete the last record from TOraQuery and get
an exception from Oracle, after handling my exception I get AV.
The key word here is "the last record"
Here is a brief chunk of code. I just want to show the situation

Code: Select all

var
qArrival:TOraQuery;
uArrival:TOraUpdateSQL;
...
qArrival.CachedUpdates:=True;
qArrival.UpdateObject:=uArrival;
qArrival.SQL.Clear;
qArrival.SQL.Add('SELECT * FROM V$ARRIVAL WHERE NBR=:NBR1 ORDER BY ART,SUB_ART');
...
update/delete/insert SQLs are set into uArrival too.
...
procedure TfmData.qArrivalUpdateError(DataSet: TDataSet; E: EDatabaseError;
  UpdateKind: TUpdateKind; var UpdateAction: TUpdateAction);
begin
   MessageDlg(E.Message,mtError,[mbOK],0);
   UpdateAction :=uaSkip;
end;

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

Re: Access Violation on deleting records in CachedUpdates mode

Post by AlexP » Wed 31 Oct 2012 08:43

hello,

This problem really occurs in ODAC version 8.1.4. AV doesn't occur in ODAC version 8.5.9 after deleting the last record in the UpdateError method.
Please download the latest ODAC version and check this again

Post Reply