DBIx/Class/Storage/DBI/ADO.pm

filter: Statementstmt 66.6% 28 / 42 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 64.2% 9 / 14 Podpod n/a totaltotal 61.6% 37 / 60 CC 3 SCAR 9.4
CC
3
Cov
61%
_init
8.0
_rebless
2.0
_dbh_get_info
2.0
CRAP 2.6
« DBIx/Class/Storage/DBI/Oracle.pm ↑ Summary DBIx/Class/Serialize/Storable.pm »
1 package DBIx::Class::Storage::DBI::ADO;
2  
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use base 'DBIx::Class::Storage::DBI';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use mro 'c3';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 2 ▶use Sub::Name;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use Try::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use DBIx::Class::_Util 'sigwarn_silencer';
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 =head1 NAME
15  
16 DBIx::Class::Storage::DBI::ADO - Support for L<DBD::ADO>
17  
18 =head1 DESCRIPTION
19  
20 This class provides a mechanism for discovering and loading a sub-class
21 for a specific ADO backend, as well as some workarounds for L<DBD::ADO>. It
22 should be transparent to the user.
23  
24 =cut
25  
26 0 ▶sub _rebless { shift->_determine_connector_driver('ADO') }
Subroutine _rebless: not called CC=1 SCAR=6.9
27  
28 # cleanup some warnings from DBD::ADO
29 # RT#65563, not fixed as of DBD::ADO v2.98
30 0 ▶sub _dbh_get_info {
Subroutine _dbh_get_info: not called CC=1 SCAR=6.9
31 0 my $self = shift;
32  
33 0 local $SIG{__WARN__} = sigwarn_silencer(
34 qr{^Missing argument in sprintf at \S+/ADO/GetInfo\.pm}
35 );
36  
37 0 $self->next::method(@_);
38 }
39  
40 # Monkeypatch out the horrible warnings during global destruction.
41 # A patch to DBD::ADO has been submitted as well, and it was fixed
42 # as of 2.99
43 # https://rt.cpan.org/Ticket/Display.html?id=65563
44 0 ▶sub _init {
Subroutine _init: not called CC=3 SCAR=20.8
45 0 ▶ unless ($DBD::ADO::__DBIC_MONKEYPATCH_CHECKED__) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($DBD::ADO::__DBIC_MONKEYPATCH_CHECKED__) 0 0 0
46 0 require DBD::ADO;
47  
48 0 ▶ unless (try { DBD::ADO->VERSION('2.99'); 1 }) {
Subroutine __ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
unless (&try(sub { "DBD::ADO"->VERSION("2.99"); 1; } )) 0 0 0
49 2 ▶ no warnings 'redefine';
Subroutine BEGIN: called CC=1 SCAR=0.0
50 0 my $disconnect = *DBD::ADO::db::disconnect{CODE};
51  
52 0 ▶ *DBD::ADO::db::disconnect = subname 'DBD::ADO::db::disconnect' => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
53 0 local $SIG{__WARN__} = sigwarn_silencer(
54 qr/Not a Win32::OLE object|uninitialized value/
55 );
56 0 $disconnect->(@_);
57 0 };
58 }
59  
60 0 $DBD::ADO::__DBIC_MONKEYPATCH_CHECKED__ = 1;
61 }
62 }
63  
64 # Here I was just experimenting with ADO cursor types, left in as a comment in
65 # case you want to as well. See the DBD::ADO docs.
66 #sub _prepare_sth {
67 # my ($self, $dbh, $sql) = @_;
68 #
69 # my $sth = $self->disable_sth_caching
70 # ? $dbh->prepare($sql, { CursorType => 'adOpenStatic' })
71 # : $dbh->prepare_cached($sql, { CursorType => 'adOpenStatic' }, 3);
72 #
73 # $self->throw_exception($dbh->errstr) if !$sth;
74 #
75 # $sth;
76 #}
77  
78 =head1 FURTHER QUESTIONS?
79  
80 Check the list of L<additional DBIC resources|DBIx::Class/GETTING HELP/SUPPORT>.
81  
82 =head1 COPYRIGHT AND LICENSE
83  
84 This module is free software L<copyright|DBIx::Class/COPYRIGHT AND LICENSE>
85 by the L<DBIx::Class (DBIC) authors|DBIx::Class/AUTHORS>. You can
86 redistribute it and/or modify it under the same terms as the
87 L<DBIx::Class library|DBIx::Class/COPYRIGHT AND LICENSE>.
88  
89 =cut
90  
91 2 1;
92  
93 # vim:sts=2 sw=2:
« DBIx/Class/Storage/DBI/Oracle.pm ↑ Summary DBIx/Class/Serialize/Storable.pm »