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