Skip site navigation (1) Skip section navigation (2)

Re: allowing multiple PQclear() calls

From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: Marko Kreen <markokr(at)gmail(dot)com>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, Josh Kupershmidt <schmiddy(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: allowing multiple PQclear() calls
Date: 2013-01-02 16:00:44
Message-ID: 50E459AC.7060900@cybertec.at (view raw or flat)
Thread:
Lists: pgsql-hackers
2013-01-02 16:27 keltezéssel, Marko Kreen írta:
> On Wed, Jan 2, 2013 at 5:11 PM, Boszormenyi Zoltan <zb(at)cybertec(dot)at> wrote:
>> 2012-12-11 16:09 keltezéssel, Simon Riggs írta:
>>
>>> On 11 December 2012 12:18, Boszormenyi Zoltan <zb(at)cybertec(dot)at> wrote:
>>>
>>>>>> Such mechanism already exist - you just need to set
>>>>>> your PGresult pointer to NULL after each PQclear().
>>>>> So why doesn't PQclear() do that?
>>>>
>>>> Because then PQclear() would need a ** not a *. Do you want its
>>>> interface changed for 9.3 and break compatibility with previous versions?
>>> No, but we should introduce a new public API call that is safer,
>>> otherwise we get people continually re-inventing new private APIs that
>>> Do the Right Thing, as the two other respondents have shown.
>>>
>> How about these macros?
> * Use do { } while (0) around the macros to get proper statement behaviour.
> * The if() is not needed, both PQclear and PQfinish do it internally.
> * Docs
>
> Should the names show somehow that they are macros?
> Or is it enough that it's mentioned in documentation?

Done. The fact that these are macros is mentioned in the docs.

-- 
----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt, Austria
Web: http://www.postgresql-support.de
      http://www.postgresql.at/


Attachment: pqclear-pqfinish-set-null-v2.patch
Description: text/x-patch (3.2 KB)

In response to

pgsql-hackers by date

Next:From: Boszormenyi ZoltanDate: 2013-01-02 16:02:46
Subject: Re: allowing multiple PQclear() calls
Previous:From: Heikki LinnakangasDate: 2013-01-02 15:52:36
Subject: Re: allowing multiple PQclear() calls

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group