| 1 | package # hide from PAUSE | ||||||||||||||||||||||||||||
| 2 | CellBIS::SQL::Abstract::Table; | ||||||||||||||||||||||||||||
| 3 | 17 | ▶ | use Mojo::Base -base; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 17 | ▶ | use Scalar::Util qw(blessed); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 17 | ▶ | use Mojo::Util qw(trim); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 17 | ▶ | use Hash::MultiValue; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 17 | has 'db_type' => 'mariadb'; | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | # For Foreign Key Validator: | ||||||||||||||||||||||||||||
| 12 | # ------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 13 | 4 | ▶ | sub fk_validator { | ||||||||||||||||||||||||||
|
Subroutine
fk_validator: called CC=11 SCAR=30.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 14 | 4 | my ($table_attr, $col_attr) = @_; | |||||||||||||||||||||||||||
| 15 | 4 | my %fk_attr = (name => 0, col_name => 0, table_target => 0, col_target => 0,); | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 4 | my $fk = $table_attr->{fk}; | |||||||||||||||||||||||||||
| 18 | 4 | ▶ | if (exists $fk->{name} && $fk->{name} ne '') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $fk->{"name"} and $fk->{"name"} ne ""
MC/DC0%0/2
exists $fk->{"name"} and $fk->{"name"} ne ""
exists $fk->{"name"}
$fk->{"name"} ne ""
Truth table33%1/3
A and B
A= exists $fk->{"name"}B= $fk->{"name"} ne ""
| |||||||||||||||||||||||||||||
| 19 | 4 | $fk_attr{name} = 1; | |||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||
| 21 | 4 | ▶ | if (exists $fk->{col_name} && $fk->{col_name} ne '') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $fk->{"col_name"} and $fk->{"col_name"} ne ""
MC/DC0%0/2
exists $fk->{"col_name"} and $fk->{"col_name"} ne ""
exists $fk->{"col_name"}
$fk->{"col_name"} ne ""
Truth table33%1/3
A and B
A= exists $fk->{"col_name"}B= $fk->{"col_name"} ne ""
| |||||||||||||||||||||||||||||
| 22 | 4 | $fk_attr{col_name} = 1; | |||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 4 | ▶ | if (exists $fk->{table_target} && $fk->{table_target} ne '') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $fk->{"table_target"} and $fk->{"table_target"} ne ""
MC/DC0%0/2
exists $fk->{"table_target"} and $fk->{"table_target"} ne ""
exists $fk->{"table_target"}
$fk->{"table_target"} ne ""
Truth table33%1/3
A and B
A= exists $fk->{"table_target"}B= $fk->{"table_target"} ne ""
| |||||||||||||||||||||||||||||
| 26 | 4 | $fk_attr{table_target} = 1; | |||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 4 | ▶ | if (exists $fk->{col_target} && $fk->{col_target} ne '') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $fk->{"col_target"} and $fk->{"col_target"} ne ""
MC/DC0%0/2
exists $fk->{"col_target"} and $fk->{"col_target"} ne ""
exists $fk->{"col_target"}
$fk->{"col_target"} ne ""
Truth table33%1/3
A and B
A= exists $fk->{"col_target"}B= $fk->{"col_target"} ne ""
| |||||||||||||||||||||||||||||
| 30 | 4 | $fk_attr{col_target} = 1; | |||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | 4 | my @r_val = grep { !$_ } values %fk_attr; | |||||||||||||||||||||||||||
| 33 | 4 | my $size_result = scalar @r_val; | |||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 4 | ▶ | if ($size_result >= 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 36 | 0 | my $new_TableAttr = Hash::MultiValue->new(%{$table_attr}); | |||||||||||||||||||||||||||
| 37 | 0 | $new_TableAttr->remove('fk'); | |||||||||||||||||||||||||||
| 38 | 0 | $table_attr = $new_TableAttr->as_hashref; | |||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | else { | ||||||||||||||||||||||||||||
| 41 | 4 | ▶ | unless (exists $col_attr->{$fk->{col_name}}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 42 | 0 | my $new_TableAttr = Hash::MultiValue->new(%{$table_attr}); | |||||||||||||||||||||||||||
| 43 | 0 | $new_TableAttr->remove('fk'); | |||||||||||||||||||||||||||
| 44 | 0 | $table_attr = $new_TableAttr->as_hashref; | |||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | 4 | return $table_attr; | |||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | # For Foreign key attribute : | ||||||||||||||||||||||||||||
| 51 | # ------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 52 | 4 | ▶ | sub fk_attr_validator { | ||||||||||||||||||||||||||
|
Subroutine
fk_attr_validator: called CC=6 SCAR=18.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 53 | 4 | my ($fk_table) = @_; | |||||||||||||||||||||||||||
| 54 | 4 | my $data = ''; | |||||||||||||||||||||||||||
| 55 | 4 | my %ondelup = ('cascade' => 'CASCADE', 'null' => 'SET NULL', | |||||||||||||||||||||||||||
| 56 | 'default' => 'SET DEFAULT'); | ||||||||||||||||||||||||||||
| 57 | 4 | my $ondel = 0; | |||||||||||||||||||||||||||
| 58 | 4 | ▶ | if (exists $fk_table->{ondelete}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 59 | 4 | ▶ | if (exists $ondelup{(lc $fk_table->{ondelete})}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 60 | 4 | $ondel = 1; | |||||||||||||||||||||||||||
| 61 | 4 | $data .= 'ON DELETE ' . $ondelup{(lc $fk_table->{ondelete})}; | |||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 4 | ▶ | if (exists $fk_table->{onupdate}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 66 | 4 | ▶ | if (exists $ondelup{(lc $fk_table->{onupdate})}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 67 | 4 | ▶ | $data .= ' ' if $ondel == 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 68 | 4 | $data .= 'ON UPDATE ' . $ondelup{(lc $fk_table->{onupdate})}; | |||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||
| 71 | 4 | $data = trim($data); | |||||||||||||||||||||||||||
| 72 | 4 | return $data; | |||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | # For Table Attribute Validator : | ||||||||||||||||||||||||||||
| 76 | # ------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 77 | 10 | ▶ | sub table_attr_val { | ||||||||||||||||||||||||||
|
Subroutine
table_attr_val: called CC=17 SCAR=30.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 78 | 10 | my $self = shift; | |||||||||||||||||||||||||||
| 79 | 10 | my ($col_attr, $table_attr) = @_; | |||||||||||||||||||||||||||
| 80 | 10 | my $new_tblAttr = {}; | |||||||||||||||||||||||||||
| 81 | 10 | my $attrib_table = ''; | |||||||||||||||||||||||||||
| 82 | 10 | ▶ | my $db_type = $self->db_type // 'mariadb'; | ||||||||||||||||||||||||||
|
Condition50%1/2
$self->db_type // "mariadb"
MC/DC0%0/1
$self->db_type // "mariadb"
$self->db_type
Truth table50%1/2
A
A= $self->db_type
| |||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | 10 | ▶ | if (exists $table_attr->{fk}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 85 | 4 | $table_attr = fk_validator($table_attr, $col_attr); | |||||||||||||||||||||||||||
| 86 | 4 | my $table_fk = ''; | |||||||||||||||||||||||||||
| 87 | 4 | ▶ | if (exists $table_attr->{fk}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 88 | 4 | my $fk_table = $table_attr->{fk}; | |||||||||||||||||||||||||||
| 89 | 4 | my $fk_name = $fk_table->{name}; | |||||||||||||||||||||||||||
| 90 | 4 | my $col_name = $fk_table->{col_name}; | |||||||||||||||||||||||||||
| 91 | 4 | my $table_target = $fk_table->{table_target}; | |||||||||||||||||||||||||||
| 92 | 4 | my $col_target = $fk_table->{col_target}; | |||||||||||||||||||||||||||
| 93 | 4 | my $fk_attr = ''; | |||||||||||||||||||||||||||
| 94 | 4 | ▶ | if ($fk_table->{attr}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 95 | 4 | $fk_attr = fk_attr_validator($fk_table->{attr}); | |||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||
| 97 | 4 | ▶ | if ($db_type eq 'sqlite') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 98 | 2 | $table_fk .= "\tCONSTRAINT $fk_name "; | |||||||||||||||||||||||||||
| 99 | 2 | $table_fk .= "FOREIGN KEY ($col_name) "; | |||||||||||||||||||||||||||
| 100 | 2 | ▶ | $table_fk .= "REFERENCES $table_target ($col_target)\n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 101 | if $fk_attr eq ''; | ||||||||||||||||||||||||||||
| 102 | 2 | ▶ | $table_fk .= "REFERENCES $table_target ($col_target) \n\t$fk_attr\n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 103 | unless $fk_attr eq ''; | ||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||
| 105 | else { | ||||||||||||||||||||||||||||
| 106 | 2 | ▶ | $table_fk .= "\tKEY " . $fk_name . " ($col_name), \n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 107 | if $db_type eq 'mariadb'; | ||||||||||||||||||||||||||||
| 108 | 2 | $table_fk .= "\tCONSTRAINT $fk_name "; | |||||||||||||||||||||||||||
| 109 | 2 | $table_fk .= "FOREIGN KEY ($col_name) "; | |||||||||||||||||||||||||||
| 110 | 2 | ▶ | $table_fk .= "REFERENCES $table_target ($col_target)\n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 111 | if $fk_attr eq ''; | ||||||||||||||||||||||||||||
| 112 | 2 | ▶ | $table_fk .= "REFERENCES $table_target ($col_target) \n\t$fk_attr\n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 113 | unless $fk_attr eq ''; | ||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | 4 | my $new_attrTbl = Hash::MultiValue->new(%{$table_attr}); | |||||||||||||||||||||||||||
| 117 | 4 | $new_attrTbl->set(fk => $table_fk); | |||||||||||||||||||||||||||
| 118 | 4 | $table_attr = $new_attrTbl->as_hashref; | |||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||
| 121 | 10 | ▶ | if (exists $table_attr->{index}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 122 | 0 | ▶ | if (ref($table_attr->{index}) eq "ARRAY" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $table_attr->{"index"} eq "ARRAY" and scalar @{$table_attr->{"index"};} > 0
MC/DC0%0/2
ref $table_attr->{"index"} eq "ARRAY" and scalar @{$table_attr->{"index"};} > 0
ref $table_attr->{"index"} eq "ARRAY"
scalar @{$table_attr->{"index"};} > 0
Truth table0%0/3
A and B
A= ref $table_attr->{"index"} eq "ARRAY"B= scalar @{$table_attr->{"index"};} > 0
| |||||||||||||||||||||||||||||
| 123 | 0 | and (scalar @{$table_attr->{index}}) > 0) | |||||||||||||||||||||||||||
| 124 | { | ||||||||||||||||||||||||||||
| 125 | 0 | my $table_index = join ',', @{$table_attr->{index}}; | |||||||||||||||||||||||||||
| 126 | 0 | $table_index = 'INDEX (' . $table_index . ')'; | |||||||||||||||||||||||||||
| 127 | 0 | my $new_attrTbl = Hash::MultiValue->new(%{$table_attr}); | |||||||||||||||||||||||||||
| 128 | 0 | $new_attrTbl->set(index => $table_index); | |||||||||||||||||||||||||||
| 129 | 0 | $table_attr = $new_attrTbl->as_hashref; | |||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||
| 132 | 10 | my $engine = 0; | |||||||||||||||||||||||||||
| 133 | 10 | ▶ | if (exists $table_attr->{engine}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 134 | 3 | $engine = 1; | |||||||||||||||||||||||||||
| 135 | 3 | my $r_engine = $self->_check_engine($table_attr->{engine}); | |||||||||||||||||||||||||||
| 136 | 3 | $attrib_table .= 'ENGINE=' . $r_engine; | |||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||
| 138 | 10 | ▶ | $attrib_table .= ' ' if ($engine == 1); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 139 | $attrib_table | ||||||||||||||||||||||||||||
| 140 | .= exists $table_attr->{charset} | ||||||||||||||||||||||||||||
| 141 | ? 'DEFAULT CHARSET=' . $table_attr->{charset} | ||||||||||||||||||||||||||||
| 142 | 10 | ▶ | : 'DEFAULT CHARSET=utf8'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 143 | 10 | $new_tblAttr = Hash::MultiValue->new(%{$table_attr}); | |||||||||||||||||||||||||||
| 144 | 10 | $new_tblAttr->set(attr => $attrib_table); | |||||||||||||||||||||||||||
| 145 | 10 | $table_attr = $new_tblAttr->as_hashref; | |||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | 10 | return $table_attr; | |||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | # For Column Attribute validator : | ||||||||||||||||||||||||||||
| 151 | # ------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 152 | 10 | ▶ | sub table_col_attr_val { | ||||||||||||||||||||||||||
|
Subroutine
table_col_attr_val: called CC=9 SCAR=22.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 153 | 10 | my $self = shift; | |||||||||||||||||||||||||||
| 154 | 10 | my ($col_list, $col_attr) = @_; | |||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | 10 | ▶ | if (ref($col_attr) eq "HASH") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 157 | 10 | my $i = 0; | |||||||||||||||||||||||||||
| 158 | 10 | my $until = scalar @{$col_list}; | |||||||||||||||||||||||||||
| 159 | 10 | my @pk_list = (); | |||||||||||||||||||||||||||
| 160 | 10 | my @ai_list = (); | |||||||||||||||||||||||||||
| 161 | 10 | my $size_pk = 0; | |||||||||||||||||||||||||||
| 162 | 10 | my $size_ai = 0; | |||||||||||||||||||||||||||
| 163 | 10 | my $col_name = ''; | |||||||||||||||||||||||||||
| 164 | 10 | my $curr_colAttr = {}; | |||||||||||||||||||||||||||
| 165 | 10 | my $new_colAttr = Hash::MultiValue->new(%{$col_attr}); | |||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | 10 | ▶ | while ($i < $until) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 168 | 47 | $col_name = $col_attr->{$col_list->[$i]}; | |||||||||||||||||||||||||||
| 169 | 47 | ▶ | if (exists $col_name->{'is_autoincre'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 170 | 9 | $size_ai = ($size_ai + 1); | |||||||||||||||||||||||||||
| 171 | 9 | push @ai_list, $col_list->[$i]; | |||||||||||||||||||||||||||
| 172 | 9 | $curr_colAttr = Hash::MultiValue->new(%{$col_name}); | |||||||||||||||||||||||||||
| 173 | 9 | $curr_colAttr->remove('is_autoincre'); | |||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | 9 | $new_colAttr->set($col_list->[$i] => $curr_colAttr->as_hashref); | |||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||
| 177 | 47 | $i++; | |||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||
| 179 | 10 | $col_attr = $new_colAttr->as_hashref; | |||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||
| 181 | 10 | $i = 0; | |||||||||||||||||||||||||||
| 182 | 10 | ▶ | while ($i < $until) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 183 | 47 | $col_name = $col_attr->{$col_list->[$i]}; | |||||||||||||||||||||||||||
| 184 | 47 | ▶ | if (exists $col_name->{'is_primarykey'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 185 | 10 | $size_pk = ($size_pk + 1); | |||||||||||||||||||||||||||
| 186 | 10 | push @pk_list, $col_list->[$i]; | |||||||||||||||||||||||||||
| 187 | 10 | $curr_colAttr = Hash::MultiValue->new(%{$col_name}); | |||||||||||||||||||||||||||
| 188 | 10 | $curr_colAttr->remove('is_primarykey'); | |||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | 10 | $new_colAttr->set($col_list->[$i] => $curr_colAttr->as_hashref); | |||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||
| 192 | 47 | $i++; | |||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||
| 195 | 10 | ▶ | if ($size_pk >= 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 196 | 10 | my $r_colAttr = $new_colAttr->as_hashref; | |||||||||||||||||||||||||||
| 197 | 10 | my $pk_table = $r_colAttr->{$pk_list[0]}; | |||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||
| 199 | 10 | $curr_colAttr = Hash::MultiValue->new(%{$pk_table}); | |||||||||||||||||||||||||||
| 200 | 10 | $curr_colAttr->set('is_primarykey' => 1); | |||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | 10 | $col_attr = Hash::MultiValue->new(%{$r_colAttr}); | |||||||||||||||||||||||||||
| 203 | 10 | $col_attr->set($pk_list[0] => $curr_colAttr->as_hashref); | |||||||||||||||||||||||||||
| 204 | 10 | $col_attr = $col_attr->as_hashref; | |||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||
| 207 | 10 | ▶ | if ($size_ai >= 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 208 | 9 | my $pk_table = $col_attr->{$pk_list[0]}; | |||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||
| 210 | 9 | $curr_colAttr = Hash::MultiValue->new(%{$pk_table}); | |||||||||||||||||||||||||||
| 211 | 9 | $curr_colAttr->set('is_autoincre' => 1); | |||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||
| 213 | 9 | $col_attr = Hash::MultiValue->new(%{$col_attr}); | |||||||||||||||||||||||||||
| 214 | 9 | $col_attr->set($pk_list[0] => $curr_colAttr->as_hashref); | |||||||||||||||||||||||||||
| 215 | 9 | $col_attr = $col_attr->as_hashref; | |||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||
| 218 | 10 | $i = 0; | |||||||||||||||||||||||||||
| 219 | 10 | $new_colAttr = Hash::MultiValue->new(); | |||||||||||||||||||||||||||
| 220 | 10 | ▶ | while ($i < $until) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 221 | 47 | $col_name = $col_attr->{$col_list->[$i]}; | |||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||
| 223 | 47 | $new_colAttr->add($col_list->[$i] => $col_name); | |||||||||||||||||||||||||||
| 224 | 47 | $i++; | |||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||
| 226 | 10 | $col_attr = $new_colAttr->as_hashref; | |||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||
| 228 | 10 | return $col_attr; | |||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | # For Default field table : | ||||||||||||||||||||||||||||
| 232 | # ------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 233 | 0 | ▶ | sub default_field_tbl_val { | ||||||||||||||||||||||||||
|
Subroutine
default_field_tbl_val: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 234 | 0 | my ($type, $attr) = @_; | |||||||||||||||||||||||||||
| 235 | 0 | my $data = ''; | |||||||||||||||||||||||||||
| 236 | 0 | ▶ | if ($type eq 'datetime') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 237 | 0 | ▶ | if ($attr == 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 238 | 0 | $data = "CURRENT_TIMESTAMP"; | |||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||
| 240 | 0 | ▶ | if ($attr eq 'yes') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 241 | 0 | $data = "CURRENT_TIMESTAMP"; | |||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||
| 244 | 0 | return $data; | |||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||
| 247 | # For Create Column Attr : | ||||||||||||||||||||||||||||
| 248 | # ------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 249 | 47 | ▶ | sub create_colAttr { | ||||||||||||||||||||||||||
|
Subroutine
create_colAttr: called CC=21 SCAR=36.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 250 | 47 | my $self = shift; | |||||||||||||||||||||||||||
| 251 | 47 | my ($col_name, $attr, $db_type) = @_; | |||||||||||||||||||||||||||
| 252 | 47 | my $data = $col_name . ' '; | |||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||
| 254 | 47 | ▶ | if (exists $attr->{type}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 255 | 47 | ▶ | if ($db_type eq 'sqlite') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 256 | $data | ||||||||||||||||||||||||||||
| 257 | .= exists $attr->{type}->{name} | ||||||||||||||||||||||||||||
| 258 | 33 | ▶ | ? (uc $attr->{type}->{name}) . ' ' | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 259 | : 'varchar '; | ||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||
| 261 | else { | ||||||||||||||||||||||||||||
| 262 | $data | ||||||||||||||||||||||||||||
| 263 | .= exists $attr->{type}->{name} | ||||||||||||||||||||||||||||
| 264 | ? (uc $attr->{type}->{name}) | ||||||||||||||||||||||||||||
| 265 | 14 | ▶ | : 'varchar'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 266 | $data | ||||||||||||||||||||||||||||
| 267 | .= exists $attr->{type}->{size} | ||||||||||||||||||||||||||||
| 268 | 14 | ▶ | ? '(' . $attr->{type}->{size} . ') ' | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 269 | : ' '; | ||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||
| 273 | 47 | ▶ | unless (exists $attr->{custom}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 274 | 47 | ▶ | if (exists $attr->{default} and $attr->{default} ne '') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $attr->{"default"} and $attr->{"default"} ne ""
MC/DC0%0/2
exists $attr->{"default"} and $attr->{"default"} ne ""
exists $attr->{"default"}
$attr->{"default"} ne ""
Truth table33%1/3
A and B
A= exists $attr->{"default"}B= $attr->{"default"} ne ""
| |||||||||||||||||||||||||||||
| 275 | 0 | ▶ | if (exists $attr->{onupdate} and $attr->{onupdate} ne '') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $attr->{"onupdate"} and $attr->{"onupdate"} ne ""
MC/DC0%0/2
exists $attr->{"onupdate"} and $attr->{"onupdate"} ne ""
exists $attr->{"onupdate"}
$attr->{"onupdate"} ne ""
Truth table0%0/3
A and B
A= exists $attr->{"onupdate"}B= $attr->{"onupdate"} ne ""
| |||||||||||||||||||||||||||||
| 276 | my $field_default_val | ||||||||||||||||||||||||||||
| 277 | 0 | = default_field_tbl_val($attr->{type}->{name}, $attr->{onupdate}); | |||||||||||||||||||||||||||
| 278 | 0 | $data .= "ON UPDATE $field_default_val "; | |||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||
| 280 | else { | ||||||||||||||||||||||||||||
| 281 | 0 | $data .= "DEFAULT $attr->{default} "; | |||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||
| 285 | 47 | ▶ | if (exists $attr->{onupdate} and $attr->{onupdate} ne '') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $attr->{"onupdate"} and $attr->{"onupdate"} ne ""
MC/DC0%0/2
exists $attr->{"onupdate"} and $attr->{"onupdate"} ne ""
exists $attr->{"onupdate"}
$attr->{"onupdate"} ne ""
Truth table33%1/3
A and B
A= exists $attr->{"onupdate"}B= $attr->{"onupdate"} ne ""
| |||||||||||||||||||||||||||||
| 286 | my $field_default_val | ||||||||||||||||||||||||||||
| 287 | 0 | = default_field_tbl_val($attr->{type}->{name}, $attr->{onupdate}); | |||||||||||||||||||||||||||
| 288 | 0 | $data .= "ON UPDATE $field_default_val "; | |||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||
| 291 | 47 | ▶ | if (exists $attr->{is_null}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 292 | 17 | ▶ | $data .= 'NOT NULL ' unless $attr->{is_null}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 293 | 17 | ▶ | $data .= 'NULL ' if $attr->{is_null} == 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||
| 295 | else { | ||||||||||||||||||||||||||||
| 296 | 30 | $data .= 'NOT NULL '; | |||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||
| 299 | 47 | ▶ | if (exists $attr->{is_primarykey} and $attr->{is_primarykey} == 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $attr->{"is_primarykey"} and $attr->{"is_primarykey"} == 1
MC/DC50%1/2
exists $attr->{"is_primarykey"} and $attr->{"is_primarykey"} == 1
exists $attr->{"is_primarykey"}
$attr->{"is_primarykey"} == 1
Truth table66%2/3
A and B
A= exists $attr->{"is_primarykey"}B= $attr->{"is_primarykey"} == 1
| |||||||||||||||||||||||||||||
| 300 | 10 | $data .= 'PRIMARY KEY '; | |||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||
| 303 | 47 | ▶ | if (exists $attr->{is_autoincre} and $attr->{is_autoincre} == 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $attr->{"is_autoincre"} and $attr->{"is_autoincre"} == 1
MC/DC50%1/2
exists $attr->{"is_autoincre"} and $attr->{"is_autoincre"} == 1
exists $attr->{"is_autoincre"}
$attr->{"is_autoincre"} == 1
Truth table66%2/3
A and B
A= exists $attr->{"is_autoincre"}B= $attr->{"is_autoincre"} == 1
| |||||||||||||||||||||||||||||
| 304 | 9 | ▶ | if ($db_type eq 'sqlite') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 305 | 6 | $data .= 'AUTOINCREMENT '; | |||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||
| 307 | else { | ||||||||||||||||||||||||||||
| 308 | 3 | $data .= 'AUTO_INCREMENT '; | |||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||
| 310 | } | ||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||
| 312 | 47 | $data = trim($data); | |||||||||||||||||||||||||||
| 313 | 47 | $data = "\t$data"; | |||||||||||||||||||||||||||
| 314 | 47 | return $data; | |||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||
| 317 | # For create query table : | ||||||||||||||||||||||||||||
| 318 | # ------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 319 | 10 | ▶ | sub create_query_table { | ||||||||||||||||||||||||||
|
Subroutine
create_query_table: called CC=20 SCAR=32.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 320 | 10 | my $self = shift; | |||||||||||||||||||||||||||
| 321 | 10 | my $arg_len = scalar @_; | |||||||||||||||||||||||||||
| 322 | 10 | my ($table_name, $col_list, $col_attr, $table_attr, $db_type); | |||||||||||||||||||||||||||
| 323 | 10 | my $data = ''; | |||||||||||||||||||||||||||
| 324 | 10 | my $size_tblAttr = 0; | |||||||||||||||||||||||||||
| 325 | 10 | $db_type = $self->db_type; | |||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||
| 327 | 10 | ▶ | if ($arg_len == 3) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 328 | 5 | ($table_name, $col_list, $col_attr) = @_; | |||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||
| 331 | 10 | ▶ | if ($arg_len == 4) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 332 | 5 | ($table_name, $col_list, $col_attr, $table_attr) = @_; | |||||||||||||||||||||||||||
| 333 | 5 | ▶ | if (ref($table_attr) eq "HASH") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 334 | 5 | $size_tblAttr = scalar keys %{$table_attr}; | |||||||||||||||||||||||||||
| 335 | } | ||||||||||||||||||||||||||||
| 336 | else { | ||||||||||||||||||||||||||||
| 337 | 0 | $table_attr = {}; | |||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||
| 341 | 10 | ▶ | if ($arg_len >= 5) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 342 | 0 | ($table_name, $col_list, $col_attr, $table_attr, $self->db_type) = @_; | |||||||||||||||||||||||||||
| 343 | 0 | $size_tblAttr = scalar keys %{$table_attr}; | |||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||
| 346 | 10 | $col_attr = $self->table_col_attr_val($col_list, $col_attr); | |||||||||||||||||||||||||||
| 347 | 10 | $table_attr = $self->table_attr_val($col_attr, $table_attr); | |||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||
| 349 | 10 | my $size_col = scalar @{$col_list}; | |||||||||||||||||||||||||||
| 350 | 10 | my $i = 0; | |||||||||||||||||||||||||||
| 351 | 10 | my @list_col = (); | |||||||||||||||||||||||||||
| 352 | 10 | ▶ | while ($i < $size_col) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 353 | push @list_col, | ||||||||||||||||||||||||||||
| 354 | 47 | $self->create_colAttr($col_list->[$i], $col_attr->{$col_list->[$i]}, | |||||||||||||||||||||||||||
| 355 | $self->db_type); | ||||||||||||||||||||||||||||
| 356 | 47 | $i++; | |||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||
| 358 | 10 | my $list_column = join ",\n", @list_col; | |||||||||||||||||||||||||||
| 359 | 10 | my $fk_table = ''; | |||||||||||||||||||||||||||
| 360 | 10 | my $index_table = ''; | |||||||||||||||||||||||||||
| 361 | 10 | my $attr_table = ''; | |||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||
| 363 | 10 | $data .= "CREATE TABLE IF NOT EXISTS $table_name(\n"; | |||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||
| 365 | 10 | ▶ | if ($size_tblAttr != 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 366 | 5 | $data .= "$list_column"; | |||||||||||||||||||||||||||
| 367 | 5 | my $size_fk = 0; | |||||||||||||||||||||||||||
| 368 | 5 | ▶ | if (exists $table_attr->{fk}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 369 | 4 | $size_fk = 1; | |||||||||||||||||||||||||||
| 370 | 4 | $fk_table = $table_attr->{fk}; | |||||||||||||||||||||||||||
| 371 | 4 | $data .= ",\n$fk_table"; | |||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||
| 373 | 5 | ▶ | if (exists $table_attr->{index}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 374 | 0 | $index_table = $table_attr->{index}; | |||||||||||||||||||||||||||
| 375 | 0 | $data .= ",\n$index_table"; | |||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||
| 377 | 5 | ▶ | if (exists $table_attr->{attr} and $table_attr->{attr} ne '') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $table_attr->{"attr"} and $table_attr->{"attr"} ne ""
MC/DC0%0/2
exists $table_attr->{"attr"} and $table_attr->{"attr"} ne ""
exists $table_attr->{"attr"}
$table_attr->{"attr"} ne ""
Truth table33%1/3
A and B
A= exists $table_attr->{"attr"}B= $table_attr->{"attr"} ne ""
| |||||||||||||||||||||||||||||
| 378 | 5 | ▶ | if ($size_fk == 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 379 | 4 | $attr_table = $table_attr->{attr}; | |||||||||||||||||||||||||||
| 380 | 4 | ▶ | $data .= $db_type eq 'sqlite' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$db_type eq "sqlite" or $db_type eq "pg"
MC/DC100%2/2
$db_type eq "sqlite" or $db_type eq "pg"
$db_type eq "sqlite"
$db_type eq "pg"
Truth table100%3/3
A or B
A= $db_type eq "sqlite"B= $db_type eq "pg"
| |||||||||||||||||||||||||||||
| 381 | || $db_type eq 'pg' ? " \n)" : ") $attr_table"; | ||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||
| 383 | else { | ||||||||||||||||||||||||||||
| 384 | 1 | ▶ | $data .= $db_type eq 'sqlite' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$db_type eq "sqlite" or $db_type eq "pg"
MC/DC0%0/2
$db_type eq "sqlite" or $db_type eq "pg"
$db_type eq "sqlite"
$db_type eq "pg"
Truth table33%1/3
A or B
A= $db_type eq "sqlite"B= $db_type eq "pg"
| |||||||||||||||||||||||||||||
| 385 | || $db_type eq 'pg' ? " \n)" : ") ENGINE=InnoDB DEFAULT CHARSET=utf8"; | ||||||||||||||||||||||||||||
| 386 | } | ||||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||
| 388 | else { | ||||||||||||||||||||||||||||
| 389 | 0 | ▶ | $data .= $db_type eq 'sqlite' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$db_type eq "sqlite" or $db_type eq "pg"
MC/DC0%0/2
$db_type eq "sqlite" or $db_type eq "pg"
$db_type eq "sqlite"
$db_type eq "pg"
Truth table0%0/3
A or B
A= $db_type eq "sqlite"B= $db_type eq "pg"
| |||||||||||||||||||||||||||||
| 390 | || $db_type eq 'pg' ? " \n)" : ") ENGINE=InnoDB DEFAULT CHARSET=utf8"; | ||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||
| 393 | } | ||||||||||||||||||||||||||||
| 394 | else { | ||||||||||||||||||||||||||||
| 395 | 5 | $data .= "$list_column\n"; | |||||||||||||||||||||||||||
| 396 | 5 | ▶ | $data .= $db_type eq 'sqlite' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$db_type eq "sqlite" or $db_type eq "pg"
MC/DC100%2/2
$db_type eq "sqlite" or $db_type eq "pg"
$db_type eq "sqlite"
$db_type eq "pg"
Truth table100%3/3
A or B
A= $db_type eq "sqlite"B= $db_type eq "pg"
| |||||||||||||||||||||||||||||
| 397 | || $db_type eq 'pg' ? ")" : ") ENGINE=InnoDB DEFAULT CHARSET=utf8"; | ||||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||
| 399 | 10 | return $data; | |||||||||||||||||||||||||||
| 400 | } | ||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||
| 402 | ####################################################################################### | ||||||||||||||||||||||||||||
| 403 | # FOR Helper | ||||||||||||||||||||||||||||
| 404 | ####################################################################################### | ||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||
| 406 | # For check engine : | ||||||||||||||||||||||||||||
| 407 | # ------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 408 | 3 | ▶ | sub _check_engine { | ||||||||||||||||||||||||||
|
Subroutine
_check_engine: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||
| 409 | 3 | my ($self, $engine) = @_; | |||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||
| 411 | 3 | $engine = lc $engine; | |||||||||||||||||||||||||||
| 412 | 3 | my %list_engine = ('myisam' => 'MyISAM', 'innodb' => 'InnoDB',); | |||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||
| 414 | 3 | ▶ | if (exists $list_engine{$engine}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 415 | 3 | return $list_engine{$engine}; | |||||||||||||||||||||||||||
| 416 | } | ||||||||||||||||||||||||||||
| 417 | else { | ||||||||||||||||||||||||||||
| 418 | 0 | return $list_engine{'innodb'}; | |||||||||||||||||||||||||||
| 419 | } | ||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||
| 422 | 17 | 1; | |||||||||||||||||||||||||||