Re: Suggesting a libpq addition

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Marc Balmer <marc(at)msys(dot)ch>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Suggesting a libpq addition
Date: 2010-12-05 10:10:01
Message-ID: AANLkTikpaEx=7iPOkRUmg15i=z9Dbb4HSYpr8D78qgWQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Dec 5, 2010 at 10:22, Marc Balmer <marc(at)msys(dot)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.

> does connection re-establishing if the connection fails (it can be
> discussed if this already to much magic, maybe remove this part).  It
> has been carefully designed to handle memory the right way.  We use this
> since a long time.

It certainly doesn't belong in a function like that - and in fact, I
think reconnection has to be handled at a different layer anyway.What
if the connection was in the middle of a transaction? Silently rolls
it back without letting the app know, since it switched to a new one?

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexandre Riveira 2010-12-05 10:33:38 create custom collation from case insensitive portuguese
Previous Message Pavel Stehule 2010-12-05 10:01:46 Re: Suggesting a libpq addition