remove _get_mssql_version
[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
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 27sub _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 38sub _dbh_begin_work {
39 my $self = shift;
40
41 $self->_get_dbh->do('BEGIN TRAN');
42}
43
44sub _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
51sub _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
ff153e24 58sub _populate_server_info {
59 my $self = shift;
60
61 my $info = $self->next::method(@_);
62
63 my $product_version = $self->_get_dbh->selectrow_hashref('xp_msver ProductVersion');
64
65 if ((my $version = $data->{Character_Value}) =~ /^(\d+)\./) {
66 $info->{dbms_ver} = $version;
67 } else {
68 $self->throw_exception(q{
69MSSQL Version Retrieval Failed, Your ProductVersion's Character_Value is missing
70or malformed!
71 });
72 }
73
74 return $info;
75}
76
98464041 771;
78
79=head1 NAME
80
5a77aa8b 81DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server - Support for Microsoft
82SQL Server via DBD::Sybase
98464041 83
84=head1 SYNOPSIS
85
5608593e 86This subclass supports MSSQL server connections via L<DBD::Sybase>.
98464041 87
7379eb67 88=head1 DESCRIPTION
d4483998 89
7379eb67 90This driver tries to determine whether your version of L<DBD::Sybase> and
91supporting libraries (usually FreeTDS) support using placeholders, if not the
92storage will be reblessed to
93L<DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server::NoBindVars>.
98464041 94
7379eb67 95The MSSQL specific functionality is provided by
96L<DBIx::Class::Storage::DBI::MSSQL>.
7e8cecc1 97
5a77aa8b 98=head1 AUTHOR
98464041 99
b7505130 100See L<DBIx::Class/CONTRIBUTORS>.
98464041 101
102=head1 LICENSE
103
104You may distribute this code under the same terms as Perl itself.
105
106=cut