Subject | Re: [IBO] Copy TIB_Query buffered data to another |
---|---|
Author | Helen Borrie |
Post date | 2001-09-05T02:21:28Z |
At 08:59 PM 04-09-01 +0200, you wrote:
But it doesn't "copy the buffers". The contents of the buffers are dynamic - data are cached on the server and fetched over to the client on an "as required" basis.
Here's a piece of code that takes the exact sql of a filtered dataset currently viewed in an IB_grid/IB_datasource/ib_query over to an iboquery (TDataset-compatibile) for a QuickReport. Both queries are connected to a single ib_connection.
procedure TdmBuglist.ReadFilters(slParams: TStringList;
Mode: String;
Ascending, StatusCheck: Boolean);
const
ASC_ORD = 'ORDER BY BUG.BUG_DESCRIPTION';
STAT_STUMP = 'AND BUL.BUL_BUS_ID = :STAT';
var
indx: integer;
begin
indx := StrToInt(slParams.Strings[2]);
with q_BUG_LIST, slParams do //q_BUG_LIST is a TIB_Query
begin
if Active then Close;
if Ascending then
SQL[SQL.Count-1] := ASC_ORD
else
SQL[SQL.Count-1] := ASC_ORD + ' DESC';
if StatusCheck then
SQL[SQL.Count-2] := '/*' + STAT_STUMP + '*/'
else
begin
SQL[SQL.Count-2] := STAT_STUMP;
ParamByName('STAT').AsInteger := StrToInt(fmBugList.Statii.Names[indx]);
end;
ParamByName('CATEG').AsInteger := StrToInt(Strings[0]);
ParamByName('REPORT').AsInteger := StrToInt(Strings[1]);
Open;
end;
if Mode = 'Report' then
with ReportData do // this is a TIBOQuery
begin
if Active then Close;
if Prepared then Unprepare;
InternalDataset.AssignSQLWithSearch(q_BUG_LIST);
Prepare;
Open;
end;
end;
rgds
Helen
All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________
>Hi,Yes: use the AssignSQLWithSearch method.
>
>I think that it will be very usefull to have method something like
>AssignDataTo.
>Let me explain:
>1. What this method will do?
> - copy all buffered data (only data that are fetched from the server) from
>source IB_Query to destination
> - that coul'd be done ONLY if all sql statments of both querys are equal
>(select, update, delete)
>
>2. Why I need this?
> - to speed up loading forms where I have many IB_Lookupcombos: I will open
>one IB_Query (in DataModule-once per application) and when i call method
>AssignDataTo to copy all fetched data from query in DataModule to query in
>new form
>
>Is this maybe already possible?
But it doesn't "copy the buffers". The contents of the buffers are dynamic - data are cached on the server and fetched over to the client on an "as required" basis.
Here's a piece of code that takes the exact sql of a filtered dataset currently viewed in an IB_grid/IB_datasource/ib_query over to an iboquery (TDataset-compatibile) for a QuickReport. Both queries are connected to a single ib_connection.
procedure TdmBuglist.ReadFilters(slParams: TStringList;
Mode: String;
Ascending, StatusCheck: Boolean);
const
ASC_ORD = 'ORDER BY BUG.BUG_DESCRIPTION';
STAT_STUMP = 'AND BUL.BUL_BUS_ID = :STAT';
var
indx: integer;
begin
indx := StrToInt(slParams.Strings[2]);
with q_BUG_LIST, slParams do //q_BUG_LIST is a TIB_Query
begin
if Active then Close;
if Ascending then
SQL[SQL.Count-1] := ASC_ORD
else
SQL[SQL.Count-1] := ASC_ORD + ' DESC';
if StatusCheck then
SQL[SQL.Count-2] := '/*' + STAT_STUMP + '*/'
else
begin
SQL[SQL.Count-2] := STAT_STUMP;
ParamByName('STAT').AsInteger := StrToInt(fmBugList.Statii.Names[indx]);
end;
ParamByName('CATEG').AsInteger := StrToInt(Strings[0]);
ParamByName('REPORT').AsInteger := StrToInt(Strings[1]);
Open;
end;
if Mode = 'Report' then
with ReportData do // this is a TIBOQuery
begin
if Active then Close;
if Prepared then Unprepare;
InternalDataset.AssignSQLWithSearch(q_BUG_LIST);
Prepare;
Open;
end;
end;
rgds
Helen
All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________