| 1 | package MySQL::Util::Lite::Table; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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::ForeignKey; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use MySQL::Util::Lite::PrimaryKey; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use MySQL::Util::Lite::AlternateKey; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 1 | with 'MySQL::Util::Lite::Roles::NewColumn'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 1 | has name => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | isa => 'Str', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | required => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 1 | has schema_name => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | isa => 'Str', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | required => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 1 | has columns => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | isa => 'ArrayRef[MySQL::Util::Lite::Column]', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | builder => '_build_columns', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 1 | has _util => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | isa => 'MySQL::Util', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | required => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | ▶ | method get_fq_name { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
Subroutine
get_fq_name: not called CC=2 SCAR=12.4
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | return sprintf( '%s.%s', $self->schema_name, $self->name ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | method get_parent_tables (Str :$column_name) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=5.5
Subroutine
get_parent_tables: not called CC=7 SCAR=38.2
Branch: 3 branches
Condition0%0/6
exists $args{"column_name"} and not +($Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str"))->check($column_name)
$Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str")
MC/DC0%0/2
exists $args{"column_name"} and not +($Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str"))->check($column_name)
exists $args{"column_name"}
not +($Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str"))->check($column_name)
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str")
$Method::Signatures::mutc{"cache"}{"Str"}
"Method::Signatures"->_make_constraint("Str")
Truth table0%0/3
A and not(B)
A= exists $args{"column_name"}B= not +($Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str"))->check($column_name)
Truth table0%0/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"Str"}B= "Method::Signatures"->_make_constraint("Str")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | if ($column_name) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | return $self->_get_column_parent_tables( column_name => $column_name ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | return $self->_get_parent_tables; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | method _get_column_parent_tables (Str :$column_name) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=5.5
Subroutine
_get_column_parent_tables: not called CC=10 SCAR=45.5
Branch: 3 branches
Condition0%0/6
exists $args{"column_name"} and not +($Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str"))->check($column_name)
$Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str")
MC/DC0%0/2
exists $args{"column_name"} and not +($Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str"))->check($column_name)
exists $args{"column_name"}
not +($Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str"))->check($column_name)
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str")
$Method::Signatures::mutc{"cache"}{"Str"}
"Method::Signatures"->_make_constraint("Str")
Truth table0%0/3
A and not(B)
A= exists $args{"column_name"}B= not +($Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str"))->check($column_name)
Truth table0%0/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"Str"}B= "Method::Signatures"->_make_constraint("Str")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | my %seen; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | my @ret; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | my @fks = $self->get_foreign_keys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | foreach my $fk (@fks) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | foreach my $con ( @{ $fk->column_constraints } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | if ( $con->column_name eq $column_name ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | my $fq_table_name = sprintf( "%s.%s", | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | $con->parent_schema_name, $con->parent_table_name ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | ▶ | if ( !$seen{$fq_table_name} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | push @ret, | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | MySQL::Util::Lite::Table->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | name => $con->parent_table_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | schema_name => $con->parent_schema_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | _util => $self->_util | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | $seen{$fq_table_name}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | return @ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | method _get_parent_tables { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
Subroutine
_get_parent_tables: not called CC=5 SCAR=31.2
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | my %seen; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | my @ret; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | my @fks = $self->get_foreign_keys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | foreach my $fk (@fks) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | foreach my $col ( @{ $fk->column_constraints } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | my $fq_table_name = sprintf( "%s.%s", | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | $col->parent_schema_name, $col->parent_table_name ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | ▶ | if ( !$seen{$fq_table_name} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | push @ret, | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | MySQL::Util::Lite::Table->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | name => $col->parent_table_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | schema_name => $col->parent_schema_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | _util => $self->_util | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | $seen{$fq_table_name}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | return @ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | ▶ | method get_foreign_keys { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
Subroutine
get_foreign_keys: not called CC=3 SCAR=20.7
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | my $fks_href = $self->_util->get_fk_constraints( $self->name ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | my @fks; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | foreach my $fk_name ( keys %$fks_href ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | push @fks, | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | MySQL::Util::Lite::ForeignKey->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | name => $fk_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | _util => $self->_util, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | return @fks; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | method has_parents { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
Subroutine
has_parents: not called CC=3 SCAR=21.1
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | my @parents = $self->get_parent_tables; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | ▶ | if (@parents) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | method get_autoinc_column { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
Subroutine
get_autoinc_column: not called CC=4 SCAR=25.8
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | my $cols = $self->columns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | foreach my $col (@$cols) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | ▶ | if ( $col->is_autoinc ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | return $col; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | ▶ | method get_column (Str :$name) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=5.5
Subroutine
get_column: not called CC=8 SCAR=40.7
Branch: 3 branches
Condition0%0/6
exists $args{"name"} and not +($Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str"))->check($name)
$Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str")
MC/DC0%0/2
exists $args{"name"} and not +($Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str"))->check($name)
exists $args{"name"}
not +($Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str"))->check($name)
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str")
$Method::Signatures::mutc{"cache"}{"Str"}
"Method::Signatures"->_make_constraint("Str")
Truth table0%0/3
A and not(B)
A= exists $args{"name"}B= not +($Method::Signatures::mutc{"cache"}{"Str"} ||= "Method::Signatures"->_make_constraint("Str"))->check($name)
Truth table0%0/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"Str"}B= "Method::Signatures"->_make_constraint("Str")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | my $cols = $self->columns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | foreach my $col (@$cols) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | ▶ | if ( $col->name eq $name ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | return $col; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | method get_primary_key () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
Subroutine
get_primary_key: not called CC=3 SCAR=21.1
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | my $pk_name = $self->_util->get_pk_name( $self->name ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | if ($pk_name) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | return MySQL::Util::Lite::PrimaryKey->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | name => $pk_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | table_name => $self->get_fq_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | _util => $self->_util, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | ▶ | method get_alternate_keys () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
Subroutine
get_alternate_keys: not called CC=3 SCAR=20.7
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | my $href = $self->_util->get_ak_constraints( $self->name ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | my @aks; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | foreach my $ak_name ( keys %$href ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | push @aks, | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | MySQL::Util::Lite::AlternateKey->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | name => $ak_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | _util => $self->_util, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | return @aks; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | ▶ | method get_columns { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
Subroutine
get_columns: not called CC=2 SCAR=13.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | return @{ $self->columns }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | method _build_columns { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
Subroutine
_build_columns: not called CC=3 SCAR=20.7
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | my @cols; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | my $aref = $self->_util->describe_table( $self->get_fq_name ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | foreach my $col (@$aref) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | push @cols, $self->new_column($col); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | return \@cols; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||