1 package DBIx::Class::Storage::DBI::Sybase::Common;
6 use base qw/DBIx::Class::Storage::DBI/;
11 DBIx::Class::Storage::DBI::Sybase::Common - Common functionality for drivers using
16 This is the base class for L<DBIx::Class::Storage::DBI::Sybase> and
17 L<DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server>. It provides some
18 utility methods related to L<DBD::Sybase> and the supported functions of the
19 database you are connecting to.
28 my $dbh = $self->_dbh or return 0;
30 local $dbh->{RaiseError} = 1;
31 local $dbh->{PrintError} = 0;
33 if ($dbh->{syb_no_child_con}) {
34 # ping is impossible with an active statement, we return false if so
35 my $ping = eval { $dbh->ping };
36 return $@ ? 0 : $ping;
40 # XXX if the main connection goes stale, does opening another for this statement
41 # really determine anything?
48 sub _set_max_connect {
50 my $val = shift || 256;
52 my $dsn = $self->_dbi_connect_info->[0];
54 return if ref($dsn) eq 'CODE';
56 if ($dsn !~ /maxConnect=/) {
57 $self->_dbi_connect_info->[0] = "$dsn;maxConnect=$val";
58 my $connected = defined $self->_dbh;
60 $self->ensure_connected if $connected;
66 Whether or not L<DBD::Sybase> was compiled against FreeTDS. If false, it means
67 the Sybase OpenClient libraries were used.
74 return $self->_dbh->{syb_oc_version} =~ /freetds/i;
79 When using FreeTDS and/or MSSQL, C<< $dbh->{LongReadLen} >> is not available,
80 use this function instead. It does:
82 $dbh->do("SET TEXTSIZE $bytes");
84 Takes the number of bytes, or uses the C<LongReadLen> value from your
85 L<DBIx::Class/connect_info> if omitted, lastly falls back to the C<32768> which
86 is the L<DBD::Sybase> default.
92 my $text_size = shift ||
93 eval { $self->_dbi_connect_info->[-1]->{LongReadLen} } ||
94 32768; # the DBD::Sybase default
96 return unless defined $text_size;
98 $self->_dbh->do("SET TEXTSIZE $text_size");
105 See L<DBIx::Class/CONTRIBUTORS>.
109 You may distribute this code under the same terms as Perl itself.