Re: libpq & freeing character results
От | tomas@mamma.varadinet.de |
---|---|
Тема | Re: libpq & freeing character results |
Дата | |
Msg-id | 20000627222049.A32274@mail.aura.de обсуждение исходный текст |
Ответ на | libpq & freeing character results ("Robert A. Knop Jr." <rknop@lilys.lbl.gov>) |
Список | pgsql-interfaces |
On Tue, Jun 27, 2000 at 12:06:44PM -0700, Robert A. Knop Jr. wrote: > If one uses libpq functions such as PQfname, should one free the returned > character string? > [...] > This is explicitly answered in the documentation for PQgetvalue (it's a > pointer into the PGresult data), so I'm assuming thatt he same applies for > PQfname. Please let me know if this is a foolish assumption. > It does correspond to the general style of the interface -- and peeking into the implementation... ====================================================================== /* returns NULL if the field_num is invalid */ char * PQfname(PGresult *res, int field_num) { if (!check_field_number("PQfname", res,field_num)) return NULL; if (res->attDescs) return res->attDescs[field_num].name; else return NULL; } ====================================================================== (from src/interfaces/libpq/fe-exec.c; it's version 6.5.3, but I don't think it has changed) confirms the conjecture. Regards -- tomas
В списке pgsql-interfaces по дате отправления: