| 1 | package DBIO::PostgreSQL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: PostgreSQL-specific schema management for DBIO | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 124 | our $VERSION = '0.900007'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 124 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 124 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 124 | ▶ | use base 'DBIO::Base'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 124 | ▶ | use Carp (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 124 | ▶ | use DBIO::PostgreSQL::Storage (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 124 | ▶ | use DBIO::PostgreSQL::Extension (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 124 | __PACKAGE__->mk_classdata('_pg_schemas' => []); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 124 | __PACKAGE__->mk_classdata('_pg_schema_classes' => {}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 124 | __PACKAGE__->mk_classdata('_pg_extensions' => []); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 124 | __PACKAGE__->mk_classdata('_pg_extension_schemas' => {}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 124 | __PACKAGE__->mk_classdata('_pg_extension_classes' => {}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 124 | __PACKAGE__->mk_classdata('_pg_search_path' => undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 124 | __PACKAGE__->mk_classdata('_pg_settings' => {}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 754 | ▶ | sub pg_schemas { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pg_schemas: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 754 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 754 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 47 | my $classes = $class->_pg_schema_classes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 47 | my @bound = sort keys %$classes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 47 | ▶ | Carp::croak(sprintf | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 'pg_schemas() must be called before pg_schema_class(); bound already: %s', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | join(', ', @bound)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | if @bound; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 46 | my %seen; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 46 | $class->_pg_schemas([ grep { !$seen{$_}++ } @_ ]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 753 | return @{ $class->_pg_schemas }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 58 | ▶ | sub pg_schema_class { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pg_schema_class: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 58 | my ($class, $name, $pg_schema_class) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 58 | my $classes = { %{ $class->_pg_schema_classes } }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 58 | ▶ | if ($pg_schema_class) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 7 | my @declared = $class->pg_schemas; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | Carp::croak(sprintf | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 'pg_schema_class() for %s: pg_schemas() does not name it; declared: %s', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | $name, join(', ', @declared)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 7 | ▶ | if @declared and !grep { $_ eq $name } @declared; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@declared and not grep({$_ eq $name;} @declared)
MC/DC100%2/2
@declared and not grep({$_ eq $name;} @declared)
@declared
not grep({$_ eq $name;} @declared)
Truth table100%3/3
A and not(B)
A= @declaredB= not grep({$_ eq $name;} @declared)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 6 | $classes->{$name} = $pg_schema_class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 6 | $class->_pg_schema_classes($classes); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 57 | return $classes->{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 675 | ▶ | sub pg_extensions { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pg_extensions: called CC=23 SCAR=31.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 675 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 675 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 88 | my (@names, %schemas, %classes); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 88 | my @args = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 88 | ▶ | while (@args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 123 | my $name = shift @args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 123 | ▶ | Carp::croak(sprintf | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition66%4/6
not defined $name or ref $name or not length $name
not defined $name or ref $name
MC/DC33%1/3
not defined $name or ref $name or not length $name
not defined $name
ref $name
not length $name
Truth table50%2/4
not(A) or B or not(C)
A= not defined $nameB= ref $nameC= not length $name
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 'pg_extensions(): an extension name is expected, got %s', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | defined $name ? (ref $name ? 'a ' . ref($name) . ' reference' : "'$name'") : 'undef') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | if !defined $name || ref $name || !length $name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 120 | push @names, $name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 120 | ▶ | next unless @args && ref $args[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@args and ref $args[0]
MC/DC100%2/2
@args and ref $args[0]
@args
ref $args[0]
Truth table100%3/3
A and B
A= @argsB= ref $args[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 73 | my $opts = shift @args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 73 | ▶ | Carp::croak("pg_extensions(): the options of extension '$name' are a hashref") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | unless ref $opts eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 73 | ▶ | my @unknown = grep { $_ ne 'schema' && $_ ne 'class' } sort keys %$opts; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$_ ne 'schema' && $_ ne 'class'
MC/DC100%2/2
$_ ne 'schema' && $_ ne 'class'
$_ ne 'schema'
$_ ne 'class'
Truth table100%3/3
A && B
A= $_ ne 'schema'B= $_ ne 'class'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | Carp::croak(sprintf | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | "pg_extensions(): extension '%s' has no option %s; the options are 'schema' and 'class'", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 73 | ▶ | $name, join(', ', map { "'$_'" } @unknown)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | if @unknown; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 70 | ▶ | Carp::croak("pg_extensions(): extension '$name' has an empty options hashref; give 'schema' or 'class'") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | unless keys %$opts; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 68 | ▶ | if (exists $opts->{schema}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 37 | my $schema = $opts->{schema}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 37 | ▶ | Carp::croak("pg_extensions(): extension '$name' needs a 'schema', a plain non-empty string") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition77%7/9
defined $schema and not ref $schema and length $schema and not $schema =~ /\0/
defined $schema and not ref $schema and length $schema
defined $schema and not ref $schema
MC/DC50%2/4
defined $schema and not ref $schema and length $schema and not $schema =~ /\0/
defined $schema
not ref $schema
length $schema
not $schema =~ /\0/
Truth table60%3/5
A and not(B) and C and not(D)
A= defined $schemaB= not ref $schemaC= length $schemaD= not $schema =~ /\0/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | unless defined $schema && !ref $schema && length $schema && $schema !~ /\0/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 34 | $schemas{$name} = $schema; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 65 | ▶ | if (exists $opts->{class}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 35 | my $extension_class = $opts->{class}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 35 | ▶ | Carp::croak("pg_extensions(): extension '$name' needs a 'class', a class name") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
defined $extension_class and not ref $extension_class and $extension_class =~ /\A[A-Za-z_]\w*(?:::\w+)*\z/
defined $extension_class and not ref $extension_class
MC/DC100%3/3
defined $extension_class and not ref $extension_class and $extension_class =~ /\A[A-Za-z_]\w*(?:::\w+)*\z/
defined $extension_class
not ref $extension_class
$extension_class =~ /\A[A-Za-z_]\w*(?:::\w+)*\z/
Truth table100%4/4
A and not(B) and C
A= defined $extension_classB= not ref $extension_classC= $extension_class =~ /\A[A-Za-z_]\w*(?:::\w+)*\z/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | unless defined $extension_class && !ref $extension_class | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | && $extension_class =~ /\A[A-Za-z_]\w*(?:::\w+)*\z/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 31 | $classes{$name} = $extension_class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 73 | $class->_pg_extensions(\@names); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 73 | $class->_pg_extension_schemas(\%schemas); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 73 | $class->_pg_extension_classes(\%classes); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 660 | return @{ $class->_pg_extensions }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 576 | ▶ | sub pg_extension_schemas { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pg_extension_schemas: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 576 | my ($class) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 576 | return { %{ $class->_pg_extension_schemas } }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 275 | ▶ | sub pg_extension_classes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pg_extension_classes: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 275 | my ($class) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 275 | return { %{ $class->_pg_extension_classes } }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 202 | ▶ | sub pg_search_path { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pg_search_path: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 202 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 202 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 24 | $class->_pg_search_path([@_]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 202 | ▶ | return @{ $class->_pg_search_path // [ 'public' ] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$class->_pg_search_path // ["public"]
MC/DC100%1/1
$class->_pg_search_path // ["public"]
$class->_pg_search_path
Truth table100%2/2
A
A= $class->_pg_search_path
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 40 | ▶ | sub pg_search_path_declared { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pg_search_path_declared: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 40 | my ($class) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 40 | ▶ | return defined $class->_pg_search_path ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 201 | ▶ | sub pg_settings { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pg_settings: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 201 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 201 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 22 | $class->_pg_settings($_[0]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 201 | return $class->_pg_settings; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 177 | ▶ | sub connection { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
connection: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 177 | my ($self, @info) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 177 | $self->storage_type('+DBIO::PostgreSQL::Storage'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 177 | $self->_register_extension_layers; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 176 | return $self->next::method(@info); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | # The storage layer (ADR 0032) of every declared extension whose class names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | # one is registered with core's register_storage_layer, ahead of the composition | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | # core makes in connection(). The classes are loaded and checked for their | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | # interface here -- the layer has to be chosen before the storage is built -- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | # but their driver assertion waits for the first use of the connection. An | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | # extension chooses a layer, never the driver: the driver is the one this | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | # component pinned above. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 177 | ▶ | sub _register_extension_layers { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_register_extension_layers: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 177 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 177 | ▶ | my $list = DBIO::PostgreSQL::Extension->resolve_list($self, check_driver => 0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 45 | for my $entry ($list->entries) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 70 | my $layer = $entry->{class}->storage_layer; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 70 | ▶ | $self->register_storage_layer($layer) if defined $layer; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 45 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 5 | ▶ | sub pg_deploy { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pg_deploy: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 5 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 5 | my $storage = $self->storage; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 5 | ▶ | my $named = $storage && $storage->can('dbio_deploy_class') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$storage and $storage->can("dbio_deploy_class")
MC/DC50%1/2
$storage and $storage->can("dbio_deploy_class")
$storage
$storage->can("dbio_deploy_class")
Truth table66%2/3
A and B
A= $storageB= $storage->can("dbio_deploy_class")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | ? $storage | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | : 'DBIO::PostgreSQL::Storage'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 5 | my $deploy_class = $named->dbio_deploy_class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 5 | $self->ensure_class_loaded($deploy_class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 5 | return $deploy_class->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | schema => $self, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | %args, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 1 | ▶ | sub pg_install_ddl { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pg_install_ddl: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 1 | require DBIO::PostgreSQL::DDL; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 1 | return DBIO::PostgreSQL::DDL->install_ddl($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 124 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||