[Bast-commits] r7160 - in
DBIx-Class/0.08/branches/mssql_storage_minor_refactor:
lib/DBIx/Class/Storage t
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Fri Jul 31 13:52:41 GMT 2009
Author: caelum
Date: 2009-07-31 13:52:41 +0000 (Fri, 31 Jul 2009)
New Revision: 7160
Modified:
DBIx-Class/0.08/branches/mssql_storage_minor_refactor/lib/DBIx/Class/Storage/DBI.pm
DBIx-Class/0.08/branches/mssql_storage_minor_refactor/t/74mssql.t
Log:
fix a bug in _determine_driver
Modified: DBIx-Class/0.08/branches/mssql_storage_minor_refactor/lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- DBIx-Class/0.08/branches/mssql_storage_minor_refactor/lib/DBIx/Class/Storage/DBI.pm 2009-07-31 10:52:42 UTC (rev 7159)
+++ DBIx-Class/0.08/branches/mssql_storage_minor_refactor/lib/DBIx/Class/Storage/DBI.pm 2009-07-31 13:52:41 UTC (rev 7160)
@@ -764,21 +764,23 @@
my ($self) = @_;
if (not $self->_driver_determined) {
- my $driver;
+ if (ref($self) eq __PACKAGE__) {
+ my $driver;
- if ($self->_dbh) { # we are connected
- $driver = $self->_dbh->{Driver}{Name};
- } else {
- # try to use dsn to not require being connected, the driver may still
- # force a connection in _rebless to determine version
- ($driver) = $self->_dbi_connect_info->[0] =~ /dbi:([^:]+):/i;
- }
+ if ($self->_dbh) { # we are connected
+ $driver = $self->_dbh->{Driver}{Name};
+ } else {
+ # try to use dsn to not require being connected, the driver may still
+ # force a connection in _rebless to determine version
+ ($driver) = $self->_dbi_connect_info->[0] =~ /dbi:([^:]+):/i;
+ }
- my $storage_class = "DBIx::Class::Storage::DBI::${driver}";
- if ($self->load_optional_class($storage_class)) {
- mro::set_mro($storage_class, 'c3');
- bless $self, $storage_class;
- $self->_rebless();
+ my $storage_class = "DBIx::Class::Storage::DBI::${driver}";
+ if ($self->load_optional_class($storage_class)) {
+ mro::set_mro($storage_class, 'c3');
+ bless $self, $storage_class;
+ $self->_rebless();
+ }
}
$self->_driver_determined(1);
Modified: DBIx-Class/0.08/branches/mssql_storage_minor_refactor/t/74mssql.t
===================================================================
--- DBIx-Class/0.08/branches/mssql_storage_minor_refactor/t/74mssql.t 2009-07-31 10:52:42 UTC (rev 7159)
+++ DBIx-Class/0.08/branches/mssql_storage_minor_refactor/t/74mssql.t 2009-07-31 13:52:41 UTC (rev 7160)
@@ -23,8 +23,8 @@
plan tests => $TESTS * 2;
my @storage_types = (
- 'DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server',
- 'DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server::NoBindVars',
+ 'DBI::Sybase::Microsoft_SQL_Server',
+ 'DBI::Sybase::Microsoft_SQL_Server::NoBindVars',
);
my $storage_idx = -1;
my $schema;
@@ -35,7 +35,7 @@
$schema = DBICTest::Schema->clone;
if ($storage_idx != 0) { # autodetect
- $schema->storage_type($storage_type);
+ $schema->storage_type("::$storage_type");
}
$schema->connection($dsn, $user, $pass);
@@ -48,7 +48,7 @@
next;
}
- isa_ok($schema->storage, $storage_type);
+ isa_ok($schema->storage, "DBIx::Class::Storage::$storage_type");
# start disconnected to test reconnection
$schema->storage->_dbh->disconnect;
More information about the Bast-commits
mailing list