Error when executing parametrized SET statement in postgresq

The official tester's forum for ZeosLib 7.1. Ask for help, post proposals or solutions.
Post Reply
pijaffka
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 26.08.2014, 14:18

Error when executing parametrized SET statement in postgresq

Post by pijaffka »

Hello

I found problem ZEOSDBO-7.1.3a-stable when trying to run such code:

Code: Select all

      v_query.SQL.Text:= 'SET application_name = :app_name; ';
      v_query.ParamByName('app_name').AsString:= 'some_app_name';
      v_query.ExecSQL;
I got exception
ERROR: syntax error at or near "$1" LINE 1: SET application_name = $1;

It looks like zeos try to call prepare on "SET application_name = :app_name;' statement, but postgresql can accept only SELECT, UPDATE, INSERT, DELETE statements;

Executing
SET application_name = 'other_app_name' ;
works fine, problem occurs when i use params.
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Re: Error when executing parametrized SET statement in postg

Post by EgonHugeist »

Hi,
yes this is true (iven if i would agree to write such code!).

Workaround:

add 'EMULATE_PREPARES=True' to the TZDataSet.Properties. This suppressess ALL prepareable stmts too.
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
Post Reply