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
58 try { $alive = $dbh->ping } catch { $alive = 0 };
64 # XXX if the main connection goes stale, does opening another for this statement
65 # really determine anything?
74 sub _set_max_connect {
76 my $val = shift || 256;
78 my $dsn = $self->_dbi_connect_info->[0];
80 return if ref($dsn) eq 'CODE';
82 if ($dsn !~ /maxConnect=/) {
83 $self->_dbi_connect_info->[0] = "$dsn;maxConnect=$val";
84 my $connected = defined $self->_dbh;
86 $self->ensure_connected if $connected;
92 Whether or not L<DBD::Sybase> was compiled against FreeTDS. If false, it means
93 the Sybase OpenClient libraries were used.
100 return $self->_get_dbh->{syb_oc_version} =~ /freetds/i;
105 When using FreeTDS and/or MSSQL, C<< $dbh->{LongReadLen} >> is not available,
106 use this function instead. It does:
108 $dbh->do("SET TEXTSIZE $bytes");
110 Takes the number of bytes, or uses the C<LongReadLen> value from your
111 L<connect_info|DBIx::Class::Storage::DBI/connect_info> if omitted, lastly falls
112 back to the C<32768> which is the L<DBD::Sybase> default.
121 try { $self->_dbi_connect_info->[-1]->{LongReadLen} }
123 32768; # the DBD::Sybase default
125 return unless defined $text_size;
127 $self->_dbh->do("SET TEXTSIZE $text_size");
134 See L<DBIx::Class/CONTRIBUTORS>.
138 You may distribute this code under the same terms as Perl itself.