my ($self) = @_;
if (not $self->_driver_determined) {
- 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 (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;
+ }
- 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);
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;
$schema = DBICTest::Schema->clone;
if ($storage_idx != 0) { # autodetect
- $schema->storage_type($storage_type);
+ $schema->storage_type("::$storage_type");
}
$schema->connection($dsn, $user, $pass);
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;