fix connection setup for Sybase
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / Sybase / Microsoft_SQL_Server.pm
CommitLineData
98464041 1package DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server;
2
3use strict;
4use warnings;
2ad62d97 5
528accab 6use base qw/
d867eeda 7 DBIx::Class::Storage::DBI::Sybase::Common
5a77aa8b 8 DBIx::Class::Storage::DBI::MSSQL
528accab 9/;
2ad62d97 10use mro 'c3';
98464041 11
9b3dabe0 12sub _rebless {
13 my $self = shift;
9ae966b9 14 my $dbh = $self->_get_dbh;
7379eb67 15
e33b954c 16 if (not $self->_typeless_placeholders_supported) {
7379eb67 17 bless $self,
18 'DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server::NoBindVars';
19 $self->_rebless;
20 }
d867eeda 21}
4966150b 22
d867eeda 23sub _init {
24 my $self = shift;
4966150b 25
d867eeda 26 # LongReadLen doesn't work with MSSQL through DBD::Sybase, and the default is
27 # huge on some versions of SQL server and can cause memory problems, so we
28 # fix it up here (see Sybase/Common.pm)
29 $self->set_textsize;
37b17a93 30}
31
b90d7eba 32sub _dbh_begin_work {
33 my $self = shift;
34
35 $self->_get_dbh->do('BEGIN TRAN');
36}
37
38sub _dbh_commit {
39 my $self = shift;
6db5bdc6 40 my $dbh = $self->_dbh
41 or $self->throw_exception('cannot COMMIT on a disconnected handle');
42 $dbh->do('COMMIT');
b90d7eba 43}
44
45sub _dbh_rollback {
46 my $self = shift;
6db5bdc6 47 my $dbh = $self->_dbh
48 or $self->throw_exception('cannot ROLLBACK on a disconnected handle');
49 $dbh->do('ROLLBACK');
b90d7eba 50}
51
98464041 521;
53
54=head1 NAME
55
5a77aa8b 56DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server - Support for Microsoft
57SQL Server via DBD::Sybase
98464041 58
59=head1 SYNOPSIS
60
5608593e 61This subclass supports MSSQL server connections via L<DBD::Sybase>.
98464041 62
7379eb67 63=head1 DESCRIPTION
d4483998 64
7379eb67 65This driver tries to determine whether your version of L<DBD::Sybase> and
66supporting libraries (usually FreeTDS) support using placeholders, if not the
67storage will be reblessed to
68L<DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server::NoBindVars>.
98464041 69
7379eb67 70The MSSQL specific functionality is provided by
71L<DBIx::Class::Storage::DBI::MSSQL>.
7e8cecc1 72
5a77aa8b 73=head1 AUTHOR
98464041 74
b7505130 75See L<DBIx::Class/CONTRIBUTORS>.
98464041 76
77=head1 LICENSE
78
79You may distribute this code under the same terms as Perl itself.
80
81=cut