| 1 | package MySQL::Util::Lite::ForeignKey; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | our $VERSION = '0.01'; | |||||||||
| 4 | |||||||||||
| 5 | 1 | ▶ | use Modern::Perl; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 1 | ▶ | use Method::Signatures; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | ▶ | use Data::Printer alias => 'pdump'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 1 | ▶ | use MySQL::Util::Lite::ColumnConstraint; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 1 | has name => ( | |||||||||
| 13 | is => 'ro', | ||||||||||
| 14 | isa => 'Str', | ||||||||||
| 15 | required => 1, | ||||||||||
| 16 | ); | ||||||||||
| 17 | |||||||||||
| 18 | 1 | has column_constraints => ( | |||||||||
| 19 | is => 'rw', | ||||||||||
| 20 | isa => 'ArrayRef[MySQL::Util::Lite::ColumnConstraint]', | ||||||||||
| 21 | lazy => 1, | ||||||||||
| 22 | builder => '_build_column_constraints', | ||||||||||
| 23 | ); | ||||||||||
| 24 | |||||||||||
| 25 | 1 | has _util => ( | |||||||||
| 26 | is => 'ro', | ||||||||||
| 27 | isa => 'MySQL::Util', | ||||||||||
| 28 | required => 1, | ||||||||||
| 29 | ); | ||||||||||
| 30 | |||||||||||
| 31 | 0 | ▶ | method get_column_constraints { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
Subroutine
get_column_constraints: not called CC=2 SCAR=13.0
Branch: 1 branch
| |||||||||||
| 32 | |||||||||||
| 33 | 0 | return @{ $self->column_constraints }; | |||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | 0 | ▶ | method _build_column_constraints { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
Subroutine
_build_column_constraints: not called CC=3 SCAR=20.7
Branch: 1 branch
| |||||||||||
| 37 | |||||||||||
| 38 | 0 | my $aref = $self->_util->get_constraint( | |||||||||
| 39 | name => $self->name | ||||||||||
| 40 | ); | ||||||||||
| 41 | |||||||||||
| 42 | 0 | my @cols; | |||||||||
| 43 | |||||||||||
| 44 | 0 | foreach my $col (@$aref) { | |||||||||
| 45 | push @cols, MySQL::Util::Lite::ColumnConstraint->new( | ||||||||||
| 46 | column_name => $col->{COLUMN_NAME}, | ||||||||||
| 47 | table_name => $col->{TABLE_NAME}, | ||||||||||
| 48 | schema_name => $col->{CONSTRAINT_SCHEMA}, | ||||||||||
| 49 | parent_column_name => $col->{REFERENCED_COLUMN_NAME}, | ||||||||||
| 50 | parent_table_name => $col->{REFERENCED_TABLE_NAME}, | ||||||||||
| 51 | parent_schema_name => $col->{REFERENCED_TABLE_SCHEMA}, | ||||||||||
| 52 | 0 | ); | |||||||||
| 53 | |||||||||||
| 54 | } | ||||||||||
| 55 | |||||||||||
| 56 | 0 | return \@cols; | |||||||||
| 57 | } | ||||||||||
| 58 | |||||||||||
| 59 | 1 | 1; | |||||||||