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

filter: Statementstmt 42.3% 11 / 26 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 75.0% 3 / 4 Podpod 100% 1 / 1 totaltotal 37.5% 15 / 40 CC 4 SCAR 24.7
CC
4
Cov
33%
fetch
20.0
BEGIN
1.0
BEGIN
1.0
CRAP 11.9
« blib/lib/DBIO/PostgreSQL/Diff/Table.pm ↑ Summary blib/lib/DBIO/PostgreSQL/Introspect/Extensions.pm »
1 package DBIO::PostgreSQL::Introspect::Schemas;
2 # ABSTRACT: Introspect PostgreSQL schemas (namespaces)
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, $filter) = @_;
15  
16 0 my $sql = q{
17 SELECT
18 n.nspname AS schema_name,
19 n.oid AS schema_oid,
20 pg_catalog.obj_description(n.oid, 'pg_namespace') AS comment
21 FROM pg_catalog.pg_namespace n
22 WHERE 1=1
23 };
24 0 $sql .= DBIO::PostgreSQL::Introspect->system_schema_filter('n');
25 0 $sql .= DBIO::PostgreSQL::Introspect->extension_member_filter('pg_namespace', 'n.oid');
26  
27 0 my @bind;
28 0 ▶ if ($filter && @$filter) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filter and @$filter) 0 0 0
Condition0%0/3
$filter and @$filter
!ll&&!rl&&r
000
MC/DC0%0/2
$filter and @$filter
$filter @$filter
Truth table0%0/3
A and B
A= $filterB= @$filter
ABresult
0X0
100
111
29 0 $sql .= ' AND n.nspname = ANY($1)';
30 0 push @bind, $filter;
31 }
32  
33 0 $sql .= ' ORDER BY n.nspname';
34  
35 0 my $sth = $dbh->prepare($sql);
36 0 $sth->execute(@bind);
37  
38 0 my %schemas;
39 0 ▶ while (my $row = $sth->fetchrow_hashref) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $row = $sth->fetchrow_hashref) 0 0 0
40 $schemas{ $row->{schema_name} } = {
41 oid => $row->{schema_oid},
42 comment => $row->{comment},
43 0 };
44 }
45  
46 0 return \%schemas;
47 }
48  
49 171 1;
50  
51 __END__
« blib/lib/DBIO/PostgreSQL/Diff/Table.pm ↑ Summary blib/lib/DBIO/PostgreSQL/Introspect/Extensions.pm »