This file is indexed.

/usr/share/perl5/DBIx/Class/Storage/DBI/Sybase/FreeTDS.pm is in libdbix-class-perl 0.08196-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
package DBIx::Class::Storage::DBI::Sybase::FreeTDS;

use strict;
use warnings;
use base qw/DBIx::Class::Storage::DBI::Sybase/;
use mro 'c3';
use Try::Tiny;
use namespace::clean;

=head1 NAME

DBIx::Class::Storage::DBI::Sybase::FreeTDS - Base class for drivers using
DBD::Sybase over FreeTDS.

=head1 DESCRIPTION

This is the base class for Storages designed to work with L<DBD::Sybase> over
FreeTDS.

It is a subclass of L<DBIx::Class::Storage::DBI::Sybase>.

=head1 METHODS

=cut

# The subclass storage driver defines _set_autocommit_stmt
# for MsSQL it is SET IMPLICIT_TRANSACTIONS ON/OFF
# for proper Sybase it's SET CHAINED ON/OFF
sub _set_autocommit {
  my $self = shift;

  if ($self->_dbh_autocommit) {
    $self->_dbh->do($self->_set_autocommit_stmt(1));
  } else {
    $self->_dbh->do($self->_set_autocommit_stmt(0));
  }
}

# Handle AutoCommit and SET TEXTSIZE because LongReadLen doesn't work.
#
sub _run_connection_actions {
  my $self = shift;

  # based on LongReadLen in connect_info
  $self->set_textsize;

  $self->_set_autocommit;

  $self->next::method(@_);
}

=head2 set_textsize

When using DBD::Sybase with FreeTDS, C<< $dbh->{LongReadLen} >> is not available,
use this function instead. It does:

  $dbh->do("SET TEXTSIZE $bytes");

Takes the number of bytes, or uses the C<LongReadLen> value from your
L<connect_info|DBIx::Class::Storage::DBI/connect_info> if omitted, lastly falls
back to the C<32768> which is the L<DBD::Sybase> default.

=cut

sub set_textsize {
  my $self = shift;
  my $text_size =
    shift
      ||
    try { $self->_dbic_cinnect_attributes->{LongReadLen} }
      ||
    32768; # the DBD::Sybase default

  $self->_dbh->do("SET TEXTSIZE $text_size");
}

sub _exec_txn_begin {
  my $self = shift;

  if ($self->{_in_do_block}) {
    $self->_dbh->do('BEGIN TRAN');
  }
  else {
    $self->dbh_do(sub { $_[1]->do('BEGIN TRAN') });
  }
}

sub _exec_txn_commit {
  my $self = shift;

  my $dbh = $self->_dbh
    or $self->throw_exception('cannot COMMIT on a disconnected handle');

  $dbh->do('COMMIT');
}

sub _exec_txn_rollback {
  my $self = shift;

  my $dbh  = $self->_dbh
    or $self->throw_exception('cannot ROLLBACK on a disconnected handle');

  $dbh->do('ROLLBACK');
}

1;

=head1 AUTHORS

See L<DBIx::Class/CONTRIBUTORS>.

=head1 LICENSE

You may distribute this code under the same terms as Perl itself.

=cut