File Coverage

blib/lib/DBIx/Class/Storage/DBI/ADO.pm
Criterion Covered Total %
statement 21 33 63.6
branch 0 4 0.0
condition n/a
subroutine 7 11 63.6
pod n/a
total 28 48 58.3


line stmt bran cond sub pod time code
1             package DBIx::Class::Storage::DBI::ADO;
2              
3 2     2   873 use warnings;
  2         3  
  2         53  
4 2     2   11 use strict;
  2         10  
  2         38  
5              
6 2     2   9 use base 'DBIx::Class::Storage::DBI';
  2         4  
  2         211  
7 2     2   13 use mro 'c3';
  2         4  
  2         10  
8              
9 2     2   54 use DBIx::Class::_Util qw( sigwarn_silencer modver_gt_or_eq set_subname );
  2         5  
  2         106  
10 2     2   10 use namespace::clean;
  2         4  
  2         11  
11              
12             =head1 NAME
13              
14             DBIx::Class::Storage::DBI::ADO - Support for L
15              
16             =head1 DESCRIPTION
17              
18             This class provides a mechanism for discovering and loading a sub-class
19             for a specific ADO backend, as well as some workarounds for L. It
20             should be transparent to the user.
21              
22             =cut
23              
24 0     0     sub _rebless { shift->_determine_connector_driver('ADO') }
25              
26             # cleanup some warnings from DBD::ADO
27             # RT#65563, not fixed as of DBD::ADO v2.98
28             sub _dbh_get_info {
29 0     0     my $self = shift;
30              
31 0           local $SIG{__WARN__} = sigwarn_silencer(
32             qr{^Missing argument in sprintf at \S+/ADO/GetInfo\.pm}
33             );
34              
35 0           $self->next::method(@_);
36             }
37              
38             # Monkeypatch out the horrible warnings during global destruction.
39             # A patch to DBD::ADO has been submitted as well, and it was fixed
40             # as of 2.99
41             # https://rt.cpan.org/Ticket/Display.html?id=65563
42             sub _init {
43 0 0   0     unless ($DBD::ADO::__DBIC_MONKEYPATCH_CHECKED__) {
44 0           require DBD::ADO;
45              
46 0 0         unless ( modver_gt_or_eq( 'DBD::ADO', '2.99' ) ) {
47 2     2   676 no warnings 'redefine';
  2         5  
  2         328  
48 0           my $disconnect = *DBD::ADO::db::disconnect{CODE};
49              
50             *DBD::ADO::db::disconnect = set_subname 'DBD::ADO::db::disconnect' => sub {
51 0     0     local $SIG{__WARN__} = sigwarn_silencer(
52             qr/Not a Win32::OLE object|uninitialized value/
53             );
54 0           $disconnect->(@_);
55 0           };
56             }
57              
58 0           $DBD::ADO::__DBIC_MONKEYPATCH_CHECKED__ = 1;
59             }
60             }
61              
62             # Here I was just experimenting with ADO cursor types, left in as a comment in
63             # case you want to as well. See the DBD::ADO docs.
64             #sub _prepare_sth {
65             # my ($self, $dbh, $sql) = @_;
66             #
67             # my $sth = $self->disable_sth_caching
68             # ? $dbh->prepare($sql, { CursorType => 'adOpenStatic' })
69             # : $dbh->prepare_cached($sql, { CursorType => 'adOpenStatic' }, 3);
70             #
71             # $self->throw_exception($dbh->errstr) if !$sth;
72             #
73             # $sth;
74             #}
75              
76             =head1 FURTHER QUESTIONS?
77              
78             Check the list of L.
79              
80             =head1 COPYRIGHT AND LICENSE
81              
82             This module is free software L
83             by the L. You can
84             redistribute it and/or modify it under the same terms as the
85             L.
86              
87             =cut
88              
89             1;
90              
91             # vim:sts=2 sw=2: