Mark A. Fuller wrote:
> From: Josh Danziger <suppressed>
>
>>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!
>
> The same principle isn't it? Why test for a successful condition prior to accessing the DB, when you would expect most accesses to be successful? A slightly more robust error-handling routine (to accomodate retries) not only eliminates pre-access tests but also seamlessly handles what may be intermittent failures (network problems, timeouts?).
ping() is usually a super optimized, blazingly fast method on most dbi
drivers. The question really comes down to, is the overhead of ping()
greater than the overhead of an eval{} (or worse if you use something else).
Benchmark anyone?
>>The whole discussion was made irrelevant once we start using the
>
> connect_cached() method.
>
> Does connect_cached do the ping for you? I noticed you described it as using the cached handle if the database is still available. It sounded like it simply performs the pre-access work for you (which to me, I don't like).
I think you need to find out if trying to catch all database access
failures and then trying again is really faster than doing a ping()
ahead of time. Even if your approach is marginally faster, pinging at
the top of the request (in one place) seems like a maintence win to me.
>>What you're describing sounds like the perfect use of the hacked up try/catch blocks in CPAN.
I'd avoid these if possible since most use source filters, which can be
fun to play with, but can really cause obscure problem. But some of them
can be used partially with good effect.
We've used Exception::Class::TryCatch with some success as long as you
stick to using
eval{
...
};
catch();
instead of
try eval{
...
};
do{
...
};
catch();
which uses source filters
--
Michael Peters
Developer
Plus Three, LP
---------------------------------------------------------------------
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.