From: | ljb <ljb220(at)mindspring(dot)com> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: libpq-fe: PQgetvalue() ? |
Date: | 2004-10-15 00:51:32 |
Message-ID: | ckn6uj$g28$2@news.hub.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
sad(at)bankir(dot)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. One should not modify the data it points to, and
one must explicitly copy the data into other storage if it is to be used
past 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
From | Date | Subject | |
---|---|---|---|
Next Message | C. Bensend | 2004-10-15 04:18:21 | Inserting into table only if the row does not already exist. |
Previous Message | sad | 2004-10-14 12:34:22 | libpq-fe: PQgetvalue() ? |