Thread: ecpg - problem compiling prepare and declare statements

ecpg - problem compiling prepare and declare statements

From
Paul Tilles
Date:
Using psql V7.4.1 and ecpg V3.1.0 on RH Linux 7.2, gcc compiler:

The following statement precompiles, compiles and links fine:

EXEC SQL declare state_cursor cursor for "select unique state from
location where post = 1";

I then change the above to

EXEC SQL BEGIN DECLARE SECTION;
const char *stmt="select unique state from location where post = 1";
EXEC SQL END DECLARE SECTION;

EXEC SQL declare state_cursor cursor for :stmt;

These statements generate the following warning from the gcc compiler:

warning: passing arg 3 of  ECPGprepare discards qualifiers from pointer
target type

and the link fails.

What am I doing wrong?

TIA,
Paul Tilles