You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Ged Haywood <ge...@www2.jubileegroup.co.uk> on 2001/12/18 10:58:55 UTC
Re: mod_perl book status
Hi all,
On Mon, 17 Dec 2001, Stas Bekman wrote (privately, discussing a book review:):
> Ged wrote:
> <book_extract>
> If you want to use C<Apache::DBI> but you have both situations on
> one machine, at the time of writing the only solution is to run two
> mod_perl enabled servers, one which uses C<Apache::DBI> and one
> which does not.
> </book_extract>
> [META: Stas: Could one not simply patch Apache::DBI to
> permit disconnects from one of the databases? -- Ged.]
>
> That's probably a good idea. Go ahead and suggest it to the author/list?
Author/List: Is this a Good Idea?
73,
Ged.
Re: mod_perl book status
Posted by Robert Landrum <rl...@capitoladvantage.com>.
At 9:58 AM +0000 12/18/01, Ged Haywood wrote:
>Hi all,
>
>On Mon, 17 Dec 2001, Stas Bekman wrote (privately, discussing a book review:):
>
>> Ged wrote:
>> <book_extract>
>> If you want to use C<Apache::DBI> but you have both situations on
>> one machine, at the time of writing the only solution is to run two
>> mod_perl enabled servers, one which uses C<Apache::DBI> and one
>> which does not.
>> </book_extract>
>> [META: Stas: Could one not simply patch Apache::DBI to
>> permit disconnects from one of the databases? -- Ged.]
>>
>> That's probably a good idea. Go ahead and suggest it to the author/list?
>
>Author/List: Is this a Good Idea?
I've not tested or tried this, but wouldn't this patch work?
--- ApacheDBI-0.88/DBI.pm Fri Jan 12 13:59:00 2001
+++ ADBI.pm Tue Dec 18 11:53:00 2001
@@ -177,6 +177,10 @@
@ISA=qw(DBI::db);
use strict;
sub disconnect {
+ my $dbh = shift;
+ if($dbh->{'DBIDisconnect'}) {
+ $dbh->DBI::db::disconnect();
+ }
my $prefix = "$$ Apache::DBI ";
print STDERR "$prefix disconnect (overloaded) \n" if $Apache::DBI::DEBUG
> 1;
1;
Thus setting the DBIDisconnect flag would cause the dbh to be disconnected.
Rob
--
When I used a Mac, they laughed because I had no command prompt. When
I used Linux, they laughed because I had no GUI.
Re: mod_perl book status
Posted by Ged Haywood <ge...@www2.jubileegroup.co.uk>.
Hi all,
On Tue, 18 Dec 2001, Geoffrey Young wrote:
> > >From one of Geoffrey's digests:
> > You can disable Apache::DBI database handle persistence on the fly
>
> wish I could still do those :)
Yeah...
> a few versions ago, DBI did one better and added the dbi_connect_method
> connect attribute, which does the same thing but is far less kludgy
Well this was all a little embarrassing really...
But I think we now have what we need for the book! :)
73,
Ged.
Re: mod_perl book status
Posted by Geoffrey Young <ge...@modperlcookbook.org>.
>
> >From one of Geoffrey's digests:
>
> You can disable Apache::DBI database handle persistence on the fly
> by changing DBI->connect() to the undocumented 5 parameter call
> $dbh = DBI->connect($dbase, $user, $pass, \%attr,
> undef, "connect") || die $DBI::errstr;
> This will override the default Apache::DBI behavior of caching new
> connections without affecting those previously cached
wish I could still do those :)
anyway, a few versions ago, DBI did one better and added the
dbi_connect_method connect attribute, which does the same thing but is
far less kludgy
--Geoff
Re: mod_perl book status
Posted by Perrin Harkins <pe...@elem.com>.
> On Mon, 17 Dec 2001, Stas Bekman wrote (privately, discussing a book
review:):
>
> > Ged wrote:
> > <book_extract>
> > If you want to use C<Apache::DBI> but you have both situations on
> > one machine, at the time of writing the only solution is to run two
> > mod_perl enabled servers, one which uses C<Apache::DBI> and one
> > which does not.
> > </book_extract>
> > [META: Stas: Could one not simply patch Apache::DBI to
> > permit disconnects from one of the databases? -- Ged.]
> >
> > That's probably a good idea. Go ahead and suggest it to the author/list?
>
> Author/List: Is this a Good Idea?
>From one of Geoffrey's digests:
You can disable Apache::DBI database handle persistence on the fly
by changing DBI->connect() to the undocumented 5 parameter call
$dbh = DBI->connect($dbase, $user, $pass, \%attr,
undef, "connect") || die $DBI::errstr;
This will override the default Apache::DBI behavior of caching new
connections without affecting those previously cached
Does that do it?
- Perrin