1 package DBIx::Class::Storage::DBI::Sybase;
8 use base qw/DBIx::Class::Storage::DBI/;
12 DBIx::Class::Storage::DBI::Sybase - Base class for drivers using
17 This is the base class/dispatcher for Storage's designed to work with
29 $dbtype = @{$self->_get_dbh->selectrow_arrayref(qq{sp_server_info \@attribute_id=1})}[2]
31 $self->throw_exception("Unable to estable connection to determine database type: $_")
38 $dbtype = 'ASE' if $dbtype eq 'SQL_Server';
40 my $subclass = __PACKAGE__ . "::$dbtype";
41 if ($self->load_optional_class($subclass)) {
42 bless $self, $subclass;
51 my $dbh = $self->_dbh or return 0;
53 local $dbh->{RaiseError} = 1;
54 local $dbh->{PrintError} = 0;
56 if ($dbh->{syb_no_child_con}) {
57 # if extra connections are not allowed, then ->ping is reliable
58 return try { $dbh->ping } catch { 0; };
62 # XXX if the main connection goes stale, does opening another for this statement
63 # really determine anything?
71 sub _set_max_connect {
73 my $val = shift || 256;
75 my $dsn = $self->_dbi_connect_info->[0];
77 return if ref($dsn) eq 'CODE';
79 if ($dsn !~ /maxConnect=/) {
80 $self->_dbi_connect_info->[0] = "$dsn;maxConnect=$val";
81 my $connected = defined $self->_dbh;
83 $self->ensure_connected if $connected;
89 Whether or not L<DBD::Sybase> was compiled against FreeTDS. If false, it means
90 the Sybase OpenClient libraries were used.
97 return $self->_get_dbh->{syb_oc_version} =~ /freetds/i;
102 When using FreeTDS and/or MSSQL, C<< $dbh->{LongReadLen} >> is not available,
103 use this function instead. It does:
105 $dbh->do("SET TEXTSIZE $bytes");
107 Takes the number of bytes, or uses the C<LongReadLen> value from your
108 L<connect_info|DBIx::Class::Storage::DBI/connect_info> if omitted, lastly falls
109 back to the C<32768> which is the L<DBD::Sybase> default.
118 try { $self->_dbi_connect_info->[-1]->{LongReadLen} }
120 32768; # the DBD::Sybase default
122 return unless defined $text_size;
124 $self->_dbh->do("SET TEXTSIZE $text_size");
131 See L<DBIx::Class/CONTRIBUTORS>.
135 You may distribute this code under the same terms as Perl itself.