1 package DBIx::Class::Storage::DBI::Sybase;
7 use base qw/DBIx::Class::Storage::DBI/;
11 DBIx::Class::Storage::DBI::Sybase - Base class for drivers using
16 This is the base class/dispatcher for Storage's designed to work with
28 $dbtype = @{$self->_get_dbh->selectrow_arrayref(qq{sp_server_info \@attribute_id=1})}[2]
30 $self->throw_exception("Unable to estable connection to determine database type: $_")
37 $dbtype = 'ASE' if $dbtype eq 'SQL_Server';
39 my $subclass = __PACKAGE__ . "::$dbtype";
40 if ($self->load_optional_class($subclass)) {
41 bless $self, $subclass;
50 my $dbh = $self->_dbh or return 0;
52 local $dbh->{RaiseError} = 1;
53 local $dbh->{PrintError} = 0;
55 if ($dbh->{syb_no_child_con}) {
56 # if extra connections are not allowed, then ->ping is reliable
57 return try { $dbh->ping } catch { 0; };
61 # XXX if the main connection goes stale, does opening another for this statement
62 # really determine anything?
70 sub _set_max_connect {
72 my $val = shift || 256;
74 my $dsn = $self->_dbi_connect_info->[0];
76 return if ref($dsn) eq 'CODE';
78 if ($dsn !~ /maxConnect=/) {
79 $self->_dbi_connect_info->[0] = "$dsn;maxConnect=$val";
80 my $connected = defined $self->_dbh;
82 $self->ensure_connected if $connected;
88 Whether or not L<DBD::Sybase> was compiled against FreeTDS. If false, it means
89 the Sybase OpenClient libraries were used.
96 return $self->_get_dbh->{syb_oc_version} =~ /freetds/i;
101 When using FreeTDS and/or MSSQL, C<< $dbh->{LongReadLen} >> is not available,
102 use this function instead. It does:
104 $dbh->do("SET TEXTSIZE $bytes");
106 Takes the number of bytes, or uses the C<LongReadLen> value from your
107 L<connect_info|DBIx::Class::Storage::DBI/connect_info> if omitted, lastly falls
108 back to the C<32768> which is the L<DBD::Sybase> default.
117 try { $self->_dbi_connect_info->[-1]->{LongReadLen} }
119 32768; # the DBD::Sybase default
121 return unless defined $text_size;
123 $self->_dbh->do("SET TEXTSIZE $text_size");
130 See L<DBIx::Class/CONTRIBUTORS>.
134 You may distribute this code under the same terms as Perl itself.