Hi Meskes-san
cc: Takahashi-san, Kuroda-san, Ideriha-san
I attach a new patch. Please review it.
Excuse:
It doesn't include regression tests and pass them.
Because I must reset all expected C program of regression.
# I add an argument to ECPGdo().
I explain the patch as follows:
1. Specification
It accepts the following .pgc.
I confirmed it works well for AT clause.
All results for st1 and st2 are same.
exec sql prepare st0 as select 1;
exec sql prepare st1(int,int) as select $1 + 5 + $2;
exec sql prepare st2 from "select ? + 5 + ?";
exec sql prepare st3(bytea) as select octet_length($1);
exec sql execute st0 into :ovar;
exec sql execute st1(:var1,:var2) into :ovar;
exec sql execute st1(11, :var2) into :ovar;
exec sql execute st2(:var1,:var2) into :ovar;
exec sql execute st2(11, :var2) into :ovar;
exec sql execute st1 into :ovar using :var1,:var2;
exec sql execute st2 into :ovar using :var1,:var2;
exec sql execute st3(:b) into :ovar;
2. Behavior of ecpglib
(1) PREPARE with AS clause
Ecpglib sends the PREPARE statement to backend as is. (using PQexec).
(2) EXECUTE with parameter list
Ecpglib sends the EXECUTE statement as is (using PQexec), but all host variables in
the list are converted to string-formatted and embedded into the EXECUTE statement.
(3) PREPARE with FROM clause (not changed)
Ecpglib sends 'P' libpq-message with statement (using PQprepare).
(4) EXECUTE without parameter list (not changed)
Ecpglib sends 'B' libpq-message with parameters. (using PQexecPrepared).
3. Change of preprocessor
- I add ECPGst_prepare and ECPGst_execnormal.
ECPGst_prepare is only for (1) and ECPGst_execnormal is only for (2).
# I think the names are not good.
- I add one argument to ECPGdo(). It's for prepared statement name.
4.
I wonder whether I should merge (3) to (1) and (4) to (4) or not.
Regards
Ryo Matsumura