File Coverage

blib/lib/DBIx/Class/Storage/DBI/ODBC.pm
Criterion Covered Total %
statement 18 34 52.9
branch 0 10 0.0
condition 0 12 0.0
subroutine 6 10 60.0
pod n/a
total 24 66 36.3


line stmt bran cond sub pod time code
1             package DBIx::Class::Storage::DBI::ODBC;
2 3     3   960 use strict;
  3         7  
  3         77  
3 3     3   13 use warnings;
  3         6  
  3         70  
4 3     3   13 use base qw/DBIx::Class::Storage::DBI/;
  3         7  
  3         289  
5 3     3   20 use mro 'c3';
  3         6  
  3         15  
6              
7 3     3   82 use DBIx::Class::_Util 'modver_gt_or_eq';
  3         8  
  3         127  
8 3     3   16 use namespace::clean;
  3         6  
  3         22  
9              
10 0     0     sub _rebless { shift->_determine_connector_driver('ODBC') }
11              
12             # Whether or not we are connecting via the freetds ODBC driver
13             sub _using_freetds {
14 0     0     my $self = shift;
15              
16 0           my $dsn = $self->_dbi_connect_info->[0];
17              
18 0 0 0       return 1 if (
      0        
      0        
19             ( (! ref $dsn) and $dsn =~ /driver=FreeTDS/i)
20             or
21             ( ($self->_dbh_get_info('SQL_DRIVER_NAME')||'') =~ /tdsodbc/i )
22             );
23              
24 0           return 0;
25             }
26              
27             # Either returns the FreeTDS version via which we are connecting, 0 if can't
28             # be determined, or undef otherwise
29             sub _using_freetds_version {
30 0     0     my $self = shift;
31 0 0         return undef unless $self->_using_freetds;
32 0   0       return $self->_dbh_get_info('SQL_DRIVER_VER') || 0;
33             }
34              
35             sub _disable_odbc_array_ops {
36 0     0     my $self = shift;
37 0           my $dbh = $self->_get_dbh;
38              
39 0   0       $DBD::ODBC::__DBIC_DISABLE_ARRAY_OPS_VIA__ ||= [ do {
40 0 0         if( modver_gt_or_eq('DBD::ODBC', '1.35_01') ) {
    0          
41 0           odbc_array_operations => 0;
42             }
43             elsif( modver_gt_or_eq('DBD::ODBC', '1.33_01') ) {
44 0           odbc_disable_array_operations => 1;
45             }
46             }];
47              
48 0 0         if (my ($k, $v) = @$DBD::ODBC::__DBIC_DISABLE_ARRAY_OPS_VIA__) {
49 0           $dbh->{$k} = $v;
50             }
51             }
52              
53             =head1 NAME
54              
55             DBIx::Class::Storage::DBI::ODBC - Base class for ODBC drivers
56              
57             =head1 DESCRIPTION
58              
59             This class simply provides a mechanism for discovering and loading a sub-class
60             for a specific ODBC backend. It should be transparent to the user.
61              
62             =head1 FURTHER QUESTIONS?
63              
64             Check the list of L<additional DBIC resources|DBIx::Class/GETTING HELP/SUPPORT>.
65              
66             =head1 COPYRIGHT AND LICENSE
67              
68             This module is free software L<copyright|DBIx::Class/COPYRIGHT AND LICENSE>
69             by the L<DBIx::Class (DBIC) authors|DBIx::Class/AUTHORS>. You can
70             redistribute it and/or modify it under the same terms as the
71             L<DBIx::Class library|DBIx::Class/COPYRIGHT AND LICENSE>.
72              
73             =cut
74              
75             1;
76              
77             # vim:sts=2 sw=2: