1 package DBIx::Class::Storage::DBI::Sybase::FreeTDS;
5 use base qw/DBIx::Class::Storage::DBI::Sybase/;
12 DBIx::Class::Storage::DBI::Sybase::FreeTDS - Base class for drivers using
13 DBD::Sybase over FreeTDS.
17 This is the base class for Storages designed to work with L<DBD::Sybase> over
20 It is a subclass of L<DBIx::Class::Storage::DBI::Sybase>.
26 # The subclass storage driver defines _set_autocommit_stmt
27 # for MsSQL it is SET IMPLICIT_TRANSACTIONS ON/OFF
28 # for proper Sybase it's SET CHAINED ON/OFF
32 if ($self->_dbh_autocommit) {
33 $self->_dbh->do($self->_set_autocommit_stmt(1));
35 $self->_dbh->do($self->_set_autocommit_stmt(0));
39 # Handle AutoCommit and SET TEXTSIZE because LongReadLen doesn't work.
41 sub _run_connection_actions {
44 # based on LongReadLen in connect_info
47 $self->_set_autocommit;
49 $self->next::method(@_);
54 When using DBD::Sybase with FreeTDS, C<< $dbh->{LongReadLen} >> is not available,
55 use this function instead. It does:
57 $dbh->do("SET TEXTSIZE $bytes");
59 Takes the number of bytes, or uses the C<LongReadLen> value from your
60 L<connect_info|DBIx::Class::Storage::DBI/connect_info> if omitted, lastly falls
61 back to the C<32768> which is the L<DBD::Sybase> default.
70 try { $self->_dbic_cinnect_attributes->{LongReadLen} }
72 32768; # the DBD::Sybase default
74 $self->_dbh->do("SET TEXTSIZE $text_size");
80 if ($self->{_in_do_block}) {
81 $self->_dbh->do('BEGIN TRAN');
84 $self->dbh_do(sub { $_[1]->do('BEGIN TRAN') });
88 sub _exec_txn_commit {
92 or $self->throw_exception('cannot COMMIT on a disconnected handle');
97 sub _exec_txn_rollback {
100 my $dbh = $self->_dbh
101 or $self->throw_exception('cannot ROLLBACK on a disconnected handle');
103 $dbh->do('ROLLBACK');
110 See L<DBIx::Class/CONTRIBUTORS>.
114 You may distribute this code under the same terms as Perl itself.