| 1 | package DBI::Gofer::Request; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # $Id: Request.pm 12536 2009-02-24 22:37:09Z Tim $ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 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 DBI qw(neat neat_list); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 63 | ▶ | use base qw(DBI::Util::_accessor); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | our $VERSION = "0.012537"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 63 | ▶ | use constant GOf_REQUEST_IDEMPOTENT => 0x0001; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 63 | ▶ | use constant GOf_REQUEST_READONLY => 0x0002; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | our @EXPORT = qw(GOf_REQUEST_IDEMPOTENT GOf_REQUEST_READONLY); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | __PACKAGE__->mk_accessors(qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | version | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | flags | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | dbh_connect_call | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | dbh_method_call | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | dbh_attributes | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | dbh_last_insert_id_args | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | sth_method_calls | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | sth_result_attr | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | )); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | __PACKAGE__->mk_accessors_using(make_accessor_autoviv_hashref => qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | meta | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | )); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 746 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=11.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | ▶ | my ($self, $args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=11.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | ▶ | $args->{version} ||= $VERSION; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition16%1/6
$args->{"version"} ||= $VERSION
$args->{"version"} ||= $DBI::Gofer::Request::VERSION
MC/DC0%0/2
$args->{"version"} ||= $VERSION
$args->{"version"}
$VERSION
MC/DC0%0/2
$args->{"version"} ||= $DBI::Gofer::Request::VERSION
$args->{"version"}
$DBI::Gofer::Request::VERSION
Truth table0%0/3
A ||= B
A= $args->{"version"}B= $VERSION
Truth table33%1/3
A ||= B
A= $args->{"version"}B= $DBI::Gofer::Request::VERSION
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | return $self->SUPER::new($args); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 7242 | ▶ | sub reset { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reset: called CC=2 SCAR=9.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | my ($self, $flags) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reset: not called CC=2 SCAR=9.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | # remove everything except connect and version | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | %$self = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | version => $self->{version}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | dbh_connect_call => $self->{dbh_connect_call}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | ▶ | $self->{flags} = $flags if $flags; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 7242 | ▶ | sub init_request { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_request: called CC=2 SCAR=9.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | my ($self, $method_and_args, $dbh) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_request: not called CC=2 SCAR=9.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | $self->reset( $dbh->{ReadOnly} ? GOf_REQUEST_READONLY : 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | $self->dbh_method_call($method_and_args); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 6558 | ▶ | sub is_sth_request { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_sth_request: called CC=1 SCAR=1.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | return shift->{sth_result_attr}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_sth_request: not called CC=1 SCAR=1.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 344 | ▶ | sub statements { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
statements: called CC=4 SCAR=19.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
statements: not called CC=4 SCAR=19.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | my @statements; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | if (my $dbh_method_call = $self->dbh_method_call) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | my $statement_method_regex = qr/^(?:do|prepare)$/; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | my (undef, $method, $arg1) = @$dbh_method_call; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | push @statements, $arg1 if $method && $method =~ $statement_method_regex; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%2/6
$method and $method =~ /$statement_method_regex/
$method and $method =~ /$statement_method_regex/
MC/DC0%0/2
$method and $method =~ /$statement_method_regex/
$method
$method =~ /$statement_method_regex/
MC/DC50%1/2
$method and $method =~ /$statement_method_regex/
$method
$method =~ /$statement_method_regex/
Truth table0%0/3
A and B
A= $methodB= $method =~ /$statement_method_regex/
Truth table66%2/3
A and B
A= $methodB= $method =~ /$statement_method_regex/
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | return @statements; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 434 | ▶ | sub is_idempotent { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_idempotent: called CC=5 SCAR=22.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_idempotent: not called CC=5 SCAR=22.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | if (my $flags = $self->flags) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | return 1 if $flags & (GOf_REQUEST_IDEMPOTENT|GOf_REQUEST_READONLY); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | # else check if all statements are SELECT statement that don't include FOR UPDATE | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | my @statements = $self->statements; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | # XXX this is very minimal for now, doesn't even allow comments before the select | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | # (and can't ever work for "exec stored_procedure_name" kinds of statements) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | # XXX it also doesn't deal with multiple statements: prepare("select foo; update bar") | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | return 1 if @statements == grep { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | ▶ | m/^ \s* SELECT \b /xmsi && !m/ \b FOR \s+ UPDATE \b /xmsi | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%2/6
/^ \s* SELECT \b /imsx && !/ \b FOR \s+ UPDATE \b /imsx
/^ \s* SELECT \b /imsx && !/ \b FOR \s+ UPDATE \b /imsx
MC/DC0%0/2
/^ \s* SELECT \b /imsx && !/ \b FOR \s+ UPDATE \b /imsx
/^ \s* SELECT \b /imsx
!/ \b FOR \s+ UPDATE \b /imsx
MC/DC50%1/2
/^ \s* SELECT \b /imsx && !/ \b FOR \s+ UPDATE \b /imsx
/^ \s* SELECT \b /imsx
!/ \b FOR \s+ UPDATE \b /imsx
Truth table0%0/3
A && not(B)
A= /^ \s* SELECT \b /imsxB= !/ \b FOR \s+ UPDATE \b /imsx
Truth table66%2/3
A && not(B)
A= /^ \s* SELECT \b /imsxB= !/ \b FOR \s+ UPDATE \b /imsx
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | } @statements; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | ▶ | sub summary_as_text { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
summary_as_text: not called CC=16 SCAR=56.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
summary_as_text: not called CC=16 SCAR=56.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | my ($context) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | my @s = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | ▶ | if ($context && %$context) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/6
$context and %$context
$context and %$context
MC/DC0%0/2
$context and %$context
$context
%$context
MC/DC0%0/2
$context and %$context
$context
%$context
Truth table0%0/3
A and B
A= $contextB= %$context
Truth table0%0/3
A and B
A= $contextB= %$context
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | my @keys = sort keys %$context; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | push @s, join(", ", map { "$_=>".$context->{$_} } @keys); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | my ($method, $dsn, $user, $pass, $attr) = @{ $self->dbh_connect_call }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | ▶ | $method ||= 'connect_cached'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
$method ||= "connect_cached"
$method ||= "connect_cached"
MC/DC0%0/1
$method ||= "connect_cached"
$method
MC/DC0%0/1
$method ||= "connect_cached"
$method
Truth table0%0/2
A
A= $method
Truth table0%0/2
A
A= $method
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | $pass = '***' if defined $pass; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | my $tmp = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | ▶ | if ($attr) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | ▶ | $tmp = { %{$attr||{}} }; # copy so we can edit | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
$attr || {}
$attr || {}
MC/DC0%0/1
$attr || {}
$attr
MC/DC0%0/1
$attr || {}
$attr
Truth table0%0/2
A
A= $attr
Truth table0%0/2
A
A= $attr
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | ▶ | $tmp->{Password} = '***' if exists $tmp->{Password}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | $tmp = "{ ".neat_list([ %$tmp ])." }"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | push @s, sprintf "dbh= $method(%s, %s)", neat_list([$dsn, $user, $pass]), $tmp; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | ▶ | if (my $flags = $self->flags) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | push @s, sprintf "flags: 0x%x", $flags; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | if (my $dbh_attr = $self->dbh_attributes) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | ▶ | push @s, sprintf "dbh->FETCH: %s", @$dbh_attr | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | if @$dbh_attr; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | my ($wantarray, $meth, @args) = @{ $self->dbh_method_call }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | my $args = neat_list(\@args); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | $args =~ s/\n+/ /g; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | push @s, sprintf "dbh->%s(%s)", $meth, $args; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | ▶ | if (my $lii_args = $self->dbh_last_insert_id_args) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | push @s, sprintf "dbh->last_insert_id(%s)", neat_list($lii_args); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | ▶ | for my $call (@{ $self->sth_method_calls || [] }) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
$self->sth_method_calls || []
$self->sth_method_calls || []
MC/DC0%0/1
$self->sth_method_calls || []
$self->sth_method_calls
MC/DC0%0/1
$self->sth_method_calls || []
$self->sth_method_calls
Truth table0%0/2
A
A= $self->sth_method_calls
Truth table0%0/2
A
A= $self->sth_method_calls
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | my ($meth, @args) = @$call; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | ($args = neat_list(\@args)) =~ s/\n+/ /g; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | push @s, sprintf "sth->%s(%s)", $meth, $args; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | ▶ | if (my $sth_attr = $self->sth_result_attr) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | push @s, sprintf "sth->FETCH: %s", %$sth_attr | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | if %$sth_attr; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | return join("\n\t", @s) . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | ▶ | sub outline_as_text { # one-line version of summary_as_text | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
outline_as_text: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
outline_as_text: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | my @s = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | my $neatlen = 80; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | if (my $flags = $self->flags) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | push @s, sprintf "flags=0x%x", $flags; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | my (undef, $meth, @args) = @{ $self->dbh_method_call }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | push @s, sprintf "%s(%s)", $meth, neat_list(\@args, $neatlen); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | ▶ | for my $call (@{ $self->sth_method_calls || [] }) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
$self->sth_method_calls || []
$self->sth_method_calls || []
MC/DC0%0/1
$self->sth_method_calls || []
$self->sth_method_calls
MC/DC0%0/1
$self->sth_method_calls || []
$self->sth_method_calls
Truth table0%0/2
A
A= $self->sth_method_calls
Truth table0%0/2
A
A= $self->sth_method_calls
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | my ($meth, @args) = @$call; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | push @s, sprintf "%s(%s)", $meth, neat_list(\@args, $neatlen); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | my ($method, $dsn) = @{ $self->dbh_connect_call }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | push @s, "$method($dsn,...)"; # dsn last as it's usually less interesting | |||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | (my $outline = join("; ", @s)) =~ s/\s+/ /g; # squish whitespace, incl newlines | |||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | return $outline; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | DBI::Gofer::Request - Encapsulate a request from DBD::Gofer to DBI::Gofer::Execute | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | This is an internal class. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | Tim Bunce, L<http://www.tim.bunce.name> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | =head1 LICENCE AND COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | Copyright (c) 2007, Tim Bunce, Ireland. All rights reserved. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | This module is free software; you can redistribute it and/or | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | modify it under the same terms as Perl itself. See L<perlartistic>. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||