1 package DBIx::Class::Storage::DBI::Sybase;
6 use base qw/DBIx::Class::Storage::DBI/;
10 DBIx::Class::Storage::DBI::Sybase - Base class for drivers using
15 This is the base class/dispatcher for Storage's designed to work with
26 @{$self->_get_dbh->selectrow_arrayref(qq{sp_server_info \@attribute_id=1})}[2]
29 $self->throw_exception("Unable to estable connection to determine database type: $@")
36 $dbtype = 'ASE' if $dbtype eq 'SQL_Server';
38 my $subclass = __PACKAGE__ . "::$dbtype";
39 if ($self->load_optional_class($subclass)) {
40 bless $self, $subclass;
49 my $dbh = $self->_dbh or return 0;
51 local $dbh->{RaiseError} = 1;
52 local $dbh->{PrintError} = 0;
54 if ($dbh->{syb_no_child_con}) {
55 # if extra connections are not allowed, then ->ping is reliable
56 my $ping = eval { $dbh->ping };
57 return $@ ? 0 : $ping;
61 # XXX if the main connection goes stale, does opening another for this statement
62 # really determine anything?
69 sub _set_max_connect {
71 my $val = shift || 256;
73 my $dsn = $self->_dbi_connect_info->[0];
75 return if ref($dsn) eq 'CODE';
77 if ($dsn !~ /maxConnect=/) {
78 $self->_dbi_connect_info->[0] = "$dsn;maxConnect=$val";
79 my $connected = defined $self->_dbh;
81 $self->ensure_connected if $connected;
87 Whether or not L<DBD::Sybase> was compiled against FreeTDS. If false, it means
88 the Sybase OpenClient libraries were used.
95 return $self->_get_dbh->{syb_oc_version} =~ /freetds/i;
100 When using FreeTDS and/or MSSQL, C<< $dbh->{LongReadLen} >> is not available,
101 use this function instead. It does:
103 $dbh->do("SET TEXTSIZE $bytes");
105 Takes the number of bytes, or uses the C<LongReadLen> value from your
106 L<DBIx::Class/connect_info> if omitted, lastly falls back to the C<32768> which
107 is the L<DBD::Sybase> default.
113 my $text_size = shift ||
114 eval { $self->_dbi_connect_info->[-1]->{LongReadLen} } ||
115 32768; # the DBD::Sybase default
117 return unless defined $text_size;
119 $self->_dbh->do("SET TEXTSIZE $text_size");
126 See L<DBIx::Class/CONTRIBUTORS>.
130 You may distribute this code under the same terms as Perl itself.