X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI%2FSybase%2FCommon.pm;h=af4c916f7564e58b1d82062ea2599067f14ad098;hb=c453ddd91b5998c3820c20a761547d97523a3048;hp=c183a9fed342f38ace6d212b633a50788a1bc878;hpb=2f92e90b778a1e3e37c5f5231ed02ab8ede78970;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/Storage/DBI/Sybase/Common.pm b/lib/DBIx/Class/Storage/DBI/Sybase/Common.pm index c183a9f..af4c916 100644 --- a/lib/DBIx/Class/Storage/DBI/Sybase/Common.pm +++ b/lib/DBIx/Class/Storage/DBI/Sybase/Common.pm @@ -28,7 +28,17 @@ sub _ping { my $dbh = $self->_dbh or return 0; local $dbh->{RaiseError} = 1; + local $dbh->{PrintError} = 0; + + if ($dbh->{syb_no_child_con}) { +# ping is impossible with an active statement, we return false if so + my $ping = eval { $dbh->ping }; + return $@ ? 0 : $ping; + } + eval { +# XXX if the main connection goes stale, does opening another for this statement +# really determine anything? $dbh->do('select 1'); }; @@ -61,7 +71,7 @@ the Sybase OpenClient libraries were used. sub using_freetds { my $self = shift; - return $self->_dbh->{syb_oc_version} =~ /freetds/i; + return $self->_get_dbh->{syb_oc_version} =~ /freetds/i; } =head2 set_textsize @@ -72,14 +82,16 @@ use this function instead. It does: $dbh->do("SET TEXTSIZE $bytes"); Takes the number of bytes, or uses the C value from your -L if omitted. +L if omitted, lastly falls back to the C<32768> which +is the L default. =cut sub set_textsize { my $self = shift; my $text_size = shift || - eval { $self->_dbi_connect_info->[-1]->{LongReadLen} }; + eval { $self->_dbi_connect_info->[-1]->{LongReadLen} } || + 32768; # the DBD::Sybase default return unless defined $text_size;