Page 1 of 1

[SOLVED] Postgres - prepared statement

Posted: Thu 09 Jul 2015 17:24
by tudi_x
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

Re: Postgres - prepared statement

Posted: Fri 10 Jul 2015 10:28
by azyk
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';

Re: [SOLVED] Postgres - prepared statement

Posted: Sun 12 Jul 2015 14:17
by tudi_x
Thank you.
It worked with pv20.