Hi,
i have a lot of old delphi codes like this:
SomeQuery.SQL.Text:='select Name from SomeTable where Version=:Version ';
SomeQuery.ParamByName('Version').asString:='1';
SomeQuery.Open;
now application adopted for work with PostreSQL via Unidac and code should like this:
'select "Name" from SomeTable where "Version"=:"Version" ';
So, please, help me to choose appropriate TUniQuery methods (to override) for change query text on the fly
There are a variety of places: BeforeOpen, AssembleSQL, InternalOpen, Macros....TUniQuery.SQL or TUniQuery.FCommand.SQL..etc
And how to synchronize parameters (or query params parsing) for updated quoted identifiers?
Modify SQL text on the fly
Re: Modify SQL text on the fly
Hi,
Try use:
- Prepare method before setting parameters and Open
- 'select "Name" from SomeTable where "Version"=:Version ';
PostgreSQL dislikes big letters in names, but supports them by "".
Regards
Michal
Try use:
- Prepare method before setting parameters and Open
- 'select "Name" from SomeTable where "Version"=:Version ';
PostgreSQL dislikes big letters in names, but supports them by "".
Regards
Michal
Re: Modify SQL text on the fly
Please explain the reason of the neccessity for quoting field and parameter names as it is shown in the query you provided.
You can change the text of a SQL query by referring to the 'SomeQuery.SQL.Text' property. Explain, please, in what cases you need to use such changes in your projects.
You can change the text of a SQL query by referring to the 'SomeQuery.SQL.Text' property. Explain, please, in what cases you need to use such changes in your projects.