Albe Laurenz wrote:
> You'll have to find a way to pick or generate unique names for the
> prepared statements.
> You could check for name collisions and disambiguate with a suffix
> or something.
By the way, why do the prepared statements require to be named at all?
With other DBMS such as oracle or mysql, one can prepare statements
without providing any name for them: the prepare() step returns a
"statement handle" that is to be passed to subsequent exec() calls, no
unique name is involved. I know that you can pass an empty string to
PQPrepare(), but only one such statement can be used at a time, so it's
not the same thing.
Currently with pg, using prepared statements more or less implies
implementing an application-wide policy about naming them, otherwise
there is always the risk that some code upper in the stack has a live
statement with the same name. And what about contributed code or
libraries? That would be easier if this global namespace for prepared
statements didn't exist in the first place.
Best regards,
--
Daniel
PostgreSQL-powered mail user agent and storage:
http://www.manitou-mail.org