Merge 'trunk' into 'sybase'
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / Sybase / Microsoft_SQL_Server.pm
1 package DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server;
2
3 use strict;
4 use warnings;
5
6 use base qw/
7   DBIx::Class::Storage::DBI::Sybase::Base
8   DBIx::Class::Storage::DBI::MSSQL
9   DBIx::Class::Storage::DBI::NoBindVars
10 /;
11 use mro 'c3';
12
13 sub _rebless {
14   my $self = shift;
15   my $dbh  = $self->_dbh;
16
17   if (not $self->_placeholders_supported) {
18     bless $self,
19       'DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server::NoBindVars';
20     $self->_rebless;
21   }
22
23 # LongReadLen doesn't work with MSSQL through DBD::Sybase, and the default is
24 # huge on some versions of SQL server and can cause memory problems, so we
25 # fix it up here.
26   my $text_size = eval { $self->_dbi_connect_info->[-1]->{LongReadLen} } ||
27     32768; # the DBD::Sybase default
28
29   $dbh->do("set textsize $text_size");
30 }
31
32 1;
33
34 =head1 NAME
35
36 DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server - Support for Microsoft
37 SQL Server via DBD::Sybase
38
39 =head1 SYNOPSIS
40
41 This subclass supports MSSQL server connections via L<DBD::Sybase>.
42
43 =head1 DESCRIPTION
44
45 This driver tries to determine whether your version of L<DBD::Sybase> and
46 supporting libraries (usually FreeTDS) support using placeholders, if not the
47 storage will be reblessed to
48 L<DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server::NoBindVars>.
49
50 The MSSQL specific functionality is provided by
51 L<DBIx::Class::Storage::DBI::MSSQL>.
52
53 =head1 AUTHOR
54
55 See L<DBIx::Class/CONTRIBUTORS>.
56
57 =head1 LICENSE
58
59 You may distribute this code under the same terms as Perl itself.
60
61 =cut