On 10/27/2007 08:43 PM, John Siracusa wrote:
> On 10/27/07, Peter Karman <[EMAIL PROTECTED]> wrote:

>> All that's really necessary is to call DBI->connect_cached() rather than
>> DBI->connect(). That part seems pretty simple to me and ought to be a feature
>> rather than requiring everyone who wants it to override init_dbh() in their
>> local Rose::DB subclass.
> 
> Yes, definitely, only I don't want to hard-code the possible choices.
> I suspect the DBI->connect() (or whatever) call will end up being
> split out into its own method for easier customization.   I'll think
> about it a bit more...
> 

Here's a simple implementation, written against current svn trunk.

Index: lib/Rose/DB.pm
===================================================================
--- lib/Rose/DB.pm      (revision 1484)
+++ lib/Rose/DB.pm      (working copy)
@@ -872,6 +872,11 @@

 use constant DID_PCSQL_KEY => 'private_rose_db_did_post_connect_sql';

+sub dbi_connect {
+  my($self) = shift;
+  return DBI->connect(@_);
+}
+
 sub init_dbh
 {
   my($self) = shift;
@@ -880,12 +885,12 @@

   my $dsn = $self->dsn;

-  $Debug && warn "DBI->connect('$dsn', '", $self->username, "', ...)\n";
+  $Debug && warn "->dbi_connect('$dsn', '", $self->username, "', ...)\n";

   $self->{'error'} = undef;
   $self->{'database_version'} = undef;

-  my $dbh = DBI->connect($dsn, $self->username, $self->password, $options);
+  my $dbh = $self->dbi_connect($dsn, $self->username, $self->password, 
$options);

   unless($dbh)
   {


-- 
Peter Karman  .  [EMAIL PROTECTED]  .  http://peknet.com/


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to