use strict;
use warnings;
use Try::Tiny;
+use namespace::clean;
use base qw/DBIx::Class::Storage::DBI/;
if ($dbh->{syb_no_child_con}) {
# if extra connections are not allowed, then ->ping is reliable
- my $ping = eval { $dbh->ping };
- return $@ ? 0 : $ping;
+ return try { $dbh->ping } catch { 0; };
}
- my $rc = 1;
- try {
+ return try {
# XXX if the main connection goes stale, does opening another for this statement
# really determine anything?
$dbh->do('select 1');
+ 1;
} catch {
- $rc = 0;
+ 0;
};
-
- return $rc;
}
sub _set_max_connect {
sub set_textsize {
my $self = shift;
- my $text_size = shift ||
- eval { $self->_dbi_connect_info->[-1]->{LongReadLen} } ||
+ my $text_size =
+ shift
+ ||
+ try { $self->_dbi_connect_info->[-1]->{LongReadLen} }
+ ||
32768; # the DBD::Sybase default
return unless defined $text_size;