From: Brandon L. Black Date: Fri, 9 Jun 2006 18:19:33 +0000 (+0000) Subject: only rebless S::DBI if it is still S::DBI and not a subclass X-Git-Tag: v0.07002~75^2~124 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2fd24e78f75a3bdb2f60f44dda7199387c69c6a5;p=dbsrgits%2FDBIx-Class.git only rebless S::DBI if it is still S::DBI and not a subclass --- diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index 605f8bb..2b4b68b 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -498,12 +498,16 @@ sub _populate_dbh { my ($self) = @_; my @info = @{$self->_connect_info || []}; $self->_dbh($self->_connect(@info)); - my $driver = $self->_dbh->{Driver}->{Name}; - eval "require DBIx::Class::Storage::DBI::${driver}"; - unless ($@) { - bless $self, "DBIx::Class::Storage::DBI::${driver}"; - $self->_rebless() if $self->can('_rebless'); + + if(ref $self eq 'DBIx::Class::Storage::DBI') { + my $driver = $self->_dbh->{Driver}->{Name}; + eval "require DBIx::Class::Storage::DBI::${driver}"; + unless ($@) { + bless $self, "DBIx::Class::Storage::DBI::${driver}"; + $self->_rebless() if $self->can('_rebless'); + } } + # if on-connect sql statements are given execute them foreach my $sql_statement (@{$self->on_connect_do || []}) { $self->debugobj->query_start($sql_statement) if $self->debug();