Re: mod_perl/Apache::DBI

[prev] [thread] [next] [Date index for 2005/04/07]

From: Vincent E. Veselosky
Subject: Re: mod_perl/Apache::DBI
Date: 01:05 on 07 Apr 2005

Perrin Harkins wrote:

>On Wed, 2005-04-06 at 19:10 -0400, Vince Veselosky wrote:
>  
>
>>Hmm. I'm running Debian Sarge, so whatever they provide as .deb is what 
>>I have. I can promise you there was no ping in DBD/mysql.pm before I 
>>implemented it. My version (of DBD::mysql) claims to be 2.9003.
>>    
>>
>
>It's there.  Much older versions have it too.  If it wasn't there,
>Class::DBI would have simply refused to run at all.  You would be seeing
>errors about a missing ping method that Ima::DBI is trying to call.
>
>  
>
Ah, I see. I was under the impression that it was inheriting a default 
implementation that just returned 1, but I see now that ping is 
implemented inside the Dynaloader magic. Serves me right for not 
speaking C. I think I understand my initial problem better now. Thanks 
Perrin. See, this is why it's good when you don't mind looking stupid, 
you learn all kinds of new things when people point out how stupid you are!

>>That note in the Apache::DBI doc is in the current version, BTW, 
>>although it does not mention MySQL explicitly.
>>    
>>
>
>Right, that was changed because DBD::mysql got a ping method.  I'm
>thinking the version of Apache::DBI you have there is several years old.
>
>  
>
Not to argue, but:  http://search.cpan.org/~abh/Apache-DBI-0.94/DBI.pm
Perhaps the documentation is due for an update? Or is there a newer 
version that the search engine is not giving me?

>You might want to look into using the built-in ping just because it gets
>called often and it would be more efficient than the one you've added.
>It's implemented at the C level.
>  
>
Will do, now that I understand what's going on. Thanks again for setting 
me straight.

Just for the edification of anyone following this thread, my *real* 
problem was that I was pulling out the database handle from Class::DBI 
and then handing it to another (unrelated) class (CGI::Session). 
Unfortunately, I did it incorrectly, and instead of getting a "fresh" 
database handle (the one CDBI was using) on every request, CGI::Session 
just kept using the same handle it got the first time. When it timed 
out, there was never any ping to bring it back (because Ima::DBI was 
doing it, not Apache::DBI as I had thought), so a server restart was 
required. The reason it confused me was that I could not narrow the 
problem down until I put my fake ping in place, which left "SELECT 1" 
traces all through my mysql.log and I could easily tell which queries 
were not getting pinged. Unfortunately my brain stopped working at that 
point and I never realized that ping was there all along, I just never 
saw it.


Your humble servant, ;-)
-Vince

(message missing)

mod_perl/Apache::DBI
e-just 16:07 on 06 Apr 2005

Re: mod_perl/Apache::DBI
Perrin Harkins 18:41 on 06 Apr 2005

Re: mod_perl/Apache::DBI
Vince Veselosky 22:35 on 06 Apr 2005

Re: mod_perl/Apache::DBI
Andy Grundman 22:49 on 06 Apr 2005

Re: mod_perl/Apache::DBI
Perrin Harkins 22:53 on 06 Apr 2005

Re: mod_perl/Apache::DBI
Vince Veselosky 23:10 on 06 Apr 2005

Re: mod_perl/Apache::DBI
Perrin Harkins 23:25 on 06 Apr 2005

Re: mod_perl/Apache::DBI
Vincent E. Veselosky 01:05 on 07 Apr 2005

Re: mod_perl/Apache::DBI
=?ISO-8859-1?Q?Ask_Bj=F8rn_Hansen?= 02:12 on 07 Apr 2005

Generated at 14:42 on 11 Apr 2005 by mariachi v0.52