From: Rafael Kitover Date: Sat, 25 Jul 2009 14:10:30 +0000 (+0000) Subject: move placeholder support detection into ::Sybase::Base X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7624b54e3e9e5b3bdfd43a3808116076e8a2ef3d;p=dbsrgits%2FDBIx-Class-Historic.git move placeholder support detection into ::Sybase::Base --- diff --git a/lib/DBIx/Class/Storage/DBI/Sybase/Base.pm b/lib/DBIx/Class/Storage/DBI/Sybase/Base.pm index be57610..b9c1de0 100644 --- a/lib/DBIx/Class/Storage/DBI/Sybase/Base.pm +++ b/lib/DBIx/Class/Storage/DBI/Sybase/Base.pm @@ -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 diff --git a/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm b/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm index dfbe20b..5e53118 100644 --- a/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm +++ b/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm @@ -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;