Merge 'trunk' into 'sybase'
[dbsrgits/DBIx-Class-Historic.git] / lib / DBIx / Class / Storage / DBI / Sybase / Microsoft_SQL_Server.pm
index dfbe20b..3d83020 100644 (file)
@@ -4,35 +4,29 @@ use strict;
 use warnings;
 
 use base qw/
-  DBIx::Class::Storage::DBI::Sybase::Base
+  DBIx::Class::Storage::DBI::Sybase::Common
   DBIx::Class::Storage::DBI::MSSQL
 /;
 use mro 'c3';
 
 sub _rebless {
   my $self = shift;
-  my $dbh  = $self->_dbh;
+  my $dbh  = $self->_get_dbh;
 
-  my ($placeholders_supported) = eval {
-# There's also $dbh->{syb_dynamic_supported} but it can be inaccurate for this
-# purpose.
-    local $dbh->{PrintError} = 0;
-    $dbh->selectrow_array('select ?', {}, 1);
-  };
-
-  if (not $placeholders_supported) {
+  if (not $self->_typeless_placeholders_supported) {
     bless $self,
       'DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server::NoBindVars';
     $self->_rebless;
   }
+}
 
-# LongReadLen doesn't work with MSSQL through DBD::Sybase, and the default is
-# huge on some versions of SQL server and can cause memory problems, so we
-# fix it up here.
-  my $text_size = eval { $self->_dbi_connect_info->[-1]->{LongReadLen} } ||
-    32768; # the DBD::Sybase default
+sub _init {
+  my $self = shift;
 
-  $dbh->do("set textsize $text_size");
+  # LongReadLen doesn't work with MSSQL through DBD::Sybase, and the default is
+  # huge on some versions of SQL server and can cause memory problems, so we
+  # fix it up here (see Sybase/Common.pm)
+  $self->set_textsize;
 }
 
 1;