Subject | TIBODataset not working in cached updates mode with calc. fields |
---|---|
Author | Nando Dessena |
Post date | 2003-08-01T11:27:25Z |
Hello,
here is the description of my current problem:
I have a TIBOQuery with CachedUpdates = True, RequestLive = False and
some code in the OnUpdateRecord handler. The intent is to do the
updates in a custom way via the OnUpdateRecord.
ApplyUpdates is called once for each modified record:
procedure TForm1.QyEmployeeAfterPost(DataSet: TDataSet);
begin
try
QyEmployee.ApplyUpdates;
except
QyEmployee.CancelUpdates;
raise;
end;
QyEmployee.CommitUpdates;
end;
The sequence of operations is Open, Edit, Post.
If (and only if) the dataset happens to have one or more lookup or calculated
fields, then it blows up during the post (to be precise, during the
applyupdates) saying that "the dataset is not in edit or insert mode".
The code that triggers this weird error message seems to be here:
procedure TIBODataset.DoUpdateRecord( UpdateKind: TIB_UpdateKind;
var UpdateAction: TIB_UpdateAction );
begin
if CachedUpdates and ( CalcFieldsSize > 0 ) then
CalculateFields( TempBuffer );
end;
Here CalculateFields is called without first putting the dataset in
dsCalcFields state, which causes the error.
I have a simple test case (using employee.gdb) that I can send in case
I have not made it clear enough.
Thanks
--
Nando mailto:nandod@...
here is the description of my current problem:
I have a TIBOQuery with CachedUpdates = True, RequestLive = False and
some code in the OnUpdateRecord handler. The intent is to do the
updates in a custom way via the OnUpdateRecord.
ApplyUpdates is called once for each modified record:
procedure TForm1.QyEmployeeAfterPost(DataSet: TDataSet);
begin
try
QyEmployee.ApplyUpdates;
except
QyEmployee.CancelUpdates;
raise;
end;
QyEmployee.CommitUpdates;
end;
The sequence of operations is Open, Edit, Post.
If (and only if) the dataset happens to have one or more lookup or calculated
fields, then it blows up during the post (to be precise, during the
applyupdates) saying that "the dataset is not in edit or insert mode".
The code that triggers this weird error message seems to be here:
procedure TIBODataset.DoUpdateRecord( UpdateKind: TIB_UpdateKind;
var UpdateAction: TIB_UpdateAction );
begin
if CachedUpdates and ( CalcFieldsSize > 0 ) then
CalculateFields( TempBuffer );
end;
Here CalculateFields is called without first putting the dataset in
dsCalcFields state, which causes the error.
I have a simple test case (using employee.gdb) that I can send in case
I have not made it clear enough.
Thanks
--
Nando mailto:nandod@...