On Thu, Sep 12, 2002 at 09:07:20AM -0400, Tom Lane wrote:
> Michael Meskes <meskes@postgresql.org> writes:
> > I'm awfully sorry that I missed this thread. But I do not really
> > understand the problem. If we cannot be exactly as specified why aren't
> > we coming close? As it stands now I have to implement my own
> > PREPARE/EXECUTE in ecpg and the syntax does clash with the backend one.
>
> But you must implement your own PREPARE/EXECUTE anyway, using ecpg
> variables, no? If you can really embed what you need in the backend
> facility, and only the syntax variation is getting in the way, then
> maybe I misunderstand the problem. How do parameters of PREPAREd
> statements work in ecpg?
In ecpg you can use a string variable or constant holding the statement
to prepare that statement as in
exec sql prepare STMT from string;
This binds the ident STMT to the statement in string. Later you can then
declare a cursor using
exec sql declare CURS cursor for STMT;
or execute the statement using
exec sql execute STMT;
Now if you have a parameter in the prepared statement by just specify
"?" instead some value, you add a using clause during execution to set
the values.
I'm not sure where you expect the ecpg variables. If you're talking
about C variables they won't be seen by any statement since ecpg creates
an ascii string of the whole statement before sending it to the backend.
Michael
--
Michael Meskes
Michael@Fam-Meskes.De
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!