Modifying sql text in rap from delphi code
Hi:
I modify the sql text from RAP calling a function in Delphi that does this:
procedure TppRemplazarTextoSQL.ExecuteFunction(aParams: TraParamList);
var
vReporte: TppReport;
vSQL,
vDataView: string;
iDataModule: TdaDataModule;
iDataView: TdaDataView;
iSQL: TdaSQL;
begin
GetParamValue(0, vReporte);
GetParamValue(1, vDataView);
iDataModule := daGetDataModule(vReporte.MainReport);
iDataView := iDataModule.FindDataViewByUserName('Query_' + vDataView);
if (iDataView <> nil) and (iDataView is TdaQueryDataView) then
begin
iSQL := TdaQueryDataView(iDataView).SQL;
iSQL.
iSQL.EditSQLAsText := True;
vSQL := 'Here new text sql';
iSQL.SQLText.Text := vSQL;
iDataView.OutOfSync;
end;
end;
My problem is that in doing " iSQL.SQLText.Text := vSQL;" el rb 11.06
run the query which is not to in rb 7, so the report is much slower in rb
11.
How do I replace the sql text without running the query with "
iSQL.SQLText.Text := vSQL;"
Regards
Edgar Britez
Sebaot Software
I modify the sql text from RAP calling a function in Delphi that does this:
procedure TppRemplazarTextoSQL.ExecuteFunction(aParams: TraParamList);
var
vReporte: TppReport;
vSQL,
vDataView: string;
iDataModule: TdaDataModule;
iDataView: TdaDataView;
iSQL: TdaSQL;
begin
GetParamValue(0, vReporte);
GetParamValue(1, vDataView);
iDataModule := daGetDataModule(vReporte.MainReport);
iDataView := iDataModule.FindDataViewByUserName('Query_' + vDataView);
if (iDataView <> nil) and (iDataView is TdaQueryDataView) then
begin
iSQL := TdaQueryDataView(iDataView).SQL;
iSQL.
iSQL.EditSQLAsText := True;
vSQL := 'Here new text sql';
iSQL.SQLText.Text := vSQL;
iDataView.OutOfSync;
end;
end;
My problem is that in doing " iSQL.SQLText.Text := vSQL;" el rb 11.06
run the query which is not to in rb 7, so the report is much slower in rb
11.
How do I replace the sql text without running the query with "
iSQL.SQLText.Text := vSQL;"
Regards
Edgar Britez
Sebaot Software
This discussion has been closed.
Comments
Searching for because of the poor performance of the rb 11 I found that for
a simple report that changes the sql text to the previous function, the
dataset is opened 5 times.
You can verify this by modifing dadbexpress.pas:
-------------------------
procedure TdaChildSQLClientDataSet.SetActive(Value: Boolean);
begin
FSQLDataSet.Active := Value;
MessageDlg(FSQLDataSet.commandtext, mtWarning, [mbOK], 0);
inherited;
SetProvider(FDataSetProvider);
end; {procedure, SetActive}
-------------------------------------------
in versi?n rb 7 dataset open only 2 times.
You can solve this because the performance drops too.
Regards
Edgar Britez
Sebaot Software
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
This is a DADE issue, not a RAP issue.
There is now a patch available for RB 11.06 that optimizes this partially.
RB 11 includes enhancements to the SQL Text to allow AutoSearch and Linking
features. To accomplish this the Query has to rebuild the field type info
each time you modify the SQText.
Rather than modify the SQLText property it is better to use TdaSQLBuilder to
modify the query. For examples, see the TdaSQLBuilder topic in the RBuilder
help. From there you can traverse to other related topics that have sample
code. Additional examples can be found on rbWiki, here
http://www.digital-metaphors.com/rbWiki/DADE/SQLBuilder
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com