Search Postgresql Archives

Re: passing parameters to multiple statements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Some companies have policy to stay DB agnostic, i.e. use standard SQL only. This is why they want to use multiple statements, not stored procedures.
 
I'm not familiar with RETURNING. Is this SQL standard? Can it be used for inserting a row and returning back primary key for the inserted row in one statement?
 
If PQexecParams does not support multiple statements, it needs to be extended for the support, or new function created for the purpose. If I do the change in libpq, may I submit the code to community?
 
Thank you!
Konstantin

On Mon, Nov 16, 2009 at 2:11 PM, <manitou-sig@xxxxxxxxxxxxxxxxxx> wrote:
       Konstantin Izmailov wrote:

> I'm planning to use multiple statements via libpq. Before starting coding
> I'm trying to understand are there any limitations on passing parameters.
> E.g. would the following work:
>   PQexecParams(conn, "BEGIN;INSERT INTO tbl VALUES($1,$2);SELECT
> lastval();SELECT * INTO AUDIT FROM (SELECT $3, 'tbl action',
> lastval());COMMIT;", 3, ...);

No, because PQexecParams doesn't accept multiple SQL statements.

Best regards,
--
Daniel
PostgreSQL-powered mail user agent and storage: http://www.manitou-mail.org


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux