sad@bankir.ru wrote:
> hi
>
> does PQgetvalue() allocate memory rof its result, it returns ?
> the answer will help me in problem:
> should i free some cstring_variable if
> { cstring_variable=PQgetvalue(pgresult_variable,0,0); }
> and could i PQclear(pgresult_varible) while cstring_varible is in use.
From the documentation: The pointer returned by PQgetvalue points to storage that is part of the PGresult structure.
Oneshould not modify the data it points to, and one must explicitly copy the data into other storage if it is to be
usedpast the lifetime of the PGresult structure itself.
So no, you must not free your copy of the pointer returned by PQgetvalue,
and no, once you PQclear the result your pointer is not valid. You should