Hi Meskes-san,
> Ah right, my bad. The workaround should have been:
Thank you. It works.
> As for the PREPARE statement itself, could you try the attached small
> patch please.
It works well for my statement
"EXEC SQL PREPARE test_prep (int) AS SELECT id from test_table where id = $1;".
However, since data type information is not used, it does not works well
for prepare statements which need data type information such as
"EXEC SQL PREPARE test_prep (int, int) AS SELECT $1 + $2;".
It fails with "PostgreSQL error : -400[operator is not unique: unknown + unknown on line 20]".
(Of course, "EXEC SQL PREPARE test_prep AS SELECT $1::int + $2::int;" works well.)
> Could you please also verify for me if this works correctly if you use
> a variable instead of the const? As in:
> EXEC SQL BEGIN DECLARE SECTION;
> int i=2;
> EXEC SQL END DECLARE SECTION;
> ...
> EXEC SQL EXECUTE test_prep (:i);
It also works.
(Actually, I wrote "EXEC SQL EXECUTE test_prep (:i) INTO :ID;".)
ECPG produced as follows.
============================
ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "test_prep",
ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_int,&(ID),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
============================
Regards,
Ryohei Takahashi