| 1 | package DBI::Gofer::Execute; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # $Id: Execute.pm 14282 2010-07-26 00:12:54Z David $ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # Copyright (c) 2007, Tim Bunce, Ireland | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # You may distribute under the terms of either the GNU General Public | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # License or the Artistic License, as specified in the Perl README file. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 63 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 63 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 63 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 63 | ▶ | use DBI qw(dbi_time); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 63 | ▶ | use DBI::Gofer::Request; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 63 | ▶ | use DBI::Gofer::Response; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 63 | ▶ | use base qw(DBI::Util::_accessor); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | our $VERSION = "0.014283"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | our @all_dbh_methods = sort map { keys %$_ } $DBI::DBI_methods{db}, $DBI::DBI_methods{common}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | our %all_dbh_methods = map { $_ => (DBD::_::db->can($_)||undef) } @all_dbh_methods; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | our $local_log = $ENV{DBI_GOFER_LOCAL_LOG}; # do extra logging to stderr | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | our $current_dbh; # the dbh we're using for this request | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | # set trace for server-side gofer | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | # Could use DBI_TRACE env var when it's an unrelated separate process | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | # but using DBI_GOFER_TRACE makes testing easier for subprocesses (eg stream) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | DBI->trace(split /=/, $ENV{DBI_GOFER_TRACE}, 2) if $ENV{DBI_GOFER_TRACE}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | # define valid configuration attributes (args to new()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | # the values here indicate the basic type of values allowed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | my %configuration_attributes = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | gofer_execute_class => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | default_connect_dsn => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | forced_connect_dsn => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | default_connect_attributes => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | forced_connect_attributes => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | track_recent => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | check_request_sub => sub {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | check_response_sub => sub {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | forced_single_resultset => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | max_cached_dbh_per_drh => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | max_cached_sth_per_dbh => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | forced_response_attributes => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | forced_gofer_random => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | stats => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | __PACKAGE__->mk_accessors( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | keys %configuration_attributes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 63 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=5 SCAR=24.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | ▶ | my ($self, $args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=5 SCAR=24.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | $args->{default_connect_attributes} ||= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition25%1/4
$args->{"default_connect_attributes"} ||= {}
$args->{"default_connect_attributes"} ||= {}
MC/DC0%0/1
$args->{"default_connect_attributes"} ||= {}
$args->{"default_connect_attributes"}
MC/DC0%0/1
$args->{"default_connect_attributes"} ||= {}
$args->{"default_connect_attributes"}
Truth table0%0/2
A
A= $args->{"default_connect_attributes"}
Truth table50%1/2
A
A= $args->{"default_connect_attributes"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | ▶ | $args->{forced_connect_attributes} ||= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition25%1/4
$args->{"forced_connect_attributes"} ||= {}
$args->{"forced_connect_attributes"} ||= {}
MC/DC0%0/1
$args->{"forced_connect_attributes"} ||= {}
$args->{"forced_connect_attributes"}
MC/DC0%0/1
$args->{"forced_connect_attributes"} ||= {}
$args->{"forced_connect_attributes"}
Truth table0%0/2
A
A= $args->{"forced_connect_attributes"}
Truth table50%1/2
A
A= $args->{"forced_connect_attributes"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | $args->{max_cached_sth_per_dbh} ||= 1000; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition25%1/4
$args->{"max_cached_sth_per_dbh"} ||= 1000
$args->{"max_cached_sth_per_dbh"} ||= 1000
MC/DC0%0/1
$args->{"max_cached_sth_per_dbh"} ||= 1000
$args->{"max_cached_sth_per_dbh"}
MC/DC0%0/1
$args->{"max_cached_sth_per_dbh"} ||= 1000
$args->{"max_cached_sth_per_dbh"}
Truth table0%0/2
A
A= $args->{"max_cached_sth_per_dbh"}
Truth table50%1/2
A
A= $args->{"max_cached_sth_per_dbh"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | ▶ | $args->{stats} ||= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition25%1/4
$args->{"stats"} ||= {}
$args->{"stats"} ||= {}
MC/DC0%0/1
$args->{"stats"} ||= {}
$args->{"stats"}
MC/DC0%0/1
$args->{"stats"} ||= {}
$args->{"stats"}
Truth table0%0/2
A
A= $args->{"stats"}
Truth table50%1/2
A
A= $args->{"stats"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | return $self->SUPER::new($args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | sub valid_configuration_attributes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
valid_configuration_attributes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
valid_configuration_attributes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | return { %configuration_attributes }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | my %extra_attr = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | # Only referenced if the driver doesn't support private_attribute_info method. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | # What driver-specific attributes should be returned for the driver being used? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | # keyed by $dbh->{Driver}{Name} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | # XXX for sth should split into attr specific to resultsets (where NUM_OF_FIELDS > 0) and others | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | # which would reduce processing/traffic for non-select statements | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | mysql => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | dbh => [qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | mysql_errno mysql_error mysql_hostinfo mysql_info mysql_insertid | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | mysql_protoinfo mysql_serverinfo mysql_stat mysql_thread_id | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | )], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | sth => [qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | mysql_is_blob mysql_is_key mysql_is_num mysql_is_pri_key mysql_is_auto_increment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | mysql_length mysql_max_length mysql_table mysql_type mysql_type_name mysql_insertid | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | )], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | # XXX this dbh_after_sth stuff is a temporary, but important, hack. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | # should be done via hash instead of arrays where the hash value contains | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | # flags that can indicate which attributes need to be handled in this way | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | dbh_after_sth => [qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | mysql_insertid | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | )], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | Pg => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | dbh => [qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | pg_protocol pg_lib_version pg_server_version | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | pg_db pg_host pg_port pg_default_port | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | pg_options pg_pid | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | )], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | sth => [qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | pg_size pg_type pg_oid_status pg_cmd_status | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | )], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | Sybase => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | dbh => [qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | syb_dynamic_supported syb_oc_version syb_server_version syb_server_version_string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | )], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | sth => [qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | syb_types syb_proc_status syb_result_type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | )], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | SQLite => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | dbh => [qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | sqlite_version | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | )], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | sth => [qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | )], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | ExampleP => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | dbh => [qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | examplep_private_dbh_attrib | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | )], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | sth => [qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | examplep_private_sth_attrib | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | )], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | dbh_after_sth => [qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | examplep_insertid | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | )], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 6558 | ▶ | sub _connect { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_connect: called CC=21 SCAR=52.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | my ($self, $request) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_connect: not called CC=21 SCAR=52.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | my $stats = $self->{stats}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | # discard CachedKids from time to time | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | ▶ | if (++$stats->{_requests_served} % 1000 == 0 # XXX config? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%2/6
++$stats->{"_requests_served"} % 1000 == 0 and my $max_cached_dbh_per_drh = $self->{"max_cached_dbh_per_drh"}
++$stats->{"_requests_served"} % 1000 == 0 and my $max_cached_dbh_per_drh = $self->{"max_cached_dbh_per_drh"}
MC/DC0%0/2
++$stats->{"_requests_served"} % 1000 == 0 and my $max_cached_dbh_per_drh = $self->{"max_cached_dbh_per_drh"}
++$stats->{"_requests_served"} % 1000 == 0
my $max_cached_dbh_per_drh = $self->{"max_cached_dbh_per_drh"}
MC/DC0%0/2
++$stats->{"_requests_served"} % 1000 == 0 and my $max_cached_dbh_per_drh = $self->{"max_cached_dbh_per_drh"}
++$stats->{"_requests_served"} % 1000 == 0
my $max_cached_dbh_per_drh = $self->{"max_cached_dbh_per_drh"}
Truth table0%0/3
A and B
A= ++$stats->{"_requests_served"} % 1000 == 0B= my $max_cached_dbh_per_drh = $self->{"max_cached_dbh_per_drh"}
Truth table66%2/3
A and B
A= ++$stats->{"_requests_served"} % 1000 == 0B= my $max_cached_dbh_per_drh = $self->{"max_cached_dbh_per_drh"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | and my $max_cached_dbh_per_drh = $self->{max_cached_dbh_per_drh} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | my %drivers = DBI->installed_drivers(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | while ( my ($driver, $drh) = each %drivers ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | next unless my $CK = $drh->{CachedKids}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | next unless keys %$CK > $max_cached_dbh_per_drh; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | ▶ | next if $driver eq 'Gofer'; # ie transport=null when testing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | DBI->trace_msg(sprintf "Clearing %d cached dbh from $driver", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | scalar keys %$CK, $self->{max_cached_dbh_per_drh}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | $_->{Active} && $_->disconnect for values %$CK; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | %$CK = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | # local $ENV{...} can leak, so only do it if required | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | local $ENV{DBI_AUTOPROXY} if $ENV{DBI_AUTOPROXY}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | my ($connect_method, $dsn, $username, $password, $attr) = @{ $request->dbh_connect_call }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | ▶ | $connect_method ||= 'connect_cached'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition25%1/4
$connect_method ||= "connect_cached"
$connect_method ||= "connect_cached"
MC/DC0%0/1
$connect_method ||= "connect_cached"
$connect_method
MC/DC0%0/1
$connect_method ||= "connect_cached"
$connect_method
Truth table0%0/2
A
A= $connect_method
Truth table50%1/2
A
A= $connect_method
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | $stats->{method_calls_dbh}->{$connect_method}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | # delete attributes we don't want to affect the server-side | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | # (Could just do this on client-side and trust the client. DoS?) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | delete @{$attr}{qw(Profile InactiveDestroy AutoInactiveDestroy HandleError HandleSetErr TraceLevel Taint TaintIn TaintOut)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | ▶ | $dsn = $self->forced_connect_dsn || $dsn || $self->default_connect_dsn | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition16%2/12
$self->forced_connect_dsn || $dsn || $self->default_connect_dsn
$self->forced_connect_dsn or $dsn
$self->forced_connect_dsn || $dsn || $self->default_connect_dsn
$self->forced_connect_dsn or $dsn
MC/DC0%0/3
$self->forced_connect_dsn || $dsn || $self->default_connect_dsn
$self->forced_connect_dsn
$dsn
$self->default_connect_dsn
MC/DC0%0/3
$self->forced_connect_dsn || $dsn || $self->default_connect_dsn
$self->forced_connect_dsn
$dsn
$self->default_connect_dsn
Truth table0%0/4
A or B || C
A= $self->forced_connect_dsnB= $dsnC= $self->default_connect_dsn
Truth table25%1/4
A or B || C
A= $self->forced_connect_dsnB= $dsnC= $self->default_connect_dsn
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | or die "No forced_connect_dsn, requested dsn, or default_connect_dsn for request"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | ▶ | my $random = $self->{forced_gofer_random} || $ENV{DBI_GOFER_RANDOM} || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition40%4/10
$self->{'forced_gofer_random'} || $ENV{'DBI_GOFER_RANDOM'} || ''
$self->{"forced_gofer_random"} or $ENV{"DBI_GOFER_RANDOM"}
$self->{'forced_gofer_random'} || $ENV{'DBI_GOFER_RANDOM'} || ''
$self->{"forced_gofer_random"} or $ENV{"DBI_GOFER_RANDOM"}
MC/DC0%0/2
$self->{'forced_gofer_random'} || $ENV{'DBI_GOFER_RANDOM'} || ''
$self->{"forced_gofer_random"}
$ENV{"DBI_GOFER_RANDOM"}
MC/DC50%1/2
$self->{'forced_gofer_random'} || $ENV{'DBI_GOFER_RANDOM'} || ''
$self->{"forced_gofer_random"}
$ENV{"DBI_GOFER_RANDOM"}
Truth table0%0/3
A or B
A= $self->{"forced_gofer_random"}B= $ENV{"DBI_GOFER_RANDOM"}
Truth table66%2/3
A or B
A= $self->{"forced_gofer_random"}B= $ENV{"DBI_GOFER_RANDOM"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | my $connect_attr = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | # the configured default attributes, if any | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | %{ $self->default_connect_attributes }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | # pass username and password as attributes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | # then they can be overridden by forced_connect_attributes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | Username => $username, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | Password => $password, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | # the requested attributes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | %$attr, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | # force some attributes the way we'd like them | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | PrintWarn => $local_log, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | PrintError => $local_log, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | # the configured default attributes, if any | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | %{ $self->forced_connect_attributes }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | # RaiseError must be enabled | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | RaiseError => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | # reset Executed flag (of the cached handle) so we can use it to tell | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | # if errors happened before the main part of the request was executed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | Executed => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | # ensure this connect_cached doesn't have the same args as the client | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | # because that causes subtle issues if in the same process (ie transport=null) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | # include pid to avoid problems with forking (ie null transport in mod_perl) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | # include gofer-random to avoid random behaviour leaking to other handles | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | dbi_go_execute_unique => join("|", __PACKAGE__, $$, $random), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | # XXX implement our own private connect_cached method? (with rate-limited ping) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | my $dbh = DBI->$connect_method($dsn, undef, undef, $connect_attr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | ▶ | $dbh->{ShowErrorStatement} = 1 if $local_log; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | # XXX should probably just be a Callbacks => arg to connect_cached | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | # with a cache of pre-built callback hooks (memoized, without $self) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | ▶ | if (my $random = $self->{forced_gofer_random} || $ENV{DBI_GOFER_RANDOM}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%2/6
$self->{'forced_gofer_random'} || $ENV{'DBI_GOFER_RANDOM'}
$self->{'forced_gofer_random'} || $ENV{'DBI_GOFER_RANDOM'}
MC/DC0%0/2
$self->{'forced_gofer_random'} || $ENV{'DBI_GOFER_RANDOM'}
$self->{'forced_gofer_random'}
$ENV{'DBI_GOFER_RANDOM'}
MC/DC50%1/2
$self->{'forced_gofer_random'} || $ENV{'DBI_GOFER_RANDOM'}
$self->{'forced_gofer_random'}
$ENV{'DBI_GOFER_RANDOM'}
Truth table0%0/3
A || B
A= $self->{'forced_gofer_random'}B= $ENV{'DBI_GOFER_RANDOM'}
Truth table66%2/3
A || B
A= $self->{'forced_gofer_random'}B= $ENV{'DBI_GOFER_RANDOM'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | $self->_install_rand_callbacks($dbh, $random); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | my $CK = $dbh->{CachedKids}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | ▶ | if ($CK && keys %$CK > $self->{max_cached_sth_per_dbh}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition16%1/6
$CK and keys %$CK > $self->{"max_cached_sth_per_dbh"}
$CK and keys %$CK > $self->{"max_cached_sth_per_dbh"}
MC/DC0%0/2
$CK and keys %$CK > $self->{"max_cached_sth_per_dbh"}
$CK
keys %$CK > $self->{"max_cached_sth_per_dbh"}
MC/DC0%0/2
$CK and keys %$CK > $self->{"max_cached_sth_per_dbh"}
$CK
keys %$CK > $self->{"max_cached_sth_per_dbh"}
Truth table0%0/3
A and B
A= $CKB= keys %$CK > $self->{"max_cached_sth_per_dbh"}
Truth table33%1/3
A and B
A= $CKB= keys %$CK > $self->{"max_cached_sth_per_dbh"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | %$CK = (); # clear all statement handles | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | #$dbh->trace(0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | $current_dbh = $dbh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | return $dbh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 6524 | ▶ | sub reset_dbh { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reset_dbh: called CC=1 SCAR=1.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | ▶ | my ($self, $dbh) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reset_dbh: not called CC=1 SCAR=1.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | $dbh->set_err(undef, undef); # clear any error state | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 6558 | ▶ | sub new_response_with_err { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new_response_with_err: called CC=9 SCAR=31.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | ▶ | my ($self, $rv, $eval_error, $dbh) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new_response_with_err: not called CC=9 SCAR=31.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | # this is the usual way to create a response for both success and failure | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | # capture err+errstr etc and merge in $eval_error ($@) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | my ($err, $errstr, $state) = ($DBI::err, $DBI::errstr, $DBI::state); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | ▶ | if ($eval_error) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | ▶ | $err ||= $DBI::stderr || 1; # ensure err is true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition30%3/10
$err ||= $DBI::stderr || 1
$DBI::stderr || 1
$err ||= $DBI::stderr || 1
$DBI::stderr || 1
MC/DC0%0/2
$err ||= $DBI::stderr || 1
$err
$DBI::stderr
MC/DC0%0/2
$err ||= $DBI::stderr || 1
$err
$DBI::stderr
Truth table0%0/3
A ||= B
A= $errB= $DBI::stderr
Truth table66%2/3
A ||= B
A= $errB= $DBI::stderr
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | ▶ | if ($errstr) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | ▶ | $eval_error =~ s/(?: : \s)? \Q$errstr//x if $errstr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | chomp $errstr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | $errstr .= "; $eval_error"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | $errstr = $eval_error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | ▶ | chomp $errstr if $errstr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | my $flags; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | # (XXX if we ever add transaction support then we'll need to take extra | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | # steps because the commit/rollback would reset Executed before we get here) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | ▶ | $flags |= GOf_RESPONSE_EXECUTED if $dbh && $dbh->{Executed}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition50%3/6
$dbh and $dbh->{"Executed"}
$dbh and $dbh->{"Executed"}
MC/DC0%0/2
$dbh and $dbh->{"Executed"}
$dbh
$dbh->{"Executed"}
MC/DC100%2/2
$dbh and $dbh->{"Executed"}
$dbh
$dbh->{"Executed"}
Truth table0%0/3
A and B
A= $dbhB= $dbh->{"Executed"}
Truth table100%3/3
A and B
A= $dbhB= $dbh->{"Executed"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | my $response = DBI::Gofer::Response->new({ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | rv => $rv, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | err => $err, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | errstr => $errstr, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | state => $state, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | flags => $flags, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | return $response; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 6558 | ▶ | sub execute_request { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
execute_request: called CC=11 SCAR=39.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | ▶ | my ($self, $request) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
execute_request: not called CC=11 SCAR=39.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | # should never throw an exception | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | DBI->trace_msg("-----> execute_request\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | my @warnings; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 22 | ▶ | local $SIG{__WARN__} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=10.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | ▶ | push @warnings, @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=10.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | ▶ | warn @_ if $local_log; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | my $response = eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | ▶ | if (my $check_request_sub = $self->check_request_sub) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | ▶ | $request = $check_request_sub->($request, $self) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | or die "check_request_sub failed"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | ▶ | my $version = $request->version || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition25%1/4
$request->version || 0
$request->version || 0
MC/DC0%0/1
$request->version || 0
$request->version
MC/DC0%0/1
$request->version || 0
$request->version
Truth table0%0/2
A
A= $request->version
Truth table50%1/2
A
A= $request->version
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | ▶ | die ref($request)." version $version is not supported" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition16%1/6
$version < "0.009116" or $version >= 1
$version < "0.009116" or $version >= 1
MC/DC0%0/2
$version < "0.009116" or $version >= 1
$version < "0.009116"
$version >= 1
MC/DC0%0/2
$version < "0.009116" or $version >= 1
$version < "0.009116"
$version >= 1
Truth table0%0/3
A or B
A= $version < "0.009116"B= $version >= 1
Truth table33%1/3
A or B
A= $version < "0.009116"B= $version >= 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | if $version < 0.009116 or $version >= 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | ▶ | ($request->is_sth_request) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | ? $self->execute_sth_request($request) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | : $self->execute_dbh_request($request); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | ▶ | $response ||= $self->new_response_with_err(undef, $@, $current_dbh); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition16%1/6
$response ||= $self->new_response_with_err(undef, $@, $DBI::Gofer::Execute::current_dbh)
$response ||= $self->new_response_with_err(undef, $@, $DBI::Gofer::Execute::current_dbh)
MC/DC0%0/2
$response ||= $self->new_response_with_err(undef, $@, $DBI::Gofer::Execute::current_dbh)
$response
$self->new_response_with_err(undef, $@, $DBI::Gofer::Execute::current_dbh)
MC/DC0%0/2
$response ||= $self->new_response_with_err(undef, $@, $DBI::Gofer::Execute::current_dbh)
$response
$self->new_response_with_err(undef, $@, $DBI::Gofer::Execute::current_dbh)
Truth table0%0/3
A ||= B
A= $responseB= $self->new_response_with_err(undef, $@, $DBI::Gofer::Execute::current_dbh)
Truth table33%1/3
A ||= B
A= $responseB= $self->new_response_with_err(undef, $@, $DBI::Gofer::Execute::current_dbh)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | ▶ | if (my $check_response_sub = $self->check_response_sub) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | # not protected with an eval so it can choose to throw an exception | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | my $new = $check_response_sub->($response, $self, $request); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | ▶ | $response = $new if ref $new; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | undef $current_dbh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | ▶ | $response->warnings(\@warnings) if @warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | DBI->trace_msg("<----- execute_request\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | return $response; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 3753 | ▶ | sub execute_dbh_request { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
execute_dbh_request: called CC=9 SCAR=32.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | ▶ | my ($self, $request) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
execute_dbh_request: not called CC=9 SCAR=32.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | my $stats = $self->{stats}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | my $dbh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | ▶ | my $rv_ref = eval { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
eval {
do {
$dbh = $self->_connect($request);
my $args = $request->dbh_method_call;
my $wantarray = shift @$args;
my $meth = shift @$args;
++$stats->{'method_calls_dbh'}{$meth};
my(@rv) = $wantarray ? $dbh->$meth(@$args) : scalar $dbh->$meth(@$args);
\@rv
}
} || []
eval {
do {
$dbh = $self->_connect($request);
my $args = $request->dbh_method_call;
my $wantarray = shift @$args;
my $meth = shift @$args;
++$stats->{'method_calls_dbh'}{$meth};
my(@rv) = $wantarray ? $dbh->$meth(@$args) : scalar $dbh->$meth(@$args);
\@rv
}
} || []
MC/DC0%0/1
eval {
do {
$dbh = $self->_connect($request);
my $args = $request->dbh_method_call;
my $wantarray = shift @$args;
my $meth = shift @$args;
++$stats->{'method_calls_dbh'}{$meth};
my(@rv) = $wantarray ? $dbh->$meth(@$args) : scalar $dbh->$meth(@$args);
\@rv
}
} || []
eval {
do {
$dbh = $self->_connect($request);
my $args = $request->dbh_method_call;
my $wantarray = shift @$args;
my $meth = shift @$args;
++$stats->{'method_calls_dbh'}{$meth};
my(@rv) = $wantarray ? $dbh->$meth(@$args) : scalar $dbh->$meth(@$args);
\@rv
}
}
MC/DC100%1/1
eval {
do {
$dbh = $self->_connect($request);
my $args = $request->dbh_method_call;
my $wantarray = shift @$args;
my $meth = shift @$args;
++$stats->{'method_calls_dbh'}{$meth};
my(@rv) = $wantarray ? $dbh->$meth(@$args) : scalar $dbh->$meth(@$args);
\@rv
}
} || []
eval {
do {
$dbh = $self->_connect($request);
my $args = $request->dbh_method_call;
my $wantarray = shift @$args;
my $meth = shift @$args;
++$stats->{'method_calls_dbh'}{$meth};
my(@rv) = $wantarray ? $dbh->$meth(@$args) : scalar $dbh->$meth(@$args);
\@rv
}
}
Truth table0%0/2
A
A= eval {
do {
$dbh = $self->_connect($request);
my $args = $request->dbh_method_call;
my $wantarray = shift @$args;
my $meth = shift @$args;
++$stats->{'method_calls_dbh'}{$meth};
my(@rv) = $wantarray ? $dbh->$meth(@$args) : scalar $dbh->$meth(@$args);
\@rv
}
}
Truth table100%2/2
A
A= eval {
do {
$dbh = $self->_connect($request);
my $args = $request->dbh_method_call;
my $wantarray = shift @$args;
my $meth = shift @$args;
++$stats->{'method_calls_dbh'}{$meth};
my(@rv) = $wantarray ? $dbh->$meth(@$args) : scalar $dbh->$meth(@$args);
\@rv
}
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | $dbh = $self->_connect($request); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | my $args = $request->dbh_method_call; # [ wantarray, 'method_name', @args ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | my $wantarray = shift @$args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | my $meth = shift @$args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | $stats->{method_calls_dbh}->{$meth}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | ▶ | my @rv = ($wantarray) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | ? $dbh->$meth(@$args) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | : scalar $dbh->$meth(@$args); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | \@rv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | } || []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | my $response = $self->new_response_with_err($rv_ref, $@, $dbh); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | ▶ | return $response if not $dbh; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | # does this request also want any dbh attributes returned? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | ▶ | if (my $dbh_attributes = $request->dbh_attributes) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | $response->dbh_attributes( $self->gather_dbh_attributes($dbh, $dbh_attributes) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | ▶ | if ($rv_ref and my $lid_args = $request->dbh_last_insert_id_args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition16%1/6
$rv_ref and my $lid_args = $request->dbh_last_insert_id_args
$rv_ref and my $lid_args = $request->dbh_last_insert_id_args
MC/DC0%0/2
$rv_ref and my $lid_args = $request->dbh_last_insert_id_args
$rv_ref
my $lid_args = $request->dbh_last_insert_id_args
MC/DC0%0/2
$rv_ref and my $lid_args = $request->dbh_last_insert_id_args
$rv_ref
my $lid_args = $request->dbh_last_insert_id_args
Truth table0%0/3
A and B
A= $rv_refB= my $lid_args = $request->dbh_last_insert_id_args
Truth table33%1/3
A and B
A= $rv_refB= my $lid_args = $request->dbh_last_insert_id_args
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | $stats->{method_calls_dbh}->{last_insert_id}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | my $id = $dbh->last_insert_id( @$lid_args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | $response->last_insert_id( $id ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | ▶ | if ($rv_ref and UNIVERSAL::isa($rv_ref->[0],'DBI::st')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%2/6
$rv_ref and UNIVERSAL::isa($rv_ref->[0], "DBI::st")
$rv_ref and UNIVERSAL::isa($rv_ref->[0], "DBI::st")
MC/DC0%0/2
$rv_ref and UNIVERSAL::isa($rv_ref->[0], "DBI::st")
$rv_ref
UNIVERSAL::isa($rv_ref->[0], "DBI::st")
MC/DC50%1/2
$rv_ref and UNIVERSAL::isa($rv_ref->[0], "DBI::st")
$rv_ref
UNIVERSAL::isa($rv_ref->[0], "DBI::st")
Truth table0%0/3
A and B
A= $rv_refB= UNIVERSAL::isa($rv_ref->[0], "DBI::st")
Truth table66%2/3
A and B
A= $rv_refB= UNIVERSAL::isa($rv_ref->[0], "DBI::st")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | # dbh_method_call was probably a metadata method like table_info | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | # that returns a statement handle, so turn the $sth into resultset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | my $sth = $rv_ref->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | $response->sth_resultsets( $self->gather_sth_resultsets($sth, $request, $response) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | $response->rv("(sth)"); # don't try to return actual sth | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | # we're finished with this dbh for this request | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | $self->reset_dbh($dbh); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | return $response; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 3524 | ▶ | sub gather_dbh_attributes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gather_dbh_attributes: called CC=2 SCAR=9.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | ▶ | my ($self, $dbh, $dbh_attributes) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gather_dbh_attributes: not called CC=2 SCAR=9.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | my @req_attr_names = @$dbh_attributes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | ▶ | if ($req_attr_names[0] eq '*') { # auto include std + private | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | shift @req_attr_names; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | push @req_attr_names, @{ $self->_std_response_attribute_names($dbh) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | my %dbh_attr_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | @dbh_attr_values{@req_attr_names} = $dbh->FETCH_many(@req_attr_names); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | # XXX piggyback installed_methods onto dbh_attributes for now | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | $dbh_attr_values{dbi_installed_methods} = { DBI->installed_methods }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | # XXX piggyback default_methods onto dbh_attributes for now | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | $dbh_attr_values{dbi_default_methods} = _get_default_methods($dbh); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | return \%dbh_attr_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 6283 | ▶ | sub _std_response_attribute_names { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_std_response_attribute_names: called CC=9 SCAR=32.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | ▶ | my ($self, $h) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_std_response_attribute_names: not called CC=9 SCAR=32.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | ▶ | $h = tied(%$h) || $h; # switch to inner handle | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition16%1/6
tied %$h || $h
tied %$h || $h
MC/DC0%0/2
tied %$h || $h
tied %$h
$h
MC/DC0%0/2
tied %$h || $h
tied %$h
$h
Truth table0%0/3
A || B
A= tied %$hB= $h
Truth table33%1/3
A || B
A= tied %$hB= $h
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | # cache the private_attribute_info data for each handle | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | # XXX might be better to cache it in the executor | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | # as it's unlikely to change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | # or perhaps at least cache it in the dbh even for sth | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | # as the sth are typically very short lived | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | my ($dbh, $h_type, $driver_name, @attr_names); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | ▶ | if ($dbh = $h->{Database}) { # is an sth | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | # does the dbh already have the answer cached? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | ▶ | return $dbh->{private_gofer_std_attr_names_sth} if $dbh->{private_gofer_std_attr_names_sth}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | ($h_type, $driver_name) = ('sth', $dbh->{Driver}{Name}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | push @attr_names, qw(NUM_OF_PARAMS NUM_OF_FIELDS NAME TYPE NULLABLE PRECISION SCALE); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | else { # is a dbh | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | ▶ | return $h->{private_gofer_std_attr_names_dbh} if $h->{private_gofer_std_attr_names_dbh}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 0 | ($h_type, $driver_name, $dbh) = ('dbh', $h->{Driver}{Name}, $h); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | # explicitly add these because drivers may have different defaults | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | # add Name so the client gets the real Name of the connection | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | push @attr_names, qw(ChopBlanks LongReadLen LongTruncOk ReadOnly Name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | ▶ | if (my $pai = $h->private_attribute_info) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 0 | push @attr_names, keys %$pai; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | ▶ | push @attr_names, @{ $extra_attr{ $driver_name }{$h_type} || []}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$extra_attr{$driver_name}{$h_type} || []
$extra_attr{$driver_name}{$h_type} || []
MC/DC0%0/1
$extra_attr{$driver_name}{$h_type} || []
$extra_attr{$driver_name}{$h_type}
MC/DC100%1/1
$extra_attr{$driver_name}{$h_type} || []
$extra_attr{$driver_name}{$h_type}
Truth table0%0/2
A
A= $extra_attr{$driver_name}{$h_type}
Truth table100%2/2
A
A= $extra_attr{$driver_name}{$h_type}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | ▶ | if (my $fra = $self->{forced_response_attributes}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | ▶ | push @attr_names, @{ $fra->{ $driver_name }{$h_type} || []} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
$fra->{$driver_name}{$h_type} || []
$fra->{$driver_name}{$h_type} || []
MC/DC0%0/1
$fra->{$driver_name}{$h_type} || []
$fra->{$driver_name}{$h_type}
MC/DC0%0/1
$fra->{$driver_name}{$h_type} || []
$fra->{$driver_name}{$h_type}
Truth table0%0/2
A
A= $fra->{$driver_name}{$h_type}
Truth table0%0/2
A
A= $fra->{$driver_name}{$h_type}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | $dbh->trace_msg("_std_response_attribute_names for $driver_name $h_type: @attr_names\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | # cache into the dbh even for sth, as the dbh is usually longer lived | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | return $dbh->{"private_gofer_std_attr_names_$h_type"} = \@attr_names; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 2805 | ▶ | sub execute_sth_request { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
execute_sth_request: called CC=11 SCAR=34.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | ▶ | my ($self, $request) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
execute_sth_request: not called CC=11 SCAR=34.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | my $dbh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | my $sth; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | my $last_insert_id; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | my $stats = $self->{stats}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | my $rv = eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | $dbh = $self->_connect($request); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | my $args = $request->dbh_method_call; # [ wantarray, 'method_name', @args ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 0 | shift @$args; # discard wantarray | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | my $meth = shift @$args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | $stats->{method_calls_sth}->{$meth}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | $sth = $dbh->$meth(@$args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | my $last = '(sth)'; # a true value (don't try to return actual sth) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | # execute methods on the sth, e.g., bind_param & execute | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | ▶ | if (my $calls = $request->sth_method_calls) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 0 | for my $meth_call (@$calls) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | my $method = shift @$meth_call; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 0 | $stats->{method_calls_sth}->{$method}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | $last = $sth->$method(@$meth_call); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | ▶ | if (my $lid_args = $request->dbh_last_insert_id_args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 0 | $stats->{method_calls_sth}->{last_insert_id}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | $last_insert_id = $dbh->last_insert_id( @$lid_args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | $last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | my $response = $self->new_response_with_err($rv, $@, $dbh); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | ▶ | return $response if not $dbh; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 0 | ▶ | $response->last_insert_id( $last_insert_id ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | if defined $last_insert_id; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | # even if the eval failed we still want to try to gather attribute values | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | # (XXX would be nice to be able to support streaming of results. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | # which would reduce memory usage and latency for large results) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | ▶ | if ($sth) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | $response->sth_resultsets( $self->gather_sth_resultsets($sth, $request, $response) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 0 | $sth->finish; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | # does this request also want any dbh attributes returned? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 0 | my $dbh_attr_set; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | ▶ | if (my $dbh_attributes = $request->dbh_attributes) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 0 | $dbh_attr_set = $self->gather_dbh_attributes($dbh, $dbh_attributes); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | # XXX needs to be integrated with private_attribute_info() etc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | ▶ | if (my $dbh_attr = $extra_attr{$dbh->{Driver}{Name}}{dbh_after_sth}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | @{$dbh_attr_set}{@$dbh_attr} = $dbh->FETCH_many(@$dbh_attr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | ▶ | $response->dbh_attributes($dbh_attr_set) if $dbh_attr_set && %$dbh_attr_set; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%2/6
$dbh_attr_set and %$dbh_attr_set
$dbh_attr_set and %$dbh_attr_set
MC/DC0%0/2
$dbh_attr_set and %$dbh_attr_set
$dbh_attr_set
%$dbh_attr_set
MC/DC50%1/2
$dbh_attr_set and %$dbh_attr_set
$dbh_attr_set
%$dbh_attr_set
Truth table0%0/3
A and B
A= $dbh_attr_setB= %$dbh_attr_set
Truth table66%2/3
A and B
A= $dbh_attr_setB= %$dbh_attr_set
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 0 | $self->reset_dbh($dbh); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 0 | return $response; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 2759 | ▶ | sub gather_sth_resultsets { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gather_sth_resultsets: called CC=11 SCAR=34.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | ▶ | my ($self, $sth, $request, $response) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gather_sth_resultsets: not called CC=11 SCAR=34.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | my $resultsets = eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | my $attr_names = $self->_std_response_attribute_names($sth); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | my $sth_attr = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | $sth_attr->{$_} = 1 for @$attr_names; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | # let the client add/remove sth attributes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 0 | ▶ | if (my $sth_result_attr = $request->sth_result_attr) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | $sth_attr->{$_} = $sth_result_attr->{$_} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | for keys %$sth_result_attr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 0 | my @sth_attr = grep { $sth_attr->{$_} } keys %$sth_attr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 0 | my $row_count = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 0 | my $rs_list = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 0 | while (1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 0 | my $rs = $self->fetch_result_set($sth, \@sth_attr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 0 | push @$rs_list, $rs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 0 | ▶ | if (my $rows = $rs->{rowset}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | $row_count += @$rows; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 0 | ▶ | last if $self->{forced_single_resultset}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | ▶ | last if !($sth->more_results || $sth->{syb_more_results}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition16%1/6
$sth->more_results or $sth->{"syb_more_results"}
$sth->more_results or $sth->{"syb_more_results"}
MC/DC0%0/2
$sth->more_results or $sth->{"syb_more_results"}
$sth->more_results
$sth->{"syb_more_results"}
MC/DC0%0/2
$sth->more_results or $sth->{"syb_more_results"}
$sth->more_results
$sth->{"syb_more_results"}
Truth table0%0/3
A or B
A= $sth->more_resultsB= $sth->{"syb_more_results"}
Truth table33%1/3
A or B
A= $sth->more_resultsB= $sth->{"syb_more_results"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 0 | my $stats = $self->{stats}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | $stats->{rows_returned_total} += $row_count; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | $stats->{rows_returned_max} = $row_count | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 0 | ▶ | if $row_count > ($stats->{rows_returned_max}||0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition50%2/4
$stats->{'rows_returned_max'} || 0
$stats->{'rows_returned_max'} || 0
MC/DC0%0/1
$stats->{'rows_returned_max'} || 0
$stats->{'rows_returned_max'}
MC/DC100%1/1
$stats->{'rows_returned_max'} || 0
$stats->{'rows_returned_max'}
Truth table0%0/2
A
A= $stats->{'rows_returned_max'}
Truth table100%2/2
A
A= $stats->{'rows_returned_max'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 0 | $rs_list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 0 | ▶ | $response->add_err(1, $@) if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | return $resultsets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 2759 | ▶ | sub fetch_result_set { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fetch_result_set: called CC=6 SCAR=24.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | ▶ | my ($self, $sth, $sth_attr) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fetch_result_set: not called CC=6 SCAR=24.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | my %meta; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | @meta{ @$sth_attr } = $sth->FETCH_many(@$sth_attr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | # we assume @$sth_attr contains NUM_OF_FIELDS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | $meta{rowset} = $sth->fetchall_arrayref() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 0 | ▶ | if (($meta{NUM_OF_FIELDS}||0) > 0); # is SELECT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition50%2/4
$meta{'NUM_OF_FIELDS'} || 0
$meta{'NUM_OF_FIELDS'} || 0
MC/DC0%0/1
$meta{'NUM_OF_FIELDS'} || 0
$meta{'NUM_OF_FIELDS'}
MC/DC100%1/1
$meta{'NUM_OF_FIELDS'} || 0
$meta{'NUM_OF_FIELDS'}
Truth table0%0/2
A
A= $meta{'NUM_OF_FIELDS'}
Truth table100%2/2
A
A= $meta{'NUM_OF_FIELDS'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | # the fetchall_arrayref may fail with a 'not executed' kind of error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | # because gather_sth_resultsets/fetch_result_set are called even if | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | # execute() failed, or even if there was no execute() call at all. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | # The corresponding error goes into the resultset err, not the top-level | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | # response err, so in most cases this resultset err is never noticed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 0 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | chomp $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 0 | ▶ | $meta{err} = $DBI::err || 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$DBI::err || 1
$DBI::err || 1
MC/DC0%0/1
$DBI::err || 1
$DBI::err
MC/DC100%1/1
$DBI::err || 1
$DBI::err
Truth table0%0/2
A
A= $DBI::err
Truth table100%2/2
A
A= $DBI::err
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | ▶ | $meta{errstr} = $DBI::errstr || $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
$DBI::errstr || $@
$DBI::errstr || $@
MC/DC0%0/2
$DBI::errstr || $@
$DBI::errstr
$@
MC/DC0%0/2
$DBI::errstr || $@
$DBI::errstr
$@
Truth table0%0/3
A || B
A= $DBI::errstrB= $@
Truth table66%2/3
A || B
A= $DBI::errstrB= $@
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | $meta{state} = $DBI::state; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 0 | return \%meta; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 3524 | ▶ | sub _get_default_methods { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_default_methods: called CC=6 SCAR=24.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | ▶ | my ($dbh) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_default_methods: not called CC=6 SCAR=24.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | # returns a ref to a hash of dbh method names for methods which the driver | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | # hasn't overridden i.e., quote(). These don't need to be forwarded via gofer. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | ▶ | my $ImplementorClass = $dbh->{ImplementorClass} or die; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 0 | my %default_methods; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 0 | for my $method (@all_dbh_methods) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | ▶ | my $dbi_sub = $all_dbh_methods{$method} || 42; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$DBI::Gofer::Execute::all_dbh_methods{$method} || 42
$DBI::Gofer::Execute::all_dbh_methods{$method} || 42
MC/DC0%0/1
$DBI::Gofer::Execute::all_dbh_methods{$method} || 42
$DBI::Gofer::Execute::all_dbh_methods{$method}
MC/DC100%1/1
$DBI::Gofer::Execute::all_dbh_methods{$method} || 42
$DBI::Gofer::Execute::all_dbh_methods{$method}
Truth table0%0/2
A
A= $DBI::Gofer::Execute::all_dbh_methods{$method}
Truth table100%2/2
A
A= $DBI::Gofer::Execute::all_dbh_methods{$method}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 0 | ▶ | my $imp_sub = $ImplementorClass->can($method) || 42; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$ImplementorClass->can($method) || 42
$ImplementorClass->can($method) || 42
MC/DC0%0/1
$ImplementorClass->can($method) || 42
$ImplementorClass->can($method)
MC/DC100%1/1
$ImplementorClass->can($method) || 42
$ImplementorClass->can($method)
Truth table0%0/2
A
A= $ImplementorClass->can($method)
Truth table100%2/2
A
A= $ImplementorClass->can($method)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 0 | ▶ | next if $imp_sub != $dbi_sub; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | #warn("default $method\n"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 0 | $default_methods{$method} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 0 | return \%default_methods; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | # XXX would be nice to make this a generic DBI module | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 2900 | ▶ | sub _install_rand_callbacks { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_install_rand_callbacks: called CC=16 SCAR=44.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 0 | ▶ | my ($self, $dbh, $dbi_gofer_random) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_install_rand_callbacks: not called CC=16 SCAR=44.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 0 | ▶ | my $callbacks = $dbh->{Callbacks} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$dbh->{'Callbacks'} || {}
$dbh->{'Callbacks'} || {}
MC/DC0%0/1
$dbh->{'Callbacks'} || {}
$dbh->{'Callbacks'}
MC/DC100%1/1
$dbh->{'Callbacks'} || {}
$dbh->{'Callbacks'}
Truth table0%0/2
A
A= $dbh->{'Callbacks'}
Truth table100%2/2
A
A= $dbh->{'Callbacks'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 0 | ▶ | my $prev = $dbh->{private_gofer_rand_fail_callbacks} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$dbh->{'private_gofer_rand_fail_callbacks'} || {}
$dbh->{'private_gofer_rand_fail_callbacks'} || {}
MC/DC0%0/1
$dbh->{'private_gofer_rand_fail_callbacks'} || {}
$dbh->{'private_gofer_rand_fail_callbacks'}
MC/DC100%1/1
$dbh->{'private_gofer_rand_fail_callbacks'} || {}
$dbh->{'private_gofer_rand_fail_callbacks'}
Truth table0%0/2
A
A= $dbh->{'private_gofer_rand_fail_callbacks'}
Truth table100%2/2
A
A= $dbh->{'private_gofer_rand_fail_callbacks'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | # return if we've already setup this handle with callbacks for these specs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 0 | ▶ | return if (($callbacks->{_dbi_gofer_random_spec}||'') eq $dbi_gofer_random); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition50%2/4
$callbacks->{'_dbi_gofer_random_spec'} || ''
$callbacks->{'_dbi_gofer_random_spec'} || ''
MC/DC0%0/1
$callbacks->{'_dbi_gofer_random_spec'} || ''
$callbacks->{'_dbi_gofer_random_spec'}
MC/DC100%1/1
$callbacks->{'_dbi_gofer_random_spec'} || ''
$callbacks->{'_dbi_gofer_random_spec'}
Truth table0%0/2
A
A= $callbacks->{'_dbi_gofer_random_spec'}
Truth table100%2/2
A
A= $callbacks->{'_dbi_gofer_random_spec'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | #warn "$dbh # $callbacks->{_dbi_gofer_random_spec}"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 0 | $callbacks->{_dbi_gofer_random_spec} = $dbi_gofer_random; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 0 | my ($fail_percent, $fail_err, $delay_percent, $delay_duration, %spec_part, @spec_note); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 0 | my @specs = split /,/, $dbi_gofer_random; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 0 | for my $spec (@specs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 0 | ▶ | if ($spec =~ m/^fail=(-?[.\d]+)%?$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 0 | $fail_percent = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 0 | $spec_part{fail} = $spec; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 0 | ▶ | if ($spec =~ m/^err=(-?\d+)$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 0 | $fail_err = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 0 | $spec_part{err} = $spec; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 0 | ▶ | if ($spec =~ m/^delay([.\d]+)=(-?[.\d]+)%?$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 0 | $delay_duration = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 0 | $delay_percent = $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | 0 | $spec_part{delay} = $spec; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | elsif ($spec !~ m/^(\w+|\*)$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | 0 | warn "Ignored DBI_GOFER_RANDOM item '$spec' which isn't a config or a dbh method name"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 0 | my $method = $spec; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 0 | ▶ | if ($callbacks->{$method} && $prev->{$method} && $callbacks->{$method} != $prev->{$method}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition16%2/12
$callbacks->{$method} and $prev->{$method} and $callbacks->{$method} != $prev->{$method}
$callbacks->{$method} and $prev->{$method}
$callbacks->{$method} and $prev->{$method} and $callbacks->{$method} != $prev->{$method}
$callbacks->{$method} and $prev->{$method}
MC/DC0%0/3
$callbacks->{$method} and $prev->{$method} and $callbacks->{$method} != $prev->{$method}
$callbacks->{$method}
$prev->{$method}
$callbacks->{$method} != $prev->{$method}
MC/DC0%0/3
$callbacks->{$method} and $prev->{$method} and $callbacks->{$method} != $prev->{$method}
$callbacks->{$method}
$prev->{$method}
$callbacks->{$method} != $prev->{$method}
Truth table0%0/4
A and B and C
A= $callbacks->{$method}B= $prev->{$method}C= $callbacks->{$method} != $prev->{$method}
Truth table25%1/4
A and B and C
A= $callbacks->{$method}B= $prev->{$method}C= $callbacks->{$method} != $prev->{$method}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 0 | warn "Callback for $method method already installed so DBI_GOFER_RANDOM callback not installed\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 0 | ▶ | unless (defined $fail_percent or defined $delay_percent) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%2/6
defined $fail_percent or defined $delay_percent
defined $fail_percent or defined $delay_percent
MC/DC0%0/2
defined $fail_percent or defined $delay_percent
defined $fail_percent
defined $delay_percent
MC/DC0%0/2
defined $fail_percent or defined $delay_percent
defined $fail_percent
defined $delay_percent
Truth table0%0/3
A or B
A= defined $fail_percentB= defined $delay_percent
Truth table66%2/3
A or B
A= defined $fail_percentB= defined $delay_percent
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 0 | warn "Ignored DBI_GOFER_RANDOM item '$spec' because not preceded by 'fail=N' and/or 'delayN=N'"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 0 | push @spec_note, join(",", values(%spec_part), $method); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 0 | $callbacks->{$method} = $self->_mk_rand_callback($method, $fail_percent, $delay_percent, $delay_duration, $fail_err); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 0 | ▶ | warn "DBI_GOFER_RANDOM failures/delays enabled: @spec_note\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | if @spec_note; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 0 | $dbh->{Callbacks} = $callbacks; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 0 | $dbh->{private_gofer_rand_fail_callbacks} = $callbacks; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | my %_mk_rand_callback_seqn; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 7 | ▶ | sub _mk_rand_callback { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mk_rand_callback: called CC=5 SCAR=22.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 0 | ▶ | my ($self, $method, $fail_percent, $delay_percent, $delay_duration, $fail_err) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mk_rand_callback: not called CC=5 SCAR=22.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 0 | my ($fail_modrate, $delay_modrate); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 0 | ▶ | $fail_percent ||= 0; $fail_modrate = int(1/(-$fail_percent )*100) if $fail_percent; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition50%2/4
$fail_percent ||= 0
$fail_percent ||= 0
MC/DC0%0/1
$fail_percent ||= 0
$fail_percent
MC/DC100%1/1
$fail_percent ||= 0
$fail_percent
Truth table0%0/2
A
A= $fail_percent
Truth table100%2/2
A
A= $fail_percent
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | 0 | ▶ | $delay_percent ||= 0; $delay_modrate = int(1/(-$delay_percent)*100) if $delay_percent; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition50%2/4
$delay_percent ||= 0
$delay_percent ||= 0
MC/DC0%0/1
$delay_percent ||= 0
$delay_percent
MC/DC100%1/1
$delay_percent ||= 0
$delay_percent
Truth table0%0/2
A
A= $delay_percent
Truth table100%2/2
A
A= $delay_percent
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | # note that $method may be "*" but that's not recommended or documented or wise | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 2900 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=9 SCAR=31.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 0 | ▶ | my ($h) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=9 SCAR=31.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | 0 | my $seqn = ++$_mk_rand_callback_seqn{$method}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 0 | ▶ | my $delay = ($delay_percent > 0) ? rand(100) < $delay_percent : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | ($delay_percent < 0) ? !($seqn % $delay_modrate): 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 0 | ▶ | my $fail = ($fail_percent > 0) ? rand(100) < $fail_percent : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | ($fail_percent < 0) ? !($seqn % $fail_modrate) : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | #no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | #warn "_mk_rand_callback($fail_percent:$fail_modrate, $delay_percent:$delay_modrate): seqn=$seqn fail=$fail delay=$delay"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | 0 | ▶ | if ($delay) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 0 | my $msg = "DBI_GOFER_RANDOM delaying execution of $method() by $delay_duration seconds\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | # Note what's happening in a trace message. If the delay percent is an even | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | # number then use warn() instead so it's sent back to the client. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 0 | ▶ | ($delay_percent % 2 == 1) ? warn($msg) : $h->trace_msg($msg); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 0 | select undef, undef, undef, $delay_duration; # allows floating point value | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 0 | ▶ | if ($fail) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | 0 | undef $_; # tell DBI to not call the method | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | # the "induced by DBI_GOFER_RANDOM" is special and must be included in errstr | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | # as it's checked for in a few places, such as the gofer retry logic | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 0 | ▶ | return $h->set_err($fail_err || $DBI::stderr, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition16%1/6
$fail_err || $DBI::stderr
$fail_err || $DBI::stderr
MC/DC0%0/2
$fail_err || $DBI::stderr
$fail_err
$DBI::stderr
MC/DC0%0/2
$fail_err || $DBI::stderr
$fail_err
$DBI::stderr
Truth table0%0/3
A || B
A= $fail_errB= $DBI::stderr
Truth table33%1/3
A || B
A= $fail_errB= $DBI::stderr
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | "fake error from $method method induced by DBI_GOFER_RANDOM env var ($fail_percent%)"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | 0 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 0 | ▶ | sub update_stats { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
update_stats: not called CC=19 SCAR=59.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | 0 | ▶ | my ($self, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
update_stats: not called CC=19 SCAR=59.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | $request, $response, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | $frozen_request, $frozen_response, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | $time_received, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | $store_meta, $other_meta, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | # should always have a response object here | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 0 | ▶ | carp("No response object provided") unless $request; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 0 | my $stats = $self->{stats}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | $stats->{frozen_request_max_bytes} = length($frozen_request) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | if $frozen_request | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 0 | ▶ | && length($frozen_request) > ($stats->{frozen_request_max_bytes}||0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/10
$frozen_request and length $frozen_request > ($stats->{"frozen_request_max_bytes"} || 0)
$stats->{'frozen_request_max_bytes'} || 0
$frozen_request and length $frozen_request > ($stats->{"frozen_request_max_bytes"} || 0)
$stats->{'frozen_request_max_bytes'} || 0
MC/DC0%0/2
$frozen_request and length $frozen_request > ($stats->{"frozen_request_max_bytes"} || 0)
$frozen_request
length $frozen_request > ($stats->{"frozen_request_max_bytes"} || 0)
MC/DC0%0/1
$stats->{'frozen_request_max_bytes'} || 0
$stats->{'frozen_request_max_bytes'}
MC/DC0%0/2
$frozen_request and length $frozen_request > ($stats->{"frozen_request_max_bytes"} || 0)
$frozen_request
length $frozen_request > ($stats->{"frozen_request_max_bytes"} || 0)
MC/DC0%0/1
$stats->{'frozen_request_max_bytes'} || 0
$stats->{'frozen_request_max_bytes'}
Truth table0%0/3
A and B
A= $frozen_requestB= length $frozen_request > ($stats->{"frozen_request_max_bytes"} || 0)
Truth table0%0/2
A
A= $stats->{'frozen_request_max_bytes'}
Truth table0%0/3
A and B
A= $frozen_requestB= length $frozen_request > ($stats->{"frozen_request_max_bytes"} || 0)
Truth table0%0/2
A
A= $stats->{'frozen_request_max_bytes'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | $stats->{frozen_response_max_bytes} = length($frozen_response) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | if $frozen_response | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 0 | ▶ | && length($frozen_response) > ($stats->{frozen_response_max_bytes}||0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/10
$frozen_response and length $frozen_response > ($stats->{"frozen_response_max_bytes"} || 0)
$stats->{'frozen_response_max_bytes'} || 0
$frozen_response and length $frozen_response > ($stats->{"frozen_response_max_bytes"} || 0)
$stats->{'frozen_response_max_bytes'} || 0
MC/DC0%0/2
$frozen_response and length $frozen_response > ($stats->{"frozen_response_max_bytes"} || 0)
$frozen_response
length $frozen_response > ($stats->{"frozen_response_max_bytes"} || 0)
MC/DC0%0/1
$stats->{'frozen_response_max_bytes'} || 0
$stats->{'frozen_response_max_bytes'}
MC/DC0%0/2
$frozen_response and length $frozen_response > ($stats->{"frozen_response_max_bytes"} || 0)
$frozen_response
length $frozen_response > ($stats->{"frozen_response_max_bytes"} || 0)
MC/DC0%0/1
$stats->{'frozen_response_max_bytes'} || 0
$stats->{'frozen_response_max_bytes'}
Truth table0%0/3
A and B
A= $frozen_responseB= length $frozen_response > ($stats->{"frozen_response_max_bytes"} || 0)
Truth table0%0/2
A
A= $stats->{'frozen_response_max_bytes'}
Truth table0%0/3
A and B
A= $frozen_responseB= length $frozen_response > ($stats->{"frozen_response_max_bytes"} || 0)
Truth table0%0/2
A
A= $stats->{'frozen_response_max_bytes'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 0 | my $recent; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 0 | ▶ | if (my $track_recent = $self->{track_recent}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | 0 | ▶ | $recent = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | request => $frozen_request, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | response => $frozen_response, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | time_received => $time_received, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | duration => dbi_time()-$time_received, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | # for any other info | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | ($store_meta) ? (meta => $store_meta) : (), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 0 | ▶ | $recent->{request_object} = $request | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/6
not $frozen_request and $request
not $frozen_request and $request
MC/DC0%0/2
not $frozen_request and $request
not $frozen_request
$request
MC/DC0%0/2
not $frozen_request and $request
not $frozen_request
$request
Truth table0%0/3
not(A) and B
A= not $frozen_requestB= $request
Truth table0%0/3
not(A) and B
A= not $frozen_requestB= $request
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | if !$frozen_request && $request; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | 0 | ▶ | $recent->{response_object} = $response | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | if !$frozen_response; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | 0 | ▶ | my @queues = ($stats->{recent_requests} ||= []); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
$stats->{"recent_requests"} ||= []
$stats->{"recent_requests"} ||= []
MC/DC0%0/1
$stats->{"recent_requests"} ||= []
$stats->{"recent_requests"}
MC/DC0%0/1
$stats->{"recent_requests"} ||= []
$stats->{"recent_requests"}
Truth table0%0/2
A
A= $stats->{"recent_requests"}
Truth table0%0/2
A
A= $stats->{"recent_requests"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | 0 | ▶ | push @queues, ($stats->{recent_errors} ||= []) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/10
not $response or $response->err
$stats->{"recent_errors"} ||= []
not $response or $response->err
$stats->{"recent_errors"} ||= []
MC/DC0%0/2
not $response or $response->err
not $response
$response->err
MC/DC0%0/1
$stats->{"recent_errors"} ||= []
$stats->{"recent_errors"}
MC/DC0%0/2
not $response or $response->err
not $response
$response->err
MC/DC0%0/1
$stats->{"recent_errors"} ||= []
$stats->{"recent_errors"}
Truth table0%0/3
not(A) or B
A= not $responseB= $response->err
Truth table0%0/2
A
A= $stats->{"recent_errors"}
Truth table0%0/3
not(A) or B
A= not $responseB= $response->err
Truth table0%0/2
A
A= $stats->{"recent_errors"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | if !$response or $response->err; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 0 | for my $queue (@queues) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 0 | push @$queue, $recent; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 0 | ▶ | shift @$queue if @$queue > $track_recent; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 0 | return $recent; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||