1 package DBIx::Class::Storage::DBI::Sybase::Base;
6 use base qw/DBIx::Class::Storage::DBI/;
11 DBIx::Class::Storage::DBI::Sybase::Base - 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;
38 =head2 placeholders_supported
40 Whether or not string placeholders work. Does not check for implicit conversion
41 errors, see L</placeholders_with_type_conversion_supported>.
45 sub placeholders_supported {
47 my $dbh = $self->_dbh;
50 # There's also $dbh->{syb_dynamic_supported} but it can be inaccurate for this
52 local $dbh->{PrintError} = 0;
53 local $dbh->{RaiseError} = 1;
54 $dbh->selectrow_array('select ?', {}, 1);
58 =head2 placeholders_with_type_conversion_supported
62 sub placeholders_with_type_conversion_supported {
64 my $dbh = $self->_dbh;
67 local $dbh->{PrintError} = 0;
68 local $dbh->{RaiseError} = 1;
69 # this specifically tests a bind that is NOT a string
70 $dbh->selectrow_array('select 1 where 1 = ?', {}, 1);
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->_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<DBIx::Class/connect_info> if omitted.
117 my $text_size = shift ||
118 eval { $self->_dbi_connect_info->[-1]->{LongReadLen} };
120 return unless defined $text_size;
122 $self->_dbh->do("SET TEXTSIZE $text_size");
129 See L<DBIx::Class/CONTRIBUTORS>.
133 You may distribute this code under the same terms as Perl itself.