From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Alexander Farber <alexander(dot)farber(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Basic questions about PQprepare() |
Date: | 2006-01-28 15:42:45 |
Message-ID: | 11738.1138462965@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Alexander Farber <alexander(dot)farber(at)gmail(dot)com> writes:
> 1) If PQconnectdb fails, do I still need to PQfinish the returned pointer?
Yes, if you don't want to leak memory.
> 2) Similar, if PQprepare fails, do I still need to PQclear its result?
Yes, if you don't want to leak memory.
> 3) Do I have to PQclear(res) inbetween if I want to prepare another query?
They are not comparable actions --- you can do them in either order. In
practice though I don't see why you wouldn't PQclear the result of a
PREPARE as soon as you'd checked that it wasn't conveying an error.
> 4) How do I set the last PQprepare argument, the const Oid *paramTypes?
You'd need to look up the OIDs of the parameter types. In practice it's
usally a lot easier to write the queries so that the parameter types can
be inferred by the backend.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Matthew T. O'Connor | 2006-01-28 15:53:54 | Re: stats for failed transactions (was Re: [GENERAL] VACUUM |
Previous Message | Tom Lane | 2006-01-28 15:18:15 | Re: stats for failed transactions (was Re: [GENERAL] VACUUM Question) |