refactor part 2
[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/
95787afe 7 DBIx::Class::Storage::DBI::Sybase
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
f244a815 23sub _run_connection_actions {
d867eeda 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
95787afe 28 # fix it up here (see ::DBI::Sybase.pm)
d867eeda 29 $self->set_textsize;
f244a815 30
31 $self->next::method(@_);
37b17a93 32}
33
b90d7eba 34sub _dbh_begin_work {
35 my $self = shift;
36
37 $self->_get_dbh->do('BEGIN TRAN');
38}
39
40sub _dbh_commit {
41 my $self = shift;
6db5bdc6 42 my $dbh = $self->_dbh
43 or $self->throw_exception('cannot COMMIT on a disconnected handle');
44 $dbh->do('COMMIT');
b90d7eba 45}
46
47sub _dbh_rollback {
48 my $self = shift;
6db5bdc6 49 my $dbh = $self->_dbh
50 or $self->throw_exception('cannot ROLLBACK on a disconnected handle');
51 $dbh->do('ROLLBACK');
b90d7eba 52}
53
98464041 541;
55
56=head1 NAME
57
5a77aa8b 58DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server - Support for Microsoft
59SQL Server via DBD::Sybase
98464041 60
61=head1 SYNOPSIS
62
5608593e 63This subclass supports MSSQL server connections via L<DBD::Sybase>.
98464041 64
7379eb67 65=head1 DESCRIPTION
d4483998 66
7379eb67 67This driver tries to determine whether your version of L<DBD::Sybase> and
68supporting libraries (usually FreeTDS) support using placeholders, if not the
69storage will be reblessed to
70L<DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server::NoBindVars>.
98464041 71
7379eb67 72The MSSQL specific functionality is provided by
73L<DBIx::Class::Storage::DBI::MSSQL>.
7e8cecc1 74
5a77aa8b 75=head1 AUTHOR
98464041 76
b7505130 77See L<DBIx::Class/CONTRIBUTORS>.
98464041 78
79=head1 LICENSE
80
81You may distribute this code under the same terms as Perl itself.
82
83=cut