Refactor the version handling
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / Sybase / Microsoft_SQL_Server.pm
index 9666a00..49cd9e6 100644 (file)
@@ -13,7 +13,11 @@ sub _rebless {
   my $self = shift;
   my $dbh  = $self->_get_dbh;
 
+  return if ref $self ne __PACKAGE__;
+
   if (not $self->_typeless_placeholders_supported) {
+    require
+      DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server::NoBindVars;
     bless $self,
       'DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server::NoBindVars';
     $self->_rebless;
@@ -51,6 +55,21 @@ sub _dbh_rollback {
   $dbh->do('ROLLBACK');
 }
 
+sub _get_server_version {
+  my $self = shift;
+
+  my $product_version = $self->_get_dbh->selectrow_hashref('xp_msver ProductVersion');
+
+  if ((my $version = $data->{Character_Value}) =~ /^(\d+)\./) {
+    return $version;
+  }
+  else {
+    $self->throw_exception(
+      "MSSQL Version Retrieval Failed, Your ProductVersion's Character_Value is missing or malformed!"
+    });
+  }
+}
+
 1;
 
 =head1 NAME