Re: URGENT : free result (libpq++ API)

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Anagha Joshi <ajoshi(at)nulinkinc(dot)com>
Cc: <pgsql-hackers-owner(at)postgresql(dot)org>, <pgsql-admin(at)postgresql(dot)org>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: URGENT : free result (libpq++ API)
Date: 2003-08-21 06:11:10
Message-ID: 20030820230649.P33044-100000@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin 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;
}

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message mathan 2003-08-21 07:20:51 Re: Starting PostgreSQL 7.3.4 with Webmin on Mandrake 9.1
Previous Message Anagha Joshi 2003-08-21 05:57:23 URGENT : free result (libpq++ API)

Browse pgsql-sql by date

  From Date Subject
Next Message Oleg Bartunov 2003-08-21 07:38:41 Re: "SELECT IN" Still Broken in 7.4b
Previous Message Anagha Joshi 2003-08-21 05:57:23 URGENT : free result (libpq++ API)