Re: How to test for an existing connection? (ESQL/C)
Posted in 1999
Michael
>>SELECT current FROM informix.dual>>...apparently "dual" is a system table that should always be available. This
Really? I thought it was an Oracle-ism. Maybe your predecessor used this
(admittedly neat trick) to have some kind of portability between Informix and
Oracle code. All you need to do is create a table called dual with one column
and one row (which could contain NULL). This will allow you to do what you
mention above instead of, for example:
SELECT current FROM systables WHERE tabid = 1;thus sparing the system tables from application abuse<g>.
>>is what I have in there now but I'm not sure that it's the best way.
Dont know much about Fast-CGI, I'm afraid.
Just my $ 0.02
Sujit
finast@my-deja.com on 12/08/99 08:29:08 AM
Please respond to finast@my-deja.com
To: informix-list@iiug.org
cc: (bcc: Sujit Pal)
Subject: Re: How to test for an existing connection? (ESQL/C)
What I'm most interested in is the simplest successful query that is not
dependent on tables that we've created. That way the function is portable to
other informix systems. Some people do...
SELECT current FROM informix.dual
...apparently "dual" is a system table that should always be available. This
is what I have in there now but I'm not sure that it's the best way.
Yes my fast-cgi can keep track of whether or not I'm already connected, but
I was thinking that if the connection was somehow mysteriously broken then
the cgi should be smart enough to reconnect.
-Michael
In article <384C9959.B97F57C3@earthlink.net>,
Jonathan Leffler <jleffler@earthlink.net> wrote:
> I don't know how fast it is, but the simplest thing is to try getting on with
> whatever you'd like to do if the connection is there, and see whether it fails
> with an error indicating that there isn't a connection. Or is that too
> simplistic?
>
> The other question is: can't your Fast CGI code keep track of whether a
> connection has been created?
>
> andisl@idt.net wrote:
>
> > I'm using esql/C in a fastcgi. In my FCGI_Accept() loop I want the program
> > to test to see if a connection exists first and then try to connect if it
> > isn't already. Does anyone know the most elegant way to do this? Is there
a
> > simple system query I could perform to do this? I'd like to avoid
> > maintaining a static variable. I also don't want the "connection exists"
> > test to be labor intensive for the database. There must be some simple quey
> > for this right? ideas? expert opinions? I look forward to replies.
>
> --
> Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net)
> Guardian of DBD::Informix v0.62 -- see http://www.perl.com/CPAN
> #include <disclaimer.h>
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.