[SOLVED] Postgres - prepared statement

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
tudi_x
Posts: 15
Joined: Thu 09 Jul 2015 17:14
Location: Oklahoma

[SOLVED] Postgres - prepared statement

Post by tudi_x » Thu 09 Jul 2015 17:24

Hi Support,
I am using Unidac version 6.14 with Lazarus 1.4.
Connecting to Postgres i am sending something like below after connecting:

start transaction;
sql1;
...
sql10;
commit;

in a ExecSQL command.

I am getting an error with '...cannot insert multiple commands into a prepared statement'.
Please advise how this could be sent to the server, the below did not work for me and I did not find a reference somewhere else:

conn.SpecificOptions.Values['UnpreparedCommandExecution'] := 'true';

Thank you
Last edited by tudi_x on Sun 12 Jul 2015 14:16, edited 1 time in total.

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: Postgres - prepared statement

Post by azyk » Fri 10 Jul 2015 10:28

In order to execute several commands separated by semicolon in one SQL query, use Protocol 2.0 for connection to PostgreSQL For this, before establishing connection, set the 'UnpreparedExecute' specific option to 'True'. For example:

Code: Select all

UniConnection.SpecificOptions.Values['ProtocolVersion'] := 'pv20';

tudi_x
Posts: 15
Joined: Thu 09 Jul 2015 17:14
Location: Oklahoma

Re: [SOLVED] Postgres - prepared statement

Post by tudi_x » Sun 12 Jul 2015 14:17

Thank you.
It worked with pv20.

Post Reply