PostGIS/Topology/Extension.pm

filter: Statementstmt 100% 29 / 29 Branchbran 100% 8 / 8 Conditioncond 66.6% 4 / 6 MC/DCmcdc 33.3% 1 / 3 Subroutinesub 100% 8 / 8 Podpod 100% 5 / 5 totaltotal 93.2% 55 / 59 CC 8 SCAR 11.4
CC
8
Cov
95%
inspect
5.0
claims
4.0
BEGIN
1.0
CRAP 3.1
« PostGIS/Storage.pm ↑ Summary PostGIS/Deploy.pm »
1 package DBIO::PostgreSQL::PostGIS::Topology::Extension;
2 # ABSTRACT: The postgis_topology extension: its topologies are runtime schemas, not the application's
3  
4 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 4 our $VERSION = '0.900007';
8  
9 4 ▶use base 'DBIO::Extension';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11  
12 6 ▶sub extension_interface { 1 }
Subroutine extension_interface: called CC=1 SCAR=0.0
Pod documented
13  
14 9 ▶sub name { 'postgis_topology' }
Subroutine name: called CC=1 SCAR=0.0
Pod documented
15  
16 1 ▶sub driver { 'DBIO::PostgreSQL' }
Subroutine driver: called CC=1 SCAR=0.0
Pod documented
17  
18  
19 35 ▶sub inspect {
Subroutine inspect: called CC=5 SCAR=16.1
Pod documented
20 35 my ($class, $ctx) = @_;
21 35 ▶ my $dbh = $ctx->{dbh} or return undef;
Branch: 1 branch
BranchTrueFalseTotal
my $dbh = $ctx->{"dbh"} or return undef 34 1 35
22  
23 34 ▶ my $schema = ($ctx->{self} // {})->{schema};
Condition50%1/2
$ctx->{"self"} // {}
l!l
340
MC/DC0%0/1
$ctx->{"self"} // {}
$ctx->{"self"}
Truth table50%1/2
A
A= $ctx->{"self"}
Aresult
11
00
24 34 ▶ $schema = 'topology' unless defined $schema;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $schema 32 2 34
25 34 my $table = $dbh->quote_identifier($schema) . '.' . $dbh->quote_identifier('topology');
26  
27 34 my ($found) = $dbh->selectrow_array('SELECT to_regclass(?)', undef, $table);
28 34 ▶ return undef unless defined $found;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $found 1 33 34
29  
30 33 my $rows = $dbh->selectall_arrayref(
31 "SELECT name, srid FROM $table ORDER BY name"
32 );
33 33 return { topologies => [ map { { name => $_->[0], srid => $_->[1] } } @$rows ] };
34 }
35  
36  
37 66 ▶sub claims {
Subroutine claims: called CC=4 SCAR=13.9
Pod documented
38 66 my ($class, $model, $ctx) = @_;
39 66 ▶ my $state = ($ctx->{self} // {})->{state} or return [];
Branch: 1 branch
BranchTrueFalseTotal
my $state = +($ctx->{"self"} // {})->{"state"} or return [] 64 2 66
Condition100%2/2
$ctx->{"self"} // {}
l!l
651
MC/DC100%1/1
$ctx->{"self"} // {}
$ctx->{"self"}
Truth table100%2/2
A
A= $ctx->{"self"}
Aresult
11
00
40 64 ▶ return [ map { [ schema => $_->{name} ] } @{ $state->{topologies} // [] } ];
Condition50%1/2
$state->{"topologies"} // []
l!l
640
MC/DC0%0/1
$state->{"topologies"} // []
$state->{"topologies"}
Truth table50%1/2
A
A= $state->{"topologies"}
Aresult
11
00
41 }
42  
43  
44 4 1;
45  
46 __END__
« PostGIS/Storage.pm ↑ Summary PostGIS/Deploy.pm »