Incremental fetching


2004-02-05 05:01:34 PM
delphi116
Dear colleagues,
I have following problem. I implemented incremental fetching (this
solution is from this forum as I remember) on my application server
but I made mistake somewhere because it does not work. It does not
return me any records. This table Journal contains thousands of
records so it does not make sence (and take very long time) to load
all records to client at once. I need only expose records. I don't
need to perform add, delete or update.
Application server (TSoapDataModule):
TIBClientDataSet (cdsJournal):
- Packetrecords = -1
- CommandText= select BOUNDTYPE, SERVICE, RECORD_ID from JOURNAL
(RECORD_ID is primary key in this table)
- FetchOnDemand = True
- ReadOnly = True
TDataSetProvider (dspJournal):
- Dataset = cdsJournal
- ResolveToDataSet = True
- procedure TSDataModule.dspJournalAfterGetRecords(Sender: TObject;
var OwnerData: OleVariant);
with (Sender as TDataSetProvider).DataSet do
begin
if Eof then
OwnerData := null;
else
begin
Last;
OwnerData := FieldByName('RECORD_ID').Value;
end;
Close;
end;
- procedure TSDataModule.dspJournalBeforeGetRecords(Sender: TObject;
var OwnerData: OleVariant);
with (Sender as TDataSetProvider).DataSet do
begin
Open;
if VarIsEmpty(OwnerData) then
First
else
if VarIsNull(OwnerData) then
Last
else
if not Locate('RECORD_ID',OwnerData,[]) then
Close; {error}
end;
Client:
TSoapConnection (scJournal)
TClientDataSet (cdsClientJournal):
- Packetrecords = -1
- RemoteServer = scJournal
- FetchOnDemand = True
- ProviderName = dspJournal
- ReadOnly = True
- procedure TfrmJournal.cdsClientJournalAfterGetRecords(Sender:
TObject;
var OwnerData: OleVariant);
begin
FKeyValue := OwnerData; {FKeyValue is of type OleVariant}
end;
- procedure TfrmJournal.cdsClientJournalBeforeGetRecords(Sender:
TObject;
var OwnerData: OleVariant);
begin
OwnerData:= FKeyValue;
end;
- procedure TfrmJournal.cdsClientJournalBeforeOpen(DataSet:
TDataSet);
begin
VarClear(FKeyValue);
end;
On client side I am only calling once cdsClientJournal.Open and as I
have already written it does not return me any records. And late when
I am calling cdsClientJournal.Refresh (something could be added to
JOURNAL table so user can refresh data on client side) then it returns
me error: Datapacket contains no metadata. Could please tell me where
is the problem. Thanks a lot for your advices.
Regards,
Roman Pagac.