blib/lib/DBIO/PostgreSQL/PgSchema.pm

filter: Statementstmt 70.5% 36 / 51 Branchbran 25.0% 3 / 12 Conditioncond 55.5% 15 / 27 MC/DCmcdc 20.0% 3 / 15 Subroutinesub 76.9% 10 / 13 Podpod 100% 8 / 8 totaltotal 59.5% 75 / 126 CC 19 SCAR 13.5
CC
19
Cov
60%
pg_enum
5.3
pg_type
5.3
pg_function
5.3
CRAP 3.9
« blib/lib/DBIO/PostgreSQL/InflateColumn/TSVector.pm ↑ Summary blib/lib/DBIO/PostgreSQL/Diff/Schema.pm »
1 package DBIO::PostgreSQL::PgSchema;
2 # ABSTRACT: Base class for PostgreSQL schema namespaces
3  
4 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 10 our $VERSION = '0.900007';
8  
9 10 my (%_CLASS_ENUM_DEFS, %_CLASS_TYPE_DEFS, %_CLASS_FUNCTION_DEFS);
10  
11  
12  
13 2 ▶sub new {
Subroutine new: called CC=4 SCAR=14.6
Pod documented
14 2 my ($class, %args) = @_;
15 2 ▶ $args{_enums} //= {};
Condition50%1/2
$args{"_enums"} //= {}
l!l
02
MC/DC0%0/1
$args{"_enums"} //= {}
$args{"_enums"}
Truth table50%1/2
A
A= $args{"_enums"}
Aresult
11
00
16 2 ▶ $args{_types} //= {};
Condition50%1/2
$args{"_types"} //= {}
l!l
02
MC/DC0%0/1
$args{"_types"} //= {}
$args{"_types"}
Truth table50%1/2
A
A= $args{"_types"}
Aresult
11
00
17 2 ▶ $args{_functions} //= {};
Condition50%1/2
$args{"_functions"} //= {}
l!l
02
MC/DC0%0/1
$args{"_functions"} //= {}
$args{"_functions"}
Truth table50%1/2
A
A= $args{"_functions"}
Aresult
11
00
18 2 bless \%args, $class;
19 }
20  
21 3 ▶sub pg_schema_name { $_[0]->{pg_schema_name} }
Subroutine pg_schema_name: called CC=1 SCAR=0.0
Pod documented
22  
23 10 ▶sub _pg_enum_defs { $_CLASS_ENUM_DEFS{ ref $_[0] || $_[0] } // [] }
Subroutine _pg_enum_defs: called CC=3 SCAR=12.0
Condition60%3/5
$_CLASS_ENUM_DEFS{ref $_[0] or $_[0]} // []
l!l
91
ref $_[0] || $_[0]
l!l&&r!l&&!r
0100
MC/DC100%1/1
$_CLASS_ENUM_DEFS{ref $_[0] or $_[0]} // []
$_CLASS_ENUM_DEFS{ref $_[0] or $_[0]}
MC/DC0%0/2
ref $_[0] || $_[0]
ref $_[0] $_[0]
Truth table100%2/2
A
A= $_CLASS_ENUM_DEFS{ref $_[0] or $_[0]}
Aresult
11
00
Truth table33%1/3
A || B
A= ref $_[0]B= $_[0]
ABresult
1X1
011
000
24 7 ▶sub _pg_type_defs { $_CLASS_TYPE_DEFS{ ref $_[0] || $_[0] } // [] }
Subroutine _pg_type_defs: called CC=3 SCAR=12.0
Condition60%3/5
$_CLASS_TYPE_DEFS{ref $_[0] or $_[0]} // []
l!l
25
ref $_[0] || $_[0]
l!l&&r!l&&!r
070
MC/DC100%1/1
$_CLASS_TYPE_DEFS{ref $_[0] or $_[0]} // []
$_CLASS_TYPE_DEFS{ref $_[0] or $_[0]}
MC/DC0%0/2
ref $_[0] || $_[0]
ref $_[0] $_[0]
Truth table100%2/2
A
A= $_CLASS_TYPE_DEFS{ref $_[0] or $_[0]}
Aresult
11
00
Truth table33%1/3
A || B
A= ref $_[0]B= $_[0]
ABresult
1X1
011
000
25 7 ▶sub _pg_function_defs { $_CLASS_FUNCTION_DEFS{ ref $_[0] || $_[0] } // [] }
Subroutine _pg_function_defs: called CC=3 SCAR=12.0
Condition60%3/5
$_CLASS_FUNCTION_DEFS{ref $_[0] or $_[0]} // []
l!l
16
ref $_[0] || $_[0]
l!l&&r!l&&!r
070
MC/DC100%1/1
$_CLASS_FUNCTION_DEFS{ref $_[0] or $_[0]} // []
$_CLASS_FUNCTION_DEFS{ref $_[0] or $_[0]}
MC/DC0%0/2
ref $_[0] || $_[0]
ref $_[0] $_[0]
Truth table100%2/2
A
A= $_CLASS_FUNCTION_DEFS{ref $_[0] or $_[0]}
Aresult
11
00
Truth table33%1/3
A || B
A= ref $_[0]B= $_[0]
ABresult
1X1
011
000
26  
27  
28  
29 6 ▶sub pg_enum {
Subroutine pg_enum: called CC=4 SCAR=16.6
Pod documented
30 6 my ($self, $name, $values) = @_;
31 6 ▶ if (ref $self) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self) 0 6 6
32 0 ▶ $self->{_enums}{$name} = $values if $values;
Branch: 1 branch
BranchTrueFalseTotal
if $values 0 0 0
33 0 return $self->{_enums}{$name};
34 }
35 # Class method usage for declarative API
36 6 my $class = $self;
37 6 ▶ $_CLASS_ENUM_DEFS{$class} //= [];
Condition50%1/2
$_CLASS_ENUM_DEFS{$class} //= []
l!l
06
MC/DC0%0/1
$_CLASS_ENUM_DEFS{$class} //= []
$_CLASS_ENUM_DEFS{$class}
Truth table50%1/2
A
A= $_CLASS_ENUM_DEFS{$class}
Aresult
11
00
38 6 push @{ $_CLASS_ENUM_DEFS{$class} }, [$name, $values];
39 }
40  
41  
42 1 ▶sub pg_type {
Subroutine pg_type: called CC=4 SCAR=16.6
Pod documented
43 1 my ($self, $name, $fields) = @_;
44 1 ▶ if (ref $self) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self) 0 1 1
45 0 ▶ $self->{_types}{$name} = $fields if $fields;
Branch: 1 branch
BranchTrueFalseTotal
if $fields 0 0 0
46 0 return $self->{_types}{$name};
47 }
48 1 my $class = $self;
49 1 ▶ $_CLASS_TYPE_DEFS{$class} //= [];
Condition50%1/2
$_CLASS_TYPE_DEFS{$class} //= []
l!l
01
MC/DC0%0/1
$_CLASS_TYPE_DEFS{$class} //= []
$_CLASS_TYPE_DEFS{$class}
Truth table50%1/2
A
A= $_CLASS_TYPE_DEFS{$class}
Aresult
11
00
50 1 push @{ $_CLASS_TYPE_DEFS{$class} }, [$name, $fields];
51 }
52  
53  
54 1 ▶sub pg_function {
Subroutine pg_function: called CC=4 SCAR=16.6
Pod documented
55 1 my ($self, $name, $sql) = @_;
56 1 ▶ if (ref $self) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self) 0 1 1
57 0 ▶ $self->{_functions}{$name} = $sql if $sql;
Branch: 1 branch
BranchTrueFalseTotal
if $sql 0 0 0
58 0 return $self->{_functions}{$name};
59 }
60 1 my $class = $self;
61 1 ▶ $_CLASS_FUNCTION_DEFS{$class} //= [];
Condition50%1/2
$_CLASS_FUNCTION_DEFS{$class} //= []
l!l
01
MC/DC0%0/1
$_CLASS_FUNCTION_DEFS{$class} //= []
$_CLASS_FUNCTION_DEFS{$class}
Truth table50%1/2
A
A= $_CLASS_FUNCTION_DEFS{$class}
Aresult
11
00
62 1 push @{ $_CLASS_FUNCTION_DEFS{$class} }, [$name, $sql];
63 }
64  
65  
66 0 ▶sub pg_enums {
Subroutine pg_enums: not called CC=1 SCAR=6.9
Pod documented
67 0 my ($self) = @_;
68 0 return { %{ $self->{_enums} } };
69 }
70  
71  
72 0 ▶sub pg_types {
Subroutine pg_types: not called CC=1 SCAR=6.9
Pod documented
73 0 my ($self) = @_;
74 0 return { %{ $self->{_types} } };
75 }
76  
77  
78 0 ▶sub pg_functions {
Subroutine pg_functions: not called CC=1 SCAR=6.9
Pod documented
79 0 my ($self) = @_;
80 0 return { %{ $self->{_functions} } };
81 }
82  
83  
84 10 1;
85  
86 __END__
« blib/lib/DBIO/PostgreSQL/InflateColumn/TSVector.pm ↑ Summary blib/lib/DBIO/PostgreSQL/Diff/Schema.pm »