SQL with parameters

Discussion of open issues, suggestions and bugs regarding PgDAC (PostgreSQL Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Isaev
Posts: 3
Joined: Wed 04 Mar 2020 15:06

SQL with parameters

Post by Isaev » Wed 04 Mar 2020 15:18

for example:

Code: Select all

PgQuery.SQL.Text := 'SELECT * FROM table WHERE field1=:field1';
PgQuery.ParamByName('field1').AsString := '10';
How can I get SQL with replaced parameters?
The component actually replaces the parameters in the SQL, before sending to the server
whether there are property from where it is possible to get: SELECT * FROM table WHERE field1=10?

oleg0k
Devart Team
Posts: 65
Joined: Wed 11 Mar 2020 08:28

Re: SQL with parameters

Post by oleg0k » Mon 16 Mar 2020 15:09

Hello,
PgDAC doesn't have a property for replacing the parameters in a SQL statement with actual values.
You may use the TPgSQLMonitor component to monitor which SQL statements are being sent to the server.
PgDAC uses protocol version 3, which assumes sending SQL statements and parameters separately.

wbr, Oleg

Post Reply