Alzabo/Index.pm

filter: Statementstmt 41.1% 14 / 34 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 36.3% 4 / 11 Podpod 100% 7 / 7 totaltotal 39.6% 25 / 63 CC 6 SCAR 19.8
CC
6
Cov
33%
id
20.0
columns
6.0
prefix
6.0
CRAP 7.2
« Alzabo/Driver/PostgreSQL.pm ↑ Summary Alzabo/Runtime/UniqueRowCache.pm »
1 package Alzabo::Index;
2  
3 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 11 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 11 ▶use Alzabo;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 11 ▶use Tie::IxHash;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 11 $VERSION = 2.0;
11  
12 11 1;
13  
14 sub columns
15 0 ▶{
Subroutine columns: not called CC=2 SCAR=17.9
Pod documented
16 0 my $self = shift;
17  
18 0 my @c;
19 0 foreach my $c ($self->{columns}->Keys)
20 {
21 0 push @c, ($self->{columns}->FETCH($c))->{column};
22 }
23  
24 0 return @c;
25 }
26  
27 sub prefix
28 0 ▶{
Subroutine prefix: not called CC=2 SCAR=17.9
Pod documented
29 0 my $self = shift;
30 0 my $c = shift;
31  
32 Alzabo::Exception::Params->throw( error => "Column " . $c->name . " is not part of index." )
33 0 ▶ unless $self->{columns}->EXISTS( $c->name );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"columns"}->EXISTS($c->name) 0 0 0
34  
35 0 return ($self->{columns}->FETCH( $c->name ))->{prefix};
36 }
37  
38 0 ▶sub unique { $_[0]->{unique} }
Subroutine unique: not called CC=1 SCAR=6.9
Pod documented
39  
40 0 ▶sub fulltext { $_[0]->{fulltext} }
Subroutine fulltext: not called CC=1 SCAR=6.9
Pod documented
41  
42 0 ▶sub function { $_[0]->{function} }
Subroutine function: not called CC=1 SCAR=6.9
Pod documented
43  
44 sub id
45 0 ▶{
Subroutine id: not called CC=4 SCAR=30.0
Pod documented
46 0 my $self = shift;
47  
48 0 my $function;
49  
50 0 ▶ if ( defined $self->function )
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->function) 0 0 0
51 {
52 0 ($function) = $self->function =~ /^(\w+)/;
53 }
54  
55 return join '___', ( $self->{table}->name,
56 # making this change would break schemas when the user tries to
57 # delete/drop the index. save for later, maybe?
58  
59 # ( $self->unique ? 'U' : () ),
60 # ( $self->fulltext ? 'F' : () ),
61 ( $function ? $function : () ),
62 0 ▶ ( map { $_->name, $self->prefix($_) || () }
Branch: 1 branch
BranchTrueFalseTotal
$function ? : 0 0 0
Condition0%0/3
$self->prefix($_) || ()
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->prefix($_) || ()
$self->prefix($_) ()
Truth table0%0/3
A || B
A= $self->prefix($_)B= ()
ABresult
1X1
011
000
63 $self->columns ),
64 );
65 }
66  
67 sub table
68 0 ▶{
Subroutine table: not called CC=1 SCAR=6.9
Pod documented
69 0 my $self = shift;
70  
71 0 return $self->{table};
72 }
73  
74 __END__
« Alzabo/Driver/PostgreSQL.pm ↑ Summary Alzabo/Runtime/UniqueRowCache.pm »