sub _rebless {
my $self = shift;
- my $dbh = $self->schema->storage->dbh;
- my $DBMS_VERSION = @{$dbh->selectrow_arrayref(qq{sp_server_info \@attribute_id=1})}[2];
- if ($DBMS_VERSION =~ /^Microsoft /i) {
- my $subclass = 'DBIx::Class::Storage::DBI::Sybase::MSSQL';
+ my $dbtype = eval { @{$self->_dbh->selectrow_arrayref(qq{sp_server_info \@attribute_id=1})}[2] };
+ unless ( $@ ) {
+ $dbtype =~ s/\W/_/gi;
+ my $subclass = "DBIx::Class::Storage::DBI::Sybase::${dbtype}";
if ($self->load_optional_class($subclass) && !$self->isa($subclass)) {
bless $self, $subclass;
$self->_rebless;
--- /dev/null
+package DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server;
+
+use strict;
+use warnings;
+
+use base qw/DBIx::Class::Storage::DBI::ODBC::Microsoft_SQL_Server DBIx::Class::Storage::DBI::Sybase/;
+
+1;
+
+=head1 NAME
+
+DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server - Storage::DBI subclass for MSSQL via
+DBD::Sybase
+
+=head1 SYNOPSIS
+
+This subclass supports MSSQL connected via L<DBD::Sybase>.
+
+ $schema->storage_type('::DBI::Sybase::Microsoft_SQL_Server');
+ $schema->connect_info('dbi:Sybase:....', ...);
+
+=head1 BUGS
+
+Currently, this doesn't work right unless you call C<Class::C3::reinitialize()>
+after connecting.
+
+=head1 AUTHORS
+
+Brandon L Black <blblack@gmail.com>
+
+Justin Hunter <justin.d.hunter@gmail.com>
+
+=head1 LICENSE
+
+You may distribute this code under the same terms as Perl itself.
+
+=cut
my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MSSQL_${_}" } qw/DSN USER PASS/};
-#warn "$dsn $user $pass";
-
plan skip_all => 'Set $ENV{DBICTEST_MSSQL_DSN}, _USER and _PASS to run this test'
unless ($dsn);
plan tests => 6;
-
my $schema = DBICTest::Schema->clone;
$schema->connection($dsn, $user, $pass);
my $dbh = $schema->storage->dbh;
-isa_ok($schema->storage, 'DBIx::Class::Storage::DBI::Sybase::MSSQL');
+isa_ok($schema->storage, 'DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server');
$dbh->do("IF OBJECT_ID('artist', 'U') IS NOT NULL
DROP TABLE artist");