Checking for open connections using ECPG

Поиск
Список
Период
Сортировка
Искать

Checking for open connections using ECPG

От:
Jim Parker <hparker@fit.edu>
Дата:
G'Day !

Is there anyway to check for open connections to a database using ECPG ?

Basically I want to check a connection is open, and if not, open a 
connection  to the database.

TIA

cheers,
JIm Parker

Re: Checking for open connections using ECPG

От:
Michael Meskes <meskes@postgresql.org>
Дата:
On Wed, Mar 06, 2002 at 02:20:05PM -0500, Jim Parker wrote:
> Is there anyway to check for open connections to a database using ECPG ?

Well, you should be able to call ECPGget_connection(). However, it seems
the function is not defined in the include files, so the prototype is:

struct connection * ECPGget_connection(const char *);

But struct connection is an internal datatype that also is not defined
in any header file. So you have to get this from the sources of ecpglib.

To be honest this is a hack. I think I will create a function that does
exactly what you need. Any one out there with an idea how to call this
with an EXEC SQL syntax? 

Michael
-- 
Michael Meskes
Michael@Fam-Meskes.De
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!

Re: Checking for open connections using ECPG

От:
Lee Kindness <lkindness@csl.co.uk>
Дата:
Well Ingres has INQUIRE_SQL, Sybase has GET DIAGNOSTICS, ... These
seem to do something similiar to what we're talking about (and a whole
lot more too).

Best just using somethign else... Howabout:
GET CONNECTION [CONNECTIONNAME] INTO :var

?

Michael Meskes writes:> On Wed, Mar 06, 2002 at 02:20:05PM -0500, Jim Parker wrote:> > Is there anyway to check for open connections to a database using ECPG ?> > Well, you should be able to call ECPGget_connection(). However, it seems> the function is not defined in the include files, so the prototype is:> > struct connection * ECPGget_connection(const char *);> > But struct connection is an internal datatype that also is not defined> in any header file. So you have to get this from the sources of ecpglib.> > To be honest this is a hack. I think I will create a function that does> exactly what you need. Any one out there with an idea how to call this> with an EXEC SQL syntax? > > Michael> -- > Michael Meskes> Michael@Fam-Meskes.De> Go SF 49ers! Go Rhein Fire!> Use Debian GNU/Linux! Use PostgreSQL!> > ---------------------------(end of broadcast)---------------------------> TIP 3: if posting/reading through Usenet, please send an appropriate> subscribe-nomail command to majordomo@postgresql.org so that your> message can get through to the mailing list cleanly

FAQ