Re: passing parameters to multiple statements

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Konstantin Izmailov <pgfizm(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: passing parameters to multiple statements
Date: 2009-11-16 08:24:35
Message-ID: 162867790911160024u581073c2j52c2e7ce037bd6da@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello

2009/11/16 Konstantin Izmailov <pgfizm(at)gmail(dot)com>:
> 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, ...);
>

sorry, it is not direct reply on your question, but why don't you use
simply stored procedure?

btw. It looks like case for trigger
did you know RETURNING clause?

your code is very cumbrous

Regards
Pavel Stehule

> Thank you!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jasen Betts 2009-11-16 08:30:07 Re: Absolute value of intervals
Previous Message Boszormenyi Zoltan 2009-11-16 08:14:57 What is the correct way to extract values from an int8 array in SPI?