sub _determine_connector_driver {
my ($self, $conn) = @_;
- my $dbtype = $self->_dbh_get_info('SQL_DBMS_NAME');
+ my $dbtype = $self->_get_rdbms_name;
if (not $dbtype) {
$self->_warn_undetermined_driver(
}
}
+sub _get_rdbms_name { shift->_dbh_get_info('SQL_DBMS_NAME') }
+
sub _warn_undetermined_driver {
my ($self, $msg) = @_;
=cut
-sub _rebless {
+sub _rebless { shift->_determine_connector_driver('Sybase') }
+
+sub _get_rdbms_name {
my $self = shift;
- my $dbtype;
try {
- $dbtype = @{$self->_get_dbh->selectrow_arrayref(qq{sp_server_info \@attribute_id=1})}[2]
- } catch {
- $self->throw_exception("Unable to establish connection to determine database type: $_")
- };
-
- if ($dbtype) {
- $dbtype =~ s/\W/_/gi;
+ my $name = $self->_get_dbh->selectrow_arrayref('sp_server_info @attribute_id=1')->[2];
- # saner class name
- $dbtype = 'ASE' if $dbtype eq 'SQL_Server';
+ if ($name) {
+ $name =~ s/\W/_/gi;
- my $subclass = __PACKAGE__ . "::$dbtype";
- if ($self->load_optional_class($subclass)) {
- bless $self, $subclass;
- $self->_rebless;
+ # saner class name
+ $name = 'ASE' if $name eq 'SQL_Server';
}
- }
+
+ $name; # RV
+ } catch {
+ $self->throw_exception("Unable to establish connection to determine database type: $_")
+ };
}
sub _init {
'DBI::Sybase::ASE',
'DBI::Sybase::ASE::NoBindVars',
);
-eval "require DBIx::Class::Storage::$_;" or die $@
- for @storage_types;
my $schema;
-my $storage_idx = -1;
my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_SYBASE_${_}" } qw/DSN USER PASS/};
my $ping_count = 0;
{
+ require DBIx::Class::Storage::DBI::Sybase::ASE;
my $ping = DBIx::Class::Storage::DBI::Sybase::ASE->can('_ping');
*DBIx::Class::Storage::DBI::Sybase::ASE::_ping = sub {
$ping_count++;
}
for my $storage_type (@storage_types) {
- $storage_idx++;
unless ($storage_type eq 'DBI::Sybase::ASE') { # autodetect
DBICTest::Schema->storage_type("::$storage_type");
$schema->storage->ensure_connected;
- if ($storage_idx == 0 &&
- $schema->storage->isa('DBIx::Class::Storage::DBI::Sybase::ASE::NoBindVars')) {
- # no placeholders in this version of Sybase or DBD::Sybase (or using FreeTDS)
- skip "Skipping entire test for $storage_type - no placeholder support", 1;
- next;
- }
+ # we are going to explicitly test this anyway, just loop through
+ next if
+ $storage_type ne 'DBI::Sybase::ASE::NoBindVars'
+ and
+ $schema->storage->isa('DBIx::Class::Storage::DBI::Sybase::ASE::NoBindVars')
+ ;
isa_ok( $schema->storage, "DBIx::Class::Storage::$storage_type" );