Re: libpq-fe: PQgetvalue() ?

From: Christoph Haller <ch(at)rodos(dot)fzk(dot)de>
To: sad <sad(at)bankir(dot)ru>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: libpq-fe: PQgetvalue() ?
Date: 2004-10-15 08:57:18
Message-ID: 416F90ED.A65CB3B1@rodos.fzk.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

AFAIK it does allocate memory.
You cannot PQclear(pgresult_varible) while cstring_varible is in use.
You do not need to free cstring_variable, PQclear(pgresult_varible) will do.
I personally prefer to allocate local memory, "strcpy" PQgetvalue,
and then PQclear. But that's a matter of taste, I suppose.

Regards, Christoph

sad 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.
>
> thnx
>

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message C. Bensend 2004-10-15 13:14:51 Re: Inserting into table only if the row does not already
Previous Message Greg Stark 2004-10-15 05:10:50 Re: Inserting into table only if the row does not already exist.