jump to ::DBI::Sybase::MSSQL if we are using MSSQL through Sybase
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / Sybase.pm
index 87acdde..84499ed 100644 (file)
@@ -5,6 +5,20 @@ use warnings;
 
 use base qw/DBIx::Class::Storage::DBI::NoBindVars/;
 
+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'; 
+        if ($self->load_optional_class($subclass) && !$self->isa($subclass)) {
+            bless $self, $subclass;
+            $self->_rebless;
+        }
+    }
+}
+
 1;
 
 =head1 NAME
@@ -21,6 +35,8 @@ L<DBIx::Class::Storage::DBI::Sybase::MSSQL>.
 
 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.