pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedURGENT : free result (libpq++ API)
2+ messages / 2 participants
[nested] [flat]
* URGENT : free result (libpq++ API)
@ 2003-08-21 05:57 Anagha Joshi <ajoshi@nulinkinc.com>
2003-08-21 06:11 ` Re: URGENT : free result (libpq++ API) Stephan Szabo <sszabo@megazone.bigpanda.com>
0 siblings, 1 reply; 2+ messages in thread
From: Anagha Joshi @ 2003-08-21 05:57 UTC (permalink / raw)
To: pgsql-hackers-owner@postgresql.org; pgsql-admin@postgresql.org; pgsql-sql
Hi all,
I'm using PG - 7.2.4 on Solaries.
I'm using "libpq++" library as client implementation is coded in "C++".
I'm doing the following :
1. Making the connection to database by creating new object of
"PgDatabase" i.e.
data = new PgDatabase( " CONNECTION INFO ");
2. Then I execure the query with:
int return = data->Exec( " THIS IS A SQL QUERY");
My question is ,
How should I clear(free) the result of the query? Need I close the
connection after each query to do that?
I wish to use the same connection for multiple queries.
This problem I've observed with "libpq++" only not with "libpq" . With
"libpq" APIs the,
"PQexec" API returns "PGresult" type pointer with which we can clear
with the result of the query with "Pqclear(Pgresult *)" API.
Is the same functionality is present in "lipq++" APIs also?
Pls. help.
Thanks,
Anagha
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: URGENT : free result (libpq++ API)
2003-08-21 05:57 URGENT : free result (libpq++ API) Anagha Joshi <ajoshi@nulinkinc.com>
@ 2003-08-21 06:11 ` Stephan Szabo <sszabo@megazone.bigpanda.com>
0 siblings, 0 replies; 2+ messages in thread
From: Stephan Szabo @ 2003-08-21 06:11 UTC (permalink / raw)
To: Anagha Joshi <ajoshi@nulinkinc.com>; +Cc: pgsql-hackers-owner@postgresql.org; pgsql-admin@postgresql.org; pgsql-sql
On Thu, 21 Aug 2003, Anagha Joshi wrote:
> Hi all,
> I'm using PG - 7.2.4 on Solaries.
> I'm using "libpq++" library as client implementation is coded in "C++".
>
> I'm doing the following :
> 1. Making the connection to database by creating new object of
> "PgDatabase" i.e.
> data = new PgDatabase( " CONNECTION INFO ");
>
> 2. Then I execure the query with:
> int return = data->Exec( " THIS IS A SQL QUERY");
>
> My question is ,
> How should I clear(free) the result of the query? Need I close the
> connection after each query to do that?
It looks to me that PgConnection::Exec clears an existing query result
when it's called.
// PgConnection::exec -- send a query to the backend
ExecStatusType PgConnection::Exec(const char* query)
{
// Clear the result stucture if needed
if (pgResult)
PQclear(pgResult);
// Execute the given query
pgResult = PQexec(pgConn, query);
// Return the status
if (pgResult)
return PQresultStatus(pgResult);
else
return PGRES_FATAL_ERROR;
}
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2003-08-21 06:11 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-08-21 05:57 URGENT : free result (libpq++ API) Anagha Joshi <ajoshi@nulinkinc.com>
2003-08-21 06:11 ` Stephan Szabo <sszabo@megazone.bigpanda.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox