move placeholder support detection into ::Sybase::Base
Rafael Kitover [Sat, 25 Jul 2009 14:10:30 +0000 (14:10 +0000)]
lib/DBIx/Class/Storage/DBI/Sybase/Base.pm
lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm

index be57610..b9c1de0 100644 (file)
@@ -27,6 +27,18 @@ sub _ping {
   return $@ ? 0 : 1;
 }
 
+sub _placeholders_supported {
+  my $self = shift;
+  my $dbh  = $self->_dbh;
+
+  return 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 where 1 = ?', {}, 1);
+  };
+}
+
 1;
 
 =head1 AUTHORS
index dfbe20b..5e53118 100644 (file)
@@ -13,14 +13,7 @@ sub _rebless {
   my $self = shift;
   my $dbh  = $self->_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->_placeholders_supported) {
     bless $self,
       'DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server::NoBindVars';
     $self->_rebless;