X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI%2FSybase%2FBase.pm;h=757d4d9a686279974d24d72cf3e03b31e06d4d4a;hb=adc4a3dae45ebe6946baa50c8cbe5a1b90e1e86b;hp=a26ed23decc042b6f54ae8e0113939c501ee59b2;hpb=eabab5d0d07817310c72a6851d01283a62c9f4de;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Storage/DBI/Sybase/Base.pm b/lib/DBIx/Class/Storage/DBI/Sybase/Base.pm index a26ed23..757d4d9 100644 --- a/lib/DBIx/Class/Storage/DBI/Sybase/Base.pm +++ b/lib/DBIx/Class/Storage/DBI/Sybase/Base.pm @@ -1,44 +1,46 @@ -package DBIx::Class::Storage::DBI::Sybase::Base; +package # hide from PAUSE + DBIx::Class::Storage::DBI::Sybase::Base; use strict; use warnings; +use base qw/DBIx::Class::Storage::DBI/; +use mro 'c3'; + =head1 NAME DBIx::Class::Storage::DBI::Sybase::Base - Common functionality for drivers using -L - -=head1 METHODS - -=head2 connected - -Returns true if we have an open (and working) database connection, false if it -is not (yet) open (or does not work). (Executes a simple SELECT to make sure it -works.) - -The reason this is needed is that L's ping() does not work with an -active statement handle, leading to masked database errors. +DBD::Sybase =cut -sub connected { +sub _ping { my $self = shift; - my $dbh = $self->_dbh; + my $dbh = $self->_dbh or return 0; local $dbh->{RaiseError} = 1; - - my $ping_sth; - eval { - my $ping_sth = $dbh->prepare_cached("select 1"); - $ping_sth->execute; - $ping_sth->finish; + $dbh->do('select 1'); }; return $@ ? 0 : 1; } +sub _placeholders_supported { + my $self = shift; + my $dbh = $self->_get_dbh; + + return eval { +# There's also $dbh->{syb_dynamic_supported} but it can be inaccurate for this +# purpose. + local $dbh->{PrintError} = 0; + local $dbh->{RaiseError} = 1; +# this specifically tests a bind that is NOT a string + $dbh->selectrow_array('select 1 where 1 = ?', {}, 1); + }; +} + 1; =head1 AUTHORS