[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [cgiapp] CAP::DBH + FastCGI: persistent DB connections, please


Mark,

You misunderstood my original statement.  I was suggesting that the
$dbh->ping() call be put in the cgiapp_init() block or an equivalent, and
run once per execution of the PAGE, not before very DBI call!  Of course,
this suggestion was only if Sven was going to implement connection caching
himself.  The whole discussion was made irrelevant once we start using the
connect_cached() method.

What you're describing sounds like the perfect use of the hacked up
try/catch blocks in CPAN.

Josh


--
Josh Danziger
suppressed 
-----Original Message-----
From: Mark A. Fuller [mailto:suppressed 
Sent: Monday, October 31, 2005 9:48 AM
To: Josh Danziger; 'Sven Neuhaus'; suppressed
Subject: RE: [cgiapp] CAP::DBH + FastCGI: persistent DB connections, please

I never liked the approach of pinging the DBH *before every* access. Since
the occasional error is the exception, why not write a small common "retry"
routine that would only be called if the access fails? If it fails, drop the
presumably prepared statement handle, prepare again. If it fails, drop the
DBH and all prepared statement handles, reconnect, prepare the statement
handle. 

This eliminates a needless ping before what should be a predominance of
successful accesses. The post-access error test has to be there anyway. All
you need is something slightly elaborate to decide how to handle the error
(whether to undef/re-prepare the statement, undef/re-connect to the
database).

I guess it has to do with how obsessed a person might be with performance.
But, once you write the error handler it works for any application.

Mark

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.