Re: mod_perl book status

2001-12-18 Thread Robert Landrum

At 9:58 AM + 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 CApache::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 CApache::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

2001-12-18 Thread Geoffrey Young


 
 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