Search Postgresql Archives

Re: Basic questions about PQprepare()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Alexander Farber <alexander.farber@xxxxxxxxx> 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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux