Access Times
Hi I have a simple procedure as outlined below to initialise a report with
values entered by the user. When I make the call
MainPipeSQL.AvailableCriteriaList(lFields) it takes 11 to 14 seconds to
populate lFields for the 1st time I run the query. Subsequent calls to the
procedure only take 3-4 seconds. Is there any way I can decrease the access
time for the first call. I am using Delphi 5 and RBuilder 6.03 Enterprise
Edition.
Thanks for any help
Liam.
procedure TSalesReport.InitReport;
var
lCriteria : TdaCriteria;
lFields : TStringList;
i, count : integer;
begin
count := 0;
MainPipeSQL.ClearCriteria;
lFields := TStringList.Create;
MainPipeSQL.AvailableCriteriaList(lFields);
for i := 0 to lFields.Count - 1 do
lFields[i] := TdaField(lFields.Objects[i]).FieldName;
i := lFields.IndexOf('REFR');
if (RefrFromEdit.Text <> '') then begin
if (RefrToEdit.Text = '') then RefrToEdit.Text := RefrFromEdit.Text;
if (i <> -1) then begin
lCriteria := MainPipeSQL.SelectCriteria(i);
lCriteria.Operator := dacoBetween;
MainPipeSQL.Criteria[count].Value := RefrFromEdit.Text + ',' +
RefrToEdit.Text;
Inc(count);
end;
end;
lFields.Free;
end;
values entered by the user. When I make the call
MainPipeSQL.AvailableCriteriaList(lFields) it takes 11 to 14 seconds to
populate lFields for the 1st time I run the query. Subsequent calls to the
procedure only take 3-4 seconds. Is there any way I can decrease the access
time for the first call. I am using Delphi 5 and RBuilder 6.03 Enterprise
Edition.
Thanks for any help
Liam.
procedure TSalesReport.InitReport;
var
lCriteria : TdaCriteria;
lFields : TStringList;
i, count : integer;
begin
count := 0;
MainPipeSQL.ClearCriteria;
lFields := TStringList.Create;
MainPipeSQL.AvailableCriteriaList(lFields);
for i := 0 to lFields.Count - 1 do
lFields[i] := TdaField(lFields.Objects[i]).FieldName;
i := lFields.IndexOf('REFR');
if (RefrFromEdit.Text <> '') then begin
if (RefrToEdit.Text = '') then RefrToEdit.Text := RefrFromEdit.Text;
if (i <> -1) then begin
lCriteria := MainPipeSQL.SelectCriteria(i);
lCriteria.Operator := dacoBetween;
MainPipeSQL.Criteria[count].Value := RefrFromEdit.Text + ',' +
RefrToEdit.Text;
Inc(count);
end;
end;
lFields.Free;
end;
This discussion has been closed.
Comments
table names from the database. When you use the query tools to select a
field, then it retrieves all of the field information and places the field
names in the cache along with the table names. The meta data cache is used
to display the possible tables and fields that can be used to build a query.
Using the meta data cache to provide the available field names is much
faster than accessing the database to get the information over and over
again.
Also what might be happening to slow you down is not in this call. The
report may be is initializing for the printer driver. You can call
Report.Printer.Initialize when you application loads in order to initialize
the report for the printer driver. This might help speed up the first time
you initialize the report later on.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com