Thread: Reset?

Reset?

From
Joep deVocht
Date:
Hi,

I'm using Postgres 7.1 with the C++ interface
and am facing the following problem.
I notice that when I send a invalid query to the dbase server
using "Exec" (For instance when trying to put an integer value
into the table that is too large) that the next Exec fails with
a segmentation fault.

I know it's possible to "reset" the connection or something similar,
so that after an invalid query, new queries can be sent 
without problems. I know this because "psql" is able to.
Problem is that I can't seem to figure out how they do it.

Can anyone help me with this?

Many thanx in advance,

Joep.


Re: Reset?

From
jtv
Date:
On Thu, Mar 14, 2002 at 10:04:40AM -0800, Joep deVocht wrote:
> 
> I know it's possible to "reset" the connection or something similar,
> so that after an invalid query, new queries can be sent 
> without problems. I know this because "psql" is able to.
> Problem is that I can't seem to figure out how they do it.

There is a function in libpq (which libpq++ is built on top of), called
PQreset().  Unless I'm mistaken, libpq++ doesn't currently expose this 
in its API (the alternative libpqxx currently makes it a private method, 
see my home page below).

There's a brief description of PQreset() at:

http://www.us.postgresql.org/users-lounge/docs/7.2/postgres/libpq-connect.html

I have no idea whether resetting the connection will solve your problem
though.  Going by the docs, the function is there mainly to let you
recover broken connections.


Jeroen

http://members.ams.chello.nl/j.vermeulen31/