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;
34 if ($dbh->{syb_no_child_con}) {
35 # ping is impossible with an active statement, we return false if so
36 my $ping = eval { $dbh->ping };
37 return $@ ? 0 : $ping;
41 # XXX if the main connection goes stale, does opening another for this statement
42 # really determine anything?
49 sub _set_max_connect {
51 my $val = shift || 256;
53 my $dsn = $self->_dbi_connect_info->[0];
55 return if ref($dsn) eq 'CODE';
57 if ($dsn !~ /maxConnect=/) {
58 $self->_dbi_connect_info->[0] = "$dsn;maxConnect=$val";
59 my $connected = defined $self->_dbh;
61 $self->ensure_connected if $connected;
67 Whether or not L<DBD::Sybase> was compiled against FreeTDS. If false, it means
68 the Sybase OpenClient libraries were used.
75 return $self->_dbh->{syb_oc_version} =~ /freetds/i;
80 When using FreeTDS and/or MSSQL, C<< $dbh->{LongReadLen} >> is not available,
81 use this function instead. It does:
83 $dbh->do("SET TEXTSIZE $bytes");
85 Takes the number of bytes, or uses the C<LongReadLen> value from your
86 L<DBIx::Class/connect_info> if omitted, lastly falls back to the C<32768> which
87 is the L<DBD::Sybase> default.
93 my $text_size = shift ||
94 eval { $self->_dbi_connect_info->[-1]->{LongReadLen} } ||
95 32768; # the DBD::Sybase default
97 return unless defined $text_size;
99 $self->_dbh->do("SET TEXTSIZE $text_size");
106 See L<DBIx::Class/CONTRIBUTORS>.
110 You may distribute this code under the same terms as Perl itself.