Subject | Re: [IBO] Key in current dataset |
---|---|
Author | Matt Nielsen |
Post date | 2003-07-23T18:04:37Z |
procedure TSJJQuery.DoCacheUpdate(ADataset: TIB_Dataset; AField:
string; AType: TIB_DMLCacheItemType; AValue: Variant);
begin
if not ADataset.Active then Exit;
if ADataset.Owner is TSJJQuery then begin
if ADataset.Owner.Owner is TBaseQueryA then begin
with TBaseQueryA(ADataset.Owner.Owner) do begin
case AType of
ditEdit: if not (dcfReceiveEdit in FDMLCacheFlags) then
Exit;
ditInsert: Exit; // not implemented yet
ditDelete: Exit; // not implemented yet
end; {if}
if CompareText(RecordSeqno.FieldName, AField) = 0 then begin
if (TSJJQuery(ADataset.Owner).State in [dsEdit]) and
(AValue[0] = RecordSeqno.AsInteger) then Exit; //
prevent refresh of current item
TSJJQuery(ADataset.Owner).KeyFields.Values[AField] :=
AValue;
if (TSJJQuery(ADataset.Owner).State in [dsInsert,dsEdit])
then ADataset.Post; // the invalidate bookmark
// will reverse the changes if we are in insert or edit
mode on any record
case AType of
ditEdit : TSJJQuery(ADataset.Owner).InvalidateBookmark
(TSJJQuery(ADataset.Owner).KeyFields.RowData);
end; {case}
end; {if}
end; {if}
end; {if}
end else begin
raise Exception.Create('Currently only setup for SJJQuery');
end; {if}
end;
The post you see is to prevent the reversal of the record in edit
mode.
string; AType: TIB_DMLCacheItemType; AValue: Variant);
begin
if not ADataset.Active then Exit;
if ADataset.Owner is TSJJQuery then begin
if ADataset.Owner.Owner is TBaseQueryA then begin
with TBaseQueryA(ADataset.Owner.Owner) do begin
case AType of
ditEdit: if not (dcfReceiveEdit in FDMLCacheFlags) then
Exit;
ditInsert: Exit; // not implemented yet
ditDelete: Exit; // not implemented yet
end; {if}
if CompareText(RecordSeqno.FieldName, AField) = 0 then begin
if (TSJJQuery(ADataset.Owner).State in [dsEdit]) and
(AValue[0] = RecordSeqno.AsInteger) then Exit; //
prevent refresh of current item
TSJJQuery(ADataset.Owner).KeyFields.Values[AField] :=
AValue;
if (TSJJQuery(ADataset.Owner).State in [dsInsert,dsEdit])
then ADataset.Post; // the invalidate bookmark
// will reverse the changes if we are in insert or edit
mode on any record
case AType of
ditEdit : TSJJQuery(ADataset.Owner).InvalidateBookmark
(TSJJQuery(ADataset.Owner).KeyFields.RowData);
end; {case}
end; {if}
end; {if}
end; {if}
end else begin
raise Exception.Create('Currently only setup for SJJQuery');
end; {if}
end;
The post you see is to prevent the reversal of the record in edit
mode.
--- In IBObjects@yahoogroups.com, Helen Borrie <helebor@t...> wrote:
> At 05:08 PM 22/07/2003 +0000, you wrote:
> >That's great then. If InvalidateBookmark doesn't touch the dataset
> >unless it needs to then I just have one problem. If I have a
dataset
> >open and I have a record open in dsEdit mode. I then call
Invalidate
> >record on a totally separate record. The InvalidateBookmark rolls
> >back the changes to this record in dsEdit mode also.
>
> Could you show a code snippet of your OnDMLCacheReceiveItem handler?
>
> Helen