Model/Driver.pm

filter: Statementstmt 50.0% 23 / 46 Branchbran 12.5% 2 / 16 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 21.4% 6 / 28 Podpod 0.0% 0 / 20 totaltotal 27.8% 32 / 115 CC 11 SCAR 18.8
CC
11
Cov
40%
cache_key
30.0
__ANON__
12.0
_set_auto_increment
6.3
CRAP 6.5
« Model/Transaction.pm ↑ Summary Model/Driver/DBI/DBD/SQLite.pm »
1 package Data::Model::Driver;
2 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 3 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 $Carp::Internal{(__PACKAGE__)}++;
7  
8 4 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
9 4 my($class, %args) = @_;
10 4 my $self = bless { %args }, shift;
11 4 $self->init;
12 4 $self;
13 }
14  
15 0 ▶sub init {}
Subroutine init: not called CC=1 SCAR=0.0
Pod undocumented
16 1 ▶sub attach_model {}
Subroutine attach_model: called CC=1 SCAR=0.0
Pod undocumented
17 0 ▶sub detach_model {}
Subroutine detach_model: not called CC=1 SCAR=0.0
Pod undocumented
18  
19 0 ▶sub cache_key_prefix { shift->{cache_key_prefix} }
Subroutine cache_key_prefix: not called CC=1 SCAR=6.9
Pod undocumented
20  
21 0 ▶sub cache_key {
Subroutine cache_key: not called CC=5 SCAR=34.0
Pod undocumented
22 0 my($self, $schema, $id) = @_;
23  
24 Carp::confess 'The number of key is wrong'
25 0 ▶ unless scalar(@{ $id }) == scalar(@{ $schema->key });
Branch: 1 branch
BranchTrueFalseTotal
unless scalar @{$id;} == scalar @{$schema->key;} 0 0 0
26  
27 join(':',
28 ($self->cache_key_prefix ? $self->cache_key_prefix : ()),
29 0 ▶ ($schema->options->{model_name_realname} ? $schema->options->{model_name_realname} : $schema->model),
Branch: 3 branches
BranchTrueFalseTotal
$self->cache_key_prefix ? : 0 0 0
$schema->options->{'model_name_realname'} ? : 0 0 0
ref $id eq 'ARRAY' ? : 0 0 0
30 (ref($id) eq 'ARRAY' ? @$id : $id)
31 );
32 }
33  
34  
35 3 my $KEYSEPARATE = "\0";
36 0 ▶sub _generate_key_data {
Subroutine _generate_key_data: not called CC=1 SCAR=6.9
37 0 my($self, $key_array) = @_;
38 0 join $KEYSEPARATE, @{ $key_array };
39 }
40  
41 0 ▶sub _generate_result_iterator {
Subroutine _generate_result_iterator: not called CC=1 SCAR=6.9
42 0 my($self, $results) = @_;
43  
44 0 my $count = 0;
45 0 my $max = scalar @{ $results };
46 0 ▶ sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
47 0 my $reset = shift;
48 0 ▶ $count = 0 if $reset;
Branch: 1 branch
BranchTrueFalseTotal
if $reset 0 0 0
49 0 ▶ return unless $count < $max;
Branch: 1 branch
BranchTrueFalseTotal
unless $count < $max 0 0 0
50 0 $results->[$count++];
51 0 };
52 }
53  
54 2 ▶sub _set_auto_increment {
Subroutine _set_auto_increment: called CC=5 SCAR=18.4
55 2 my($self, $schema, $columns, $code) = @_;
56 2 my $count = 0;
57 2 ▶ if (my @keys = @{ $schema->key }) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@keys) = @{$schema->key;}) 2 0 2
58 2 for my $column (@keys) {
59 2 ▶ if (exists $schema->column_options($column)->{auto_increment} &&
Branch: 1 branch
BranchTrueFalseTotal
if (exists $schema->column_options($column)->{"auto_increment"} and $schema->column_options($column)->{"auto_increment"}) 0 2 2
Condition33%1/3
exists $schema->column_options($column)->{"auto_increment"} and $schema->column_options($column)->{"auto_increment"}
!ll&&!rl&&r
200
MC/DC0%0/2
exists $schema->column_options($column)->{"auto_increment"} and $schema->column_options($column)->{"auto_increment"}
exists $schema->column_options($column)->{"auto_increment"} $schema->column_options($column)->{"auto_increment"}
Truth table33%1/3
A and B
A= exists $schema->column_options($column)->{"auto_increment"}B= $schema->column_options($column)->{"auto_increment"}
ABresult
0X0
100
111
60 $schema->column_options($column)->{auto_increment}) {
61 0 $columns->{$column} = $code->();
62 0 $count++;
63 }
64 }
65 }
66 2 $count;
67 }
68  
69 0 ▶sub _as_sql_hook {}
Subroutine _as_sql_hook: not called CC=1 SCAR=0.0
70  
71 0 ▶sub lookup {}
Subroutine lookup: not called CC=1 SCAR=0.0
Pod undocumented
72 0 ▶sub lookup_multi {}
Subroutine lookup_multi: not called CC=1 SCAR=0.0
Pod undocumented
73 0 ▶sub get {}
Subroutine get: not called CC=1 SCAR=0.0
Pod undocumented
74 0 ▶sub set {}
Subroutine set: not called CC=1 SCAR=0.0
Pod undocumented
75 0 ▶sub delete {}
Subroutine delete: not called CC=1 SCAR=0.0
Pod undocumented
76 0 ▶sub update {}
Subroutine update: not called CC=1 SCAR=0.0
Pod undocumented
77 0 ▶sub replace {}
Subroutine replace: not called CC=1 SCAR=0.0
Pod undocumented
78  
79 0 ▶sub get_multi {}
Subroutine get_multi: not called CC=1 SCAR=0.0
Pod undocumented
80 0 ▶sub set_multi {}
Subroutine set_multi: not called CC=1 SCAR=0.0
Pod undocumented
81 0 ▶sub delete_multi {}
Subroutine delete_multi: not called CC=1 SCAR=0.0
Pod undocumented
82  
83 0 ▶sub txn_begin { Carp::croak 'not transaction support' }
Subroutine txn_begin: not called CC=1 SCAR=6.9
Pod undocumented
84 0 ▶sub txn_rollback { Carp::croak 'not transaction support' }
Subroutine txn_rollback: not called CC=1 SCAR=6.9
Pod undocumented
85 0 ▶sub txn_commit { Carp::croak 'not transaction support' }
Subroutine txn_commit: not called CC=1 SCAR=6.9
Pod undocumented
86 0 ▶sub txn_end {}
Subroutine txn_end: not called CC=1 SCAR=0.0
Pod undocumented
87  
88 3 1;
« Model/Transaction.pm ↑ Summary Model/Driver/DBI/DBD/SQLite.pm »