Commit | Line | Data |
2a57124d |
1 | package DBIx::Class::Storage::DBI::ODBC; |
2 | use strict; |
3 | use warnings; |
2a57124d |
4 | use base qw/DBIx::Class::Storage::DBI/; |
2ad62d97 |
5 | use mro 'c3'; |
2a57124d |
6 | |
75d3bdb2 |
7 | sub _rebless { shift->_determine_connector_driver('ODBC') } |
52b420dd |
8 | |
75d3bdb2 |
9 | # Whether or not we are connecting via the freetds ODBC driver |
aca3b4c3 |
10 | sub _using_freetds { |
11 | my $self = shift; |
12 | |
13 | my $dsn = $self->_dbi_connect_info->[0]; |
14 | |
15 | return 1 if ( |
16 | ( (! ref $dsn) and $dsn =~ /driver=FreeTDS/i) |
17 | or |
18 | ( ($self->_dbh_get_info('SQL_DRIVER_NAME')||'') =~ /tdsodbc/i ) |
19 | ); |
20 | |
21 | return 0; |
22 | } |
23 | |
24 | # Either returns the FreeTDS version via which we are connecting, 0 if can't |
25 | # be determined, or undef otherwise |
26 | sub _using_freetds_version { |
27 | my $self = shift; |
28 | return undef unless $self->_using_freetds; |
29 | return $self->_dbh_get_info('SQL_DRIVER_VER') || 0; |
30 | } |
31 | |
11f7049f |
32 | sub _disable_odbc_array_ops { |
33 | my $self = shift; |
34 | my $dbh = $self->_get_dbh; |
35 | |
a3a342eb |
36 | if (eval { DBD::ODBC->VERSION(1.35_01) }) { |
11f7049f |
37 | $dbh->{odbc_array_operations} = 0; |
38 | } |
a3a342eb |
39 | elsif (eval { DBD::ODBC->VERSION(1.33_01) }) { |
11f7049f |
40 | $dbh->{odbc_disable_array_operations} = 1; |
41 | } |
42 | } |
43 | |
2a57124d |
44 | 1; |
45 | |
46 | =head1 NAME |
47 | |
48 | DBIx::Class::Storage::DBI::ODBC - Base class for ODBC drivers |
49 | |
2a57124d |
50 | =head1 DESCRIPTION |
51 | |
52 | This class simply provides a mechanism for discovering and loading a sub-class |
53 | for a specific ODBC backend. It should be transparent to the user. |
54 | |
ab17c175 |
55 | =head1 AUTHOR |
2a57124d |
56 | |
ab17c175 |
57 | See L<DBIx::Class/AUTHOR> and L<DBIx::Class/CONTRIBUTORS>. |
2a57124d |
58 | |
59 | =head1 LICENSE |
60 | |
61 | You may distribute this code under the same terms as Perl itself. |
62 | |
63 | =cut |
ab17c175 |
64 | # vim:sts=2 sw=2: |