Re: Suggesting a libpq addition - Mailing list pgsql-hackers

From Magnus Hagander
Subject Re: Suggesting a libpq addition
Date
Msg-id AANLkTik1m+55nvtMP2x4R5w0RQnw_5tpV-xmxKDQ13Gg@mail.gmail.com
Whole thread Raw
In response to Re: Suggesting a libpq addition  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Responses Re: Suggesting a libpq addition  (Dmitriy Igrishin <dmitigr@gmail.com>)
List pgsql-hackers
On Sun, Dec 5, 2010 at 11:57, Heikki Linnakangas
<heikki.linnakangas@enterprisedb.com> wrote:
> On 05.12.2010 12:10, Magnus Hagander wrote:
>>
>> On Sun, Dec 5, 2010 at 10:22, Marc Balmer<marc@msys.ch>  wrote:
>>>
>>> I am suggesting adding a function to libpq:
>>>
>>> PGresult *PQvexec(PGconn *conn, const char *fmt, ...);
>>>
>>> It behaves similar to PQexec, but it allows for printf style varargs and
>>
>> How is that not a horrible idea, compared to using PQexecParams()? You
>> have to remember to do all your escaping and things manually, whereas
>> PQexecParams() does it automatically.
>
> A varargs version of PQexecParams() would be handy, though. Imagine being
> able to do:
>
> PQexecVParams("SELECT * FROM mytable WHERE foo = $1 AND bar = $2", foovar,
> barvar);
>
> instead of constructing an array for the variables.

I agree, that sounds a lot more useful. And if definitely needs to be
split off from the auto-reconnection stuff.


--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/


pgsql-hackers by date:

Previous
From: Marc Balmer
Date:
Subject: Re: Suggesting a libpq addition
Next
From: Dmitriy Igrishin
Date:
Subject: Re: Suggesting a libpq addition