| 1 | package DBIO::PostgreSQL::Age::Extension; | ||||||||||||||||
| 2 | # ABSTRACT: Apache AGE as a DBIO database extension: graph schemas are not the application's model | ||||||||||||||||
| 3 | |||||||||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||
| 5 | 2 | ▶ | use warnings; | ||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||
| 6 | |||||||||||||||||
| 7 | 2 | our $VERSION = '0.900007'; | |||||||||||||||
| 8 | |||||||||||||||||
| 9 | 2 | ▶ | use base 'DBIO::Extension'; | ||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||
| 10 | |||||||||||||||||
| 11 | |||||||||||||||||
| 12 | 5 | ▶ | sub extension_interface { 1 } | ||||||||||||||
|
Subroutine
extension_interface: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||
| 13 | |||||||||||||||||
| 14 | |||||||||||||||||
| 15 | 6 | ▶ | sub name { 'age' } | ||||||||||||||
|
Subroutine
name: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||
| 16 | |||||||||||||||||
| 17 | |||||||||||||||||
| 18 | 1 | ▶ | sub driver { 'DBIO::PostgreSQL' } | ||||||||||||||
|
Subroutine
driver: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||
| 19 | |||||||||||||||||
| 20 | |||||||||||||||||
| 21 | 18 | ▶ | sub inspect { | ||||||||||||||
|
Subroutine
inspect: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||
| 22 | 18 | my ($class, $ctx) = @_; | |||||||||||||||
| 23 | 18 | my $dbh = $ctx->{dbh}; | |||||||||||||||
| 24 | |||||||||||||||||
| 25 | 18 | my ($have) = $dbh->selectrow_array( | |||||||||||||||
| 26 | q{SELECT pg_catalog.to_regclass('ag_catalog.ag_graph')} | ||||||||||||||||
| 27 | ); | ||||||||||||||||
| 28 | 18 | ▶ | return { graphs => [] } unless defined $have; | ||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||
| 29 | |||||||||||||||||
| 30 | 17 | my $rows = $dbh->selectall_arrayref( | |||||||||||||||
| 31 | q{SELECT g.name::text AS name, n.nspname::text AS namespace | ||||||||||||||||
| 32 | FROM ag_catalog.ag_graph g | ||||||||||||||||
| 33 | JOIN pg_catalog.pg_namespace n ON n.oid = g.namespace | ||||||||||||||||
| 34 | ORDER BY g.name}, | ||||||||||||||||
| 35 | { Slice => {} }, | ||||||||||||||||
| 36 | ); | ||||||||||||||||
| 37 | |||||||||||||||||
| 38 | 17 | ▶ | return { graphs => [ map { { name => $_->{name}, namespace => $_->{namespace} } } @{ $rows || [] } ] }; | ||||||||||||||
|
Condition50%1/2
$rows || []
MC/DC0%0/1
$rows || []
$rows
Truth table50%1/2
A
A= $rows
| |||||||||||||||||
| 39 | } | ||||||||||||||||
| 40 | |||||||||||||||||
| 41 | |||||||||||||||||
| 42 | 26 | ▶ | sub claims { | ||||||||||||||
|
Subroutine
claims: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||
| 43 | 26 | my ($class, $model, $ctx) = @_; | |||||||||||||||
| 44 | 26 | return [ map { [ schema => $_->{namespace} ] } | |||||||||||||||
| 45 | 26 | ▶ | @{ ( $ctx->{self}{state} || {} )->{graphs} || [] } ]; | ||||||||||||||
|
Condition100%4/4
+($ctx->{'self'}{'state'} || {})->{'graphs'} || []
$ctx->{'self'}{'state'} || {}
MC/DC100%1/1
+($ctx->{'self'}{'state'} || {})->{'graphs'} || []
$ctx->{'self'}{'state'}
Truth table100%2/2
A
A= $ctx->{'self'}{'state'}
| |||||||||||||||||
| 46 | } | ||||||||||||||||
| 47 | |||||||||||||||||
| 48 | |||||||||||||||||
| 49 | 16 | ▶ | sub activation { { load => 'age', search_path => ['ag_catalog'] } } | ||||||||||||||
|
Subroutine
activation: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||
| 50 | |||||||||||||||||
| 51 | |||||||||||||||||
| 52 | 1 | ▶ | sub storage_layer { 'DBIO::PostgreSQL::Age::Storage' } | ||||||||||||||
|
Subroutine
storage_layer: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||
| 53 | |||||||||||||||||
| 54 | |||||||||||||||||
| 55 | 2 | 1; | |||||||||||||||
| 56 | |||||||||||||||||
| 57 | __END__ | ||||||||||||||||