blib/lib/DBIO/Storage/DBI/AccessBroker.pm

filter: Statementstmt 100% 145 / 145 Branchbran 96.5% 83 / 86 Conditioncond 91.8% 56 / 61 MC/DCmcdc 85.7% 30 / 35 Subroutinesub 100% 22 / 22 Podpod 100% 2 / 2 totaltotal 96.3% 338 / 351 CC 66 SCAR 18.5
CC
66
Cov
97%
_normalized_access_broker_connect_info
14.0
_merge_access_broker_call_info
8.0
_access_broker_unapplied_parameters
7.0
CRAP 6.4
« blib/lib/DBIO/HashAccessor.pm ↑ Summary blib/lib/DBIO/InflateColumn.pm »
1 package DBIO::Storage::DBI::AccessBroker;
2 # ABSTRACT: DBI-specific AccessBroker integration for DBIO storage
3  
4 344 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 344 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 344 our $VERSION = '0.900007';
8  
9 344 ▶use base 'DBIO::Storage';
Subroutine BEGIN: called CC=1 SCAR=0.0
10 344 ▶use mro 'c3';
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 344 ▶use Scalar::Util qw(blessed refaddr);
Subroutine BEGIN: called CC=1 SCAR=0.0
13 344 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15  
16 4408 ▶sub _is_access_broker_connect_info {
Subroutine _is_access_broker_connect_info: called CC=6 SCAR=17.9
17 4408 my ($self, $info) = @_;
18  
19 4408 ▶ return 0 unless ref $info eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $info eq "ARRAY" 332 4076 4408
20 4076 ▶ return 0 unless @$info == 1 || (@$info == 2 && ref $info->[1] eq 'HASH');
Branch: 1 branch
BranchTrueFalseTotal
unless @$info == 1 or @$info == 2 and ref $info->[1] eq "HASH" 419 3657 4076
Condition100%6/6
@$info == 1 or @$info == 2 and ref $info->[1] eq "HASH"
l!l&&r!l&&!r
3061596419
@$info == 2 and ref $info->[1] eq "HASH"
!ll&&!rl&&r
4118596
MC/DC100%3/3
@$info == 1 or @$info == 2 and ref $info->[1] eq "HASH"
@$info == 1 @$info == 2 ref $info->[1] eq "HASH"
Truth table100%4/4
A or B and C
A= @$info == 1B= @$info == 2C= ref $info->[1] eq "HASH"
ABCresult
1XX1
0111
00X0
0100
21 3657 ▶ return 0 unless blessed($info->[0]);
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($info->[0]) 1709 1948 3657
22  
23 1948 return $info->[0]->isa('DBIO::AccessBroker');
24 }
25  
26  
27 939 ▶sub _access_broker_call_info {
Subroutine _access_broker_call_info: called CC=5 SCAR=16.1
28 939 my ($self, $info) = @_;
29  
30 939 ▶ return undef unless $self->_is_access_broker_connect_info($info);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_is_access_broker_connect_info($info) 0 939 939
31 939 ▶ my %beside = %{ $info->[1] || {} };
Condition100%2/2
$info->[1] || {}
l!l
282657
MC/DC100%1/1
$info->[1] || {}
$info->[1]
Truth table100%2/2
A
A= $info->[1]
Aresult
11
00
32 939 ▶ return undef unless %beside;
Branch: 1 branch
BranchTrueFalseTotal
unless %beside 662 277 939
33  
34 277 my @identity = grep { exists $beside{$_} } $self->_access_broker_identity_keys;
35 277 ▶ $self->throw_exception(
Branch: 1 branch
BranchTrueFalseTotal
if @identity 2 275 277
36 'With an AccessBroker, the hash beside the broker takes connect options, '
37 . 'not the connection itself: ' . join(', ', @identity) . '. Which database, '
38 . "and as whom, is the broker's answer."
39 ) if @identity;
40  
41 275 return $self->_normalize_connect_info([ \%beside ]);
42 }
43  
44  
45 650 ▶sub _access_broker_identity_keys { qw( dsn user password dbh_maker dbname host port ) }
Subroutine _access_broker_identity_keys: called CC=1 SCAR=0.0
46  
47  
48 521 ▶sub set_access_broker {
Subroutine set_access_broker: called CC=6 SCAR=17.9
Pod documented
49 521 my $self = shift;
50  
51 521 $self->next::method(@_);
52  
53 # The connect info this storage keeps is what a backend is built from
54 # anew, after disconnect or before its first use. It names the broker
55 # attached last, so that backend does not fall back to the DSN (or the
56 # broker) the storage was given before. What stood beside a broker there
57 # stays. A storage that was never given connect info has nothing to
58 # amend (karr k331).
59 509 my $stored = $self->_connect_info;
60 509 ▶ if (defined $stored) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $stored) 486 23 509
61 486 my $broker = $_[0];
62 486 ▶ if ($self->_is_access_broker_connect_info($stored)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_is_access_broker_connect_info($stored)) { } 480 6 486
63 # [ $broker ] or [ $broker, \%options ]: the options stay
64 480 ▶ $self->_connect_info([ $broker, @{$stored}[1 .. $#$stored] ])
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::refaddr($stored->[0]) == builtin::refaddr($broker) 4 476 480
65 unless refaddr($stored->[0]) == refaddr($broker);
66 }
67 else {
68 6 $self->{_connect_info_before_broker} = $stored;
69 6 $self->_connect_info([ $broker ]);
70 }
71 }
72  
73 509 my $async = $self->{_async_storage_obj};
74 509 ▶ $async->set_access_broker(@_)
Branch: 1 branch
BranchTrueFalseTotal
if builtin::blessed($async) and $async->can("set_access_broker") 4 505 509
Condition66%2/3
builtin::blessed($async) and $async->can("set_access_broker")
!ll&&!rl&&r
50504
MC/DC50%1/2
builtin::blessed($async) and $async->can("set_access_broker")
builtin::blessed($async) $async->can("set_access_broker")
Truth table66%2/3
A and B
A= builtin::blessed($async)B= $async->can("set_access_broker")
ABresult
0X0
100
111
75 if blessed($async) && $async->can('set_access_broker');
76  
77 509 return $self;
78 }
79  
80  
81 2098 ▶sub clear_access_broker {
Subroutine clear_access_broker: called CC=5 SCAR=16.1
Pod documented
82 2098 my $self = shift;
83  
84 2098 ▶ if ($self->access_broker) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->access_broker) 22 2076 2098
85 22 my $async = $self->{_async_storage_obj};
86 22 ▶ $async->clear_access_broker
Branch: 1 branch
BranchTrueFalseTotal
if builtin::blessed($async) and $async->can("clear_access_broker") 3 19 22
Condition66%2/3
builtin::blessed($async) and $async->can("clear_access_broker")
!ll&&!rl&&r
1903
MC/DC50%1/2
builtin::blessed($async) and $async->can("clear_access_broker")
builtin::blessed($async) $async->can("clear_access_broker")
Truth table66%2/3
A and B
A= builtin::blessed($async)B= $async->can("clear_access_broker")
ABresult
0X0
100
111
87 if blessed($async) && $async->can('clear_access_broker');
88  
89 # Static connect info a broker attach replaced stands again (karr k331).
90 $self->_connect_info(delete $self->{_connect_info_before_broker})
91 22 ▶ if $self->{_connect_info_before_broker};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_connect_info_before_broker"} 1 21 22
92 }
93  
94 2098 return $self->next::method(@_);
95 }
96  
97  
98 171 ▶sub _merge_access_broker_call_info {
Subroutine _merge_access_broker_call_info: called CC=8 SCAR=20.8
99 171 my ($self, $info, $beside) = @_;
100  
101 171 my %merged = %$info;
102  
103 171 ▶ if (defined $beside->{async_mode}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $beside->{"async_mode"}) 63 108 171
104 $self->throw_exception(
105 "Two async modes for one connection: '$beside->{async_mode}' beside the "
106 . "AccessBroker, '$info->{async_mode}' in the broker's answer"
107 63 ▶ ) if defined $info->{async_mode} && $info->{async_mode} ne $beside->{async_mode};
Branch: 1 branch
BranchTrueFalseTotal
if defined $info->{"async_mode"} and $info->{"async_mode"} ne $beside->{"async_mode"} 1 62 63
Condition100%3/3
defined $info->{"async_mode"} and $info->{"async_mode"} ne $beside->{"async_mode"}
!ll&&!rl&&r
6111
MC/DC100%2/2
defined $info->{"async_mode"} and $info->{"async_mode"} ne $beside->{"async_mode"}
defined $info->{"async_mode"} $info->{"async_mode"} ne $beside->{"async_mode"}
Truth table100%3/3
A and B
A= defined $info->{"async_mode"}B= $info->{"async_mode"} ne $beside->{"async_mode"}
ABresult
0X0
100
111
108 62 $merged{async_mode} = $beside->{async_mode};
109 }
110  
111 170 for my $part (qw( storage_options sql_maker_options attributes )) {
112 508 ▶ next unless $beside->{$part};
Branch: 1 branch
BranchTrueFalseTotal
unless $beside->{$part} 304 204 508
113 $merged{$part} = $self->_merge_access_broker_settings(
114 204 $info->{$part}, $beside->{$part},
115 );
116 }
117  
118 # The async options are the async backend's and no DBI attributes of an
119 # async owner (karr k211, k397). _normalize_connect_info drops them only when
120 # the mode sits in the same hash; here the mode may have come from the other.
121 167 ▶ if (defined $merged{async_mode} && $merged{attributes}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $merged{"async_mode"} and $merged{"attributes"}) 36 131 167
Condition100%3/3
defined $merged{"async_mode"} and $merged{"attributes"}
!ll&&!rl&&r
1042736
MC/DC100%2/2
defined $merged{"async_mode"} and $merged{"attributes"}
defined $merged{"async_mode"} $merged{"attributes"}
Truth table100%3/3
A and B
A= defined $merged{"async_mode"}B= $merged{"attributes"}
ABresult
0X0
100
111
122 36 my %attributes = %{ $merged{attributes} };
123 36 delete @attributes{ $self->_async_option_names($merged{async_mode}) };
124 36 $merged{attributes} = \%attributes;
125 }
126  
127 167 return \%merged;
128 }
129  
130  
131 31 ▶sub _access_broker_backend_settings {
Subroutine _access_broker_backend_settings: called CC=4 SCAR=13.9
132 31 my ($self, $info) = @_;
133  
134 31 ▶ my $beside = $self->_access_broker_call_info($info) or return;
Branch: 1 branch
BranchTrueFalseTotal
my $beside = $self->_access_broker_call_info($info) or return 26 5 31
135  
136 26 ▶ my %names = %{ $beside->{attributes} || {} };
Condition100%2/2
$beside->{'attributes'} || {}
l!l
521
MC/DC100%1/1
$beside->{'attributes'} || {}
$beside->{'attributes'}
Truth table100%2/2
A
A= $beside->{'attributes'}
Aresult
11
00
137 26 delete $names{ignore_version};
138 26 ▶ $names{pool_size} = 1 if exists $info->[1]{pool_size};
Branch: 1 branch
BranchTrueFalseTotal
if exists $info->[1]{"pool_size"} 5 21 26
139  
140 # The other async options are read off the storage by the backend and its
141 # pool (L<DBIO::Storage::Async/async_option>); no transport capability is
142 # needed for them (karr core k397). L</_access_broker_async_options> hands
143 # them on.
144 26 delete @names{ grep { $_ ne 'pool_size' } $self->_async_option_names($self->_async_mode) };
145  
146 26 return sort keys %names;
147 }
148  
149  
150 25 ▶sub _access_broker_async_options {
Subroutine _access_broker_async_options: called CC=3 SCAR=11.0
151 25 my ($self, $info) = @_;
152  
153 25 ▶ return {} unless ref $info eq 'ARRAY' && ref $info->[1] eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $info eq "ARRAY" and ref $info->[1] eq "HASH" 5 20 25
Condition66%2/3
ref $info eq "ARRAY" and ref $info->[1] eq "HASH"
!ll&&!rl&&r
0520
MC/DC50%1/2
ref $info eq "ARRAY" and ref $info->[1] eq "HASH"
ref $info eq "ARRAY" ref $info->[1] eq "HASH"
Truth table66%2/3
A and B
A= ref $info eq "ARRAY"B= ref $info->[1] eq "HASH"
ABresult
0X0
100
111
154 20 my %names = map { $_ => 1 } grep { $_ ne 'pool_size' } $self->_async_option_names($self->_async_mode);
155 20 return { map { $_ => $info->[1]{$_} } grep { $names{$_} } keys %{ $info->[1] } };
156 }
157  
158  
159 1121 ▶sub _current_dbi_connect_info {
Subroutine _current_dbi_connect_info: called CC=6 SCAR=17.9
160 1121 my ($self, $mode) = @_;
161  
162 1121 ▶ return $self->_dbi_connect_info unless $self->access_broker;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->access_broker 0 1121 1121
163  
164 1121 my $answer = $self->current_access_broker_connect_info($mode);
165 1073 ▶ return $answer if ref $answer eq 'HASH' or ref $answer eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
if ref $answer eq "HASH" or ref $answer eq "ARRAY" 1041 32 1073
Condition100%3/3
ref $answer eq "HASH" or ref $answer eq "ARRAY"
l!l&&r!l&&!r
49754432
MC/DC100%2/2
ref $answer eq "HASH" or ref $answer eq "ARRAY"
ref $answer eq "HASH" ref $answer eq "ARRAY"
Truth table100%3/3
A or B
A= ref $answer eq "HASH"B= ref $answer eq "ARRAY"
ABresult
1X1
011
000
166  
167 32 ▶ my $shape = !ref $answer ? 'a plain scalar'
Branch: 2 branches
BranchTrueFalseTotal
!ref($answer) ? : 8 24 32
builtin::blessed($answer) ? : 8 16 24
168 : blessed($answer) ? 'an object of class ' . ref $answer
169 : 'a ' . ref($answer) . ' reference';
170  
171 32 $self->throw_exception(
172 'AccessBroker ' . ref($self->access_broker) . ' answered connect info a DBI '
173 . "storage cannot connect from ($shape). It takes a hash of connection "
174 . 'parameters, or the DBI form [ $dsn, $user, $password, \%attrs ].'
175 );
176 }
177  
178  
179 645 ▶sub _access_broker_dbi_args {
Subroutine _access_broker_dbi_args: called CC=3 SCAR=11.0
180 645 my ($self, $mode, %for) = @_;
181  
182 645 my $info = $self->_normalized_access_broker_connect_info($mode, %for);
183  
184 # the settings beside the broker join every answer, not only the first
185 # (see connect_info); that also keeps pool_size out once there is a mode
186 430 ▶ if (my $beside = $self->_access_broker_call_info($self->_connect_info)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $beside = $self->_access_broker_call_info($self->_connect_info)) 128 302 430
187 $self->_assert_access_broker_options_apply($info, $beside)
188 128 ▶ if $for{connecting};
Branch: 1 branch
BranchTrueFalseTotal
if $for{"connecting"} 105 23 128
189 51 $info = $self->_merge_access_broker_call_info($info, $beside);
190 }
191  
192 352 return $self->_dbi_args_from_info($info);
193 }
194  
195  
196 1121 ▶sub _normalized_access_broker_connect_info {
Subroutine _normalized_access_broker_connect_info: called CC=14 SCAR=26.4
197 1121 my ($self, $mode, %for) = @_;
198  
199 1121 my $answer = $self->_current_dbi_connect_info($mode);
200 # a hash is the single-hash form of connect_info
201 1041 ▶ $answer = [ $answer ] if ref $answer eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
if ref $answer eq "HASH" 497 544 1041
202  
203 my $hash = ref $answer->[0] eq 'HASH' && !$answer->[0]{dbh_maker}
204 1041 ▶ ? $answer->[0] : undef;
Branch: 1 branch
BranchTrueFalseTotal
ref $answer->[0] eq 'HASH' && !$answer->[0]{'dbh_maker'} ? : 463 578 1041
Condition100%3/3
ref $answer->[0] eq "HASH" and not $answer->[0]{"dbh_maker"}
!ll&&!rl&&r
54434463
MC/DC100%2/2
ref $answer->[0] eq "HASH" and not $answer->[0]{"dbh_maker"}
ref $answer->[0] eq "HASH" not $answer->[0]{"dbh_maker"}
Truth table100%3/3
A and not(B)
A= ref $answer->[0] eq "HASH"B= not $answer->[0]{"dbh_maker"}
ABresult
0X0
100
111
205 1041 my $shape;
206  
207 1041 ▶ if ($hash && !exists $hash->{dsn} && !exists $hash->{dbname}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($hash and not exists $hash->{'dsn'} and not exists $hash->{'dbname'}) { } 76 965 1041
Condition100%6/6
$hash and not exists $hash->{"dsn"} and not exists $hash->{"dbname"}
!ll&&!rl&&r
83313276
$hash and not exists $hash->{"dsn"}
!ll&&!rl&&r
578255208
MC/DC100%3/3
$hash and not exists $hash->{"dsn"} and not exists $hash->{"dbname"}
$hash not exists $hash->{"dsn"} not exists $hash->{"dbname"}
Truth table100%4/4
A and not(B) and not(C)
A= $hashB= not exists $hash->{"dsn"}C= not exists $hash->{"dbname"}
ABCresult
0XX0
10X0
1100
1111
208 76 my @parts = grep { exists $hash->{$_} } qw(host port);
209 76 ▶ $shape = 'a hash with ' . (@parts ? join(' and ', @parts) . ', but ' : '')
Branch: 1 branch
BranchTrueFalseTotal
@parts ? : 56 20 76
210 . 'neither a dsn nor a dbname key';
211 }
212 else {
213 965 my $info = $self->_normalize_connect_info($answer);
214 954 my $dsn = $info->{arguments}[0];
215 954 ▶ if (defined $dsn && length $dsn) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $dsn and length $dsn) 854 100 954
Condition100%3/3
defined $dsn and length $dsn
!ll&&!rl&&r
5248854
MC/DC100%2/2
defined $dsn and length $dsn
defined $dsn length $dsn
Truth table100%3/3
A and B
A= defined $dsnB= length $dsn
ABresult
0X0
100
111
216 $self->_assert_access_broker_parameters_apply($info)
217 854 ▶ if $hash && $for{connecting};
Branch: 1 branch
BranchTrueFalseTotal
if $hash and $for{"connecting"} 154 700 854
Condition100%3/3
$hash and $for{"connecting"}
!ll&&!rl&&r
526174154
MC/DC100%2/2
$hash and $for{"connecting"}
$hash $for{"connecting"}
Truth table100%3/3
A and B
A= $hashB= $for{"connecting"}
ABresult
0X0
100
111
218 794 return $info;
219 }
220  
221 100 ▶ $shape = ($hash ? 'a hash' : 'the DBI form') . ' with '
Branch: 2 branches
BranchTrueFalseTotal
$hash ? : 48 52 100
defined $dsn ? : 48 52 100
222 . (defined $dsn ? 'an empty' : 'an undefined') . ' DSN';
223 }
224  
225 176 $self->throw_exception(
226 'AccessBroker ' . ref($self->access_broker) . ' answered connect info '
227 . "without a DSN ($shape). A DBI storage connects with a broker's "
228 . 'credentials only to the DSN the broker answers, never to the one in '
229 . '$ENV{DBI_DSN}: answer a dsn, or a dbname.'
230 );
231 }
232  
233  
234 154 ▶sub _assert_access_broker_parameters_apply {
Subroutine _assert_access_broker_parameters_apply: called CC=3 SCAR=11.0
235 154 my ($self, $info) = @_;
236  
237 my @unapplied = $self->_access_broker_unapplied_parameters(
238 154 ▶ $info->{attributes}, $info->{arguments}[0],
Branch: 1 branch
BranchTrueFalseTotal
my(@unapplied) = $self->_access_broker_unapplied_parameters($info->{"attributes"}, $info->{"arguments"}[0]) or return 60 94 154
239 ) or return;
240  
241 60 ▶ $self->throw_exception(
Branch: 1 branch
BranchTrueFalseTotal
@unapplied > 1 ? : 10 50 60
242 'AccessBroker ' . ref($self->access_broker) . ' answered connect info with '
243 . 'parameter(s) a DBI storage does not apply (' . join(', ', @unapplied) . '). '
244 . 'Of a hash it builds only dbname, host and port into the DSN, and what is '
245 . 'no DBI attribute is not read by DBI->connect: the connection would be '
246 . 'opened without ' . (@unapplied > 1 ? 'them' : 'it') . '. Answer the DBI '
247 . 'form [ $dsn, $user, $password, \%attrs ] with a parameter of the database '
248 . "client inside the DSN ('dbi:<DBD>:...;<parameter>=...') -- its \\%attrs "
249 . 'take any DBI attribute -- or answer by the storage that asks '
250 . '(connect_info_for_storage): a DBI storage without the parameter, or with '
251 . 'it inside the DSN.'
252 );
253 }
254  
255  
256 105 ▶sub _assert_access_broker_options_apply {
Subroutine _assert_access_broker_options_apply: called CC=4 SCAR=13.9
257 105 my ($self, $info, $beside) = @_;
258  
259 105 my $dsn = $info->{arguments}[0];
260  
261 # code opens the connection: the storage applies none of the attributes to
262 # it, so every key it does not consume itself is lost (karr k310)
263 my @unapplied = ref $dsn eq 'CODE'
264 ? $self->_access_broker_unconsumed_options($beside->{attributes})
265 105 ▶ : $self->_access_broker_unapplied_parameters($beside->{attributes}, $dsn);
Branch: 1 branch
BranchTrueFalseTotal
ref $dsn eq 'CODE' ? : 12 93 105
266 105 ▶ @unapplied or return;
Branch: 1 branch
BranchTrueFalseTotal
@unapplied or return 77 28 105
267  
268 77 ▶ $self->throw_exception(
Branch: 1 branch
BranchTrueFalseTotal
@unapplied > 1 ? : 17 60 77
269 'A DBI storage does not apply parameter(s) given beside AccessBroker '
270 . ref($self->access_broker) . ' (' . join(', ', @unapplied) . '). What is no '
271 . 'DBI attribute is not read by DBI->connect: the connection would be opened '
272 . 'without ' . (@unapplied > 1 ? 'them' : 'it') . '. A parameter of the '
273 . "database client is the broker's to answer, not a connect option beside "
274 . 'it: in the DBI form [ $dsn, $user, $password, \%attrs ] inside the DSN '
275 . "('dbi:<DBD>:...;<parameter>=...') -- its \\%attrs take any DBI attribute "
276 . '-- or by the storage that asks (connect_info_for_storage).'
277 . $self->_driver_switch_hint(@unapplied)
278 );
279 }
280  
281  
282 688 ▶sub _access_broker_unapplied_parameters {
Subroutine _access_broker_unapplied_parameters: called CC=7 SCAR=19.5
283 688 my ($self, $attrs, $dsn) = @_;
284  
285 688 ▶ return unless $attrs;
Branch: 1 branch
BranchTrueFalseTotal
unless $attrs 387 301 688
286 301 my %consumed = map { $_ => 1 } $self->_access_broker_consumed_keys;
287  
288 my @lowercase = grep {
289 301 ▶ !$consumed{$_} && defined $attrs->{$_} && length $attrs->{$_}
Condition100%9/9
!$consumed{$_} && defined $attrs->{$_} && length $attrs->{$_} && !/^(?:[A-Z]|private_|dbi_|dbd_)/
!ll&&!rl&&r
101244267
not $consumed{$_} and defined $attrs->{$_} and length $attrs->{$_}
!ll&&!rl&&r
947511
not $consumed{$_} and defined $attrs->{$_}
!ll&&!rl&&r
5440518
MC/DC100%4/4
!$consumed{$_} && defined $attrs->{$_} && length $attrs->{$_} && !/^(?:[A-Z]|private_|dbi_|dbd_)/
not $consumed{$_} defined $attrs->{$_} length $attrs->{$_} !/^(?:[A-Z]|private_|dbi_|dbd_)/
Truth table100%5/5
not(A) and B and C && not(D)
A= not $consumed{$_}B= defined $attrs->{$_}C= length $attrs->{$_}D= !/^(?:[A-Z]|private_|dbi_|dbd_)/
ABCDresult
0XXX0
10XX0
110X0
11100
11111
290 && !/^(?:[A-Z]|private_|dbi_|dbd_)/
291 } keys %$attrs;
292 301 ▶ return unless @lowercase;
Branch: 1 branch
BranchTrueFalseTotal
unless @lowercase 136 165 301
293  
294 # the DBD as DBI itself reads it off the DSN (see
295 # _extract_driver_from_connect_info)
296 165 my ($driver) = $dsn =~ /^dbi:(\w+)/i;
297 165 ▶ my @prefixes = grep { defined && length } $self->_dbd_attribute_prefixes($driver);
Condition33%1/3
defined $_ && length $_
!ll&&!rl&&r
00146
MC/DC0%0/2
defined $_ && length $_
defined $_ length $_
Truth table33%1/3
A && B
A= defined $_B= length $_
ABresult
0X0
100
111
298  
299 return sort grep {
300 165 my $name = $_;
301 267 !grep { index($name, $_) == 0 } @prefixes;
302 } @lowercase;
303 }
304  
305  
306 12 ▶sub _access_broker_unconsumed_options {
Subroutine _access_broker_unconsumed_options: called CC=4 SCAR=13.9
307 12 my ($self, $attrs) = @_;
308  
309 12 ▶ return unless $attrs;
Branch: 1 branch
BranchTrueFalseTotal
unless $attrs 0 12 12
310 12 my %consumed = map { $_ => 1 } $self->_access_broker_consumed_keys;
311  
312 return sort grep {
313 12 ▶ !$consumed{$_} && defined $attrs->{$_} && length $attrs->{$_}
Condition100%6/6
!$consumed{$_} && defined $attrs->{$_} && length $attrs->{$_}
!ll&&!rl&&r
6212
not $consumed{$_} and defined $attrs->{$_}
!ll&&!rl&&r
4214
MC/DC100%3/3
!$consumed{$_} && defined $attrs->{$_} && length $attrs->{$_}
not $consumed{$_} defined $attrs->{$_} length $attrs->{$_}
Truth table100%4/4
not(A) and B && C
A= not $consumed{$_}B= defined $attrs->{$_}C= length $attrs->{$_}
ABCresult
0XX0
10X0
1100
1111
314 } keys %$attrs;
315 }
316  
317  
318 313 ▶sub _access_broker_consumed_keys {
Subroutine _access_broker_consumed_keys: called CC=2 SCAR=6.9
319 313 my $self = shift;
320 313 my $mode = $self->_async_mode;
321 return (
322 313 ▶ $self->_access_broker_identity_keys,
Branch: 1 branch
BranchTrueFalseTotal
defined $mode ? : 28 285 313
323 ( defined $mode ? $self->_async_option_names($mode) : 'pool_size' ),
324 'ignore_version',
325 );
326 }
327  
328 344 1;
329  
330 __END__
« blib/lib/DBIO/HashAccessor.pm ↑ Summary blib/lib/DBIO/InflateColumn.pm »