blib/lib/DBIO/PostgreSQL/Introspect/Extensions.pm

filter: Statementstmt 57.8% 11 / 19 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 75.0% 3 / 4 Podpod 100% 1 / 1 totaltotal 48.3% 15 / 31 CC 4 SCAR 24.7
CC
4
Cov
44%
fetch
20.0
BEGIN
1.0
BEGIN
1.0
CRAP 11.9
« blib/lib/DBIO/PostgreSQL/Introspect/Schemas.pm ↑ Summary blib/lib/DBIO/PostgreSQL/Diff/Extension.pm »
1 package DBIO::PostgreSQL::Introspect::Extensions;
2 # ABSTRACT: Introspect PostgreSQL extensions
3  
4 171 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 171 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 171 our $VERSION = '0.900007';
8  
9 171 ▶use DBIO::PostgreSQL::Introspect ();
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11  
12  
13 0 ▶sub fetch {
Subroutine fetch: not called CC=4 SCAR=30.0
Pod documented
14 0 my ($class, $dbh) = @_;
15  
16 0 my $sql = q{
17 SELECT
18 e.extname AS extension_name,
19 e.extversion AS version,
20 n.nspname AS schema_name,
21 e.extrelocatable AS relocatable,
22 ARRAY(
23 SELECT r.extname::text
24 FROM pg_catalog.pg_depend d
25 JOIN pg_catalog.pg_extension r ON r.oid = d.refobjid
26 WHERE d.classid = 'pg_catalog.pg_extension'::pg_catalog.regclass
27 AND d.objid = e.oid
28 AND d.refclassid = 'pg_catalog.pg_extension'::pg_catalog.regclass
29 AND d.deptype = 'n'
30 AND r.extname != 'plpgsql'
31 ORDER BY r.extname
32 ) AS requires
33 FROM pg_catalog.pg_extension e
34 JOIN pg_catalog.pg_namespace n ON n.oid = e.extnamespace
35 WHERE e.extname != 'plpgsql'
36 ORDER BY e.extname
37 };
38  
39 0 my $sth = $dbh->prepare($sql);
40 0 $sth->execute;
41  
42 0 my %extensions;
43 0 ▶ while (my $row = $sth->fetchrow_hashref) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $row = $sth->fetchrow_hashref) 0 0 0
44 $extensions{ $row->{extension_name} } = {
45 extension_name => $row->{extension_name},
46 version => $row->{version},
47 schema_name => $row->{schema_name},
48 relocatable => $row->{relocatable} ? 1 : 0,
49 0 ▶ requires => DBIO::PostgreSQL::Introspect->normalize_array($row->{requires}) // [],
Branch: 1 branch
BranchTrueFalseTotal
$row->{'relocatable'} ? : 0 0 0
Condition0%0/2
"DBIO::PostgreSQL::Introspect"->normalize_array($row->{"requires"}) // []
l!l
00
MC/DC0%0/1
"DBIO::PostgreSQL::Introspect"->normalize_array($row->{"requires"}) // []
"DBIO::PostgreSQL::Introspect"->normalize_array($row->{"requires"})
Truth table0%0/2
A
A= "DBIO::PostgreSQL::Introspect"->normalize_array($row->{"requires"})
Aresult
11
00
50 };
51 }
52  
53 0 return \%extensions;
54 }
55  
56 171 1;
57  
58 __END__
« blib/lib/DBIO/PostgreSQL/Introspect/Schemas.pm ↑ Summary blib/lib/DBIO/PostgreSQL/Diff/Extension.pm »