| 1 | package DBIO::MySQL::Diff::Column; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: Diff operations for MySQL/MariaDB columns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 58 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 58 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 58 | our $VERSION = '0.900007'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 58 | ▶ | use base 'DBIO::Diff::Op'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 58 | ▶ | use DBIO::Diff::Compare qw(changed_fields column_change_lossy); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 58 | ▶ | use DBIO::MySQL::Identifier qw(quote_ident quote_table_in); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 58 | ▶ | use DBIO::MySQL::DefaultValue qw(default_sql on_update_sql); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 58 | ▶ | use DBIO::MySQL::Diff::View (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 58 | __PACKAGE__->mk_diff_accessors(qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | table_name column_name old_info new_info table_collation database | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | )); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 177 | ▶ | sub diff { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
diff: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 177 | my ($class, $source_cols, $target_cols, $source_tables, $target_tables) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | # a view is no table, and its columns are not diffed (karr k79) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 177 | ($source_tables, $source_cols) = DBIO::MySQL::Diff::View::without_views($source_tables, $source_cols); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 177 | ($target_tables, $target_cols) = DBIO::MySQL::Diff::View::without_views($target_tables, $target_cols); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | # A table whose collation changes is converted (DBIO::MySQL::Diff::Table, karr | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | # k109), which gives every text column the character set and collation of the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | # target: they are not compared, a MODIFY COLUMN could not even write them. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 177 | $source_cols = _converted_columns($source_cols, $target_cols, $source_tables, $target_tables); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | my @ops = $class->diff_nested( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | $source_cols, $target_cols, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | index_by => 'column_name', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | source_tables => $source_tables, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | target_tables => $target_tables, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | changed_when => \&_mysql_column_changed, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 22 | ▶ | on_new => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 22 | my ($table_name, $column_name, $new_info) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | $class->new(action => 'add', table_name => $table_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | column_name => $column_name, new_info => $new_info, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 22 | ▶ | table_collation => ($target_tables->{$table_name} // {})->{table_collation}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$target_tables->{$table_name} // {}
MC/DC0%0/1
$target_tables->{$table_name} // {}
$target_tables->{$table_name}
Truth table50%1/2
A
A= $target_tables->{$table_name}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 35 | ▶ | on_changed => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 35 | my ($table_name, $column_name, $old_info, $new_info) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | $class->new(action => 'modify', table_name => $table_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | column_name => $column_name, old_info => $old_info, new_info => $new_info, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 35 | ▶ | table_collation => ($target_tables->{$table_name} // {})->{table_collation}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$target_tables->{$table_name} // {}
MC/DC0%0/1
$target_tables->{$table_name} // {}
$target_tables->{$table_name}
Truth table50%1/2
A
A= $target_tables->{$table_name}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 15 | ▶ | on_gone => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 15 | my ($table_name, $column_name, $old_info) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 15 | $class->new(action => 'drop', table_name => $table_name, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | column_name => $column_name, old_info => $old_info); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 177 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | # diff_nested walks the columns by name. The columns a table gains are added | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | # in the order the target declares them, so a table the diff extends has | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | # them in the order a fresh one has (karr k92): the places the adds of a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | # table hold are filled again with them in the order of the target. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 177 | my %adds; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 177 | for my $op (grep { $_->action eq 'add' } @ops) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 22 | push @{ $adds{ $op->table_name } }, $op; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 177 | for my $table (keys %adds) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 21 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 21 | ▶ | my %pos = map { ($_->{column_name} => $i++) } @{ $target_cols->{$table} // [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$target_cols->{$table} // []
MC/DC0%0/1
$target_cols->{$table} // []
$target_cols->{$table}
Truth table50%1/2
A
A= $target_cols->{$table}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 21 | $adds{$table} = [ sort { $pos{ $a->column_name } <=> $pos{ $b->column_name } } @{ $adds{$table} } ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 177 | ▶ | return map { $_->action eq 'add' ? shift @{ $adds{ $_->table_name } } : $_ } @ops; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | # The source columns of the tables whose collation changes, with the character | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | # set and collation the conversion gives them: those of the target table. A | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | # column with a collation of its own in the target is modified after it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | # (collation_sql, karr k111). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 177 | ▶ | sub _converted_columns { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_converted_columns: called CC=13 SCAR=26.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 177 | my ($source_cols, $target_cols, $source_tables, $target_tables) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 177 | ▶ | my %out = %{ $source_cols // {} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$source_cols // {}
MC/DC0%0/1
$source_cols // {}
$source_cols
Truth table50%1/2
A
A= $source_cols
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 177 | for my $table (keys %out) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 174 | my ($old, $new) = ($source_tables->{$table}, $target_tables->{$table}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 174 | ▶ | next unless $old && $new && defined $old->{table_collation} && defined $new->{table_collation}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition88%8/9
$old and $new and defined $old->{"table_collation"} and defined $new->{"table_collation"}
$old and $new and defined $old->{"table_collation"}
$old and $new
MC/DC75%3/4
$old and $new and defined $old->{"table_collation"} and defined $new->{"table_collation"}
$old
$new
defined $old->{"table_collation"}
defined $new->{"table_collation"}
Truth table80%4/5
A and B and C and D
A= $oldB= $newC= defined $old->{"table_collation"}D= defined $new->{"table_collation"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 15 | ▶ | next if lc $old->{table_collation} eq lc $new->{table_collation}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 7 | ▶ | my %target = map { $_->{column_name} => $_ } @{ $target_cols->{$table} // [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$target_cols->{$table} // []
MC/DC0%0/1
$target_cols->{$table} // []
$target_cols->{$table}
Truth table50%1/2
A
A= $target_cols->{$table}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 7 | my ($charset) = $new->{table_collation} =~ /\A([^_]+)_/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | $out{$table} = [ map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 13 | my $t = $target{ $_->{column_name} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | ($t && defined $_->{character_set} && defined $t->{character_set} && defined $charset) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | ? { %$_, character_set => $charset, collation => $new->{table_collation} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 13 | ▶ | : $_ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%6/9
$t and defined $_->{"character_set"} and defined $t->{"character_set"} and defined $charset
$t and defined $_->{"character_set"} and defined $t->{"character_set"}
$t and defined $_->{"character_set"}
MC/DC25%1/4
$t and defined $_->{"character_set"} and defined $t->{"character_set"} and defined $charset
$t
defined $_->{"character_set"}
defined $t->{"character_set"}
defined $charset
Truth table40%2/5
A and B and C and D
A= $tB= defined $_->{"character_set"}C= defined $t->{"character_set"}D= defined $charset
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 7 | } @{ $out{$table} } ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 177 | return \%out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | # MySQL-specific field spec. Compares type/character-set/precision as | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | # scalar strings, not_null/default_value/comment as the canonical model | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | # does. desired_state => 1 means "if the target left it undef, treat as | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | # don't-care" (we do not know what the live DB will assign for charset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | # on a portable text column, see Diff.pm ESCALATION NOTE). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 272 | ▶ | sub _mysql_column_changed { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mysql_column_changed: called CC=18 SCAR=28.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 272 | my ($old, $new) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 272 | my @changed = changed_fields($old, $new, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | type => ['data_type'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | scalar => [qw(default_value character_set collation comment)], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | bool => ['not_null'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | dim => [qw(numeric_precision numeric_scale datetime_precision)], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | array => ['values'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | desired_state => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | # column_type carries the parameterised type (char(32), decimal(10,2)) and is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | # the real width/precision discriminator, so it is compared here rather than as | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | # a plain scalar: MySQL 8.0.17+ drops the *display width* from integer types | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | # (bigint(20) -> bigint) while MariaDB and MySQL < 8.0.17 keep it. Normalising | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | # the integer display width away on BOTH sides keeps that server-version | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | # difference from surfacing as a phantom MODIFY. Desired-state contract: only | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | # compare when the target ($new) prescribes a column_type. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 272 | ▶ | if (defined $new->{column_type} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $new->{"column_type"} and _norm_int_display_width($old->{"column_type"}) ne _norm_int_display_width($new->{"column_type"})
MC/DC50%1/2
defined $new->{"column_type"} and _norm_int_display_width($old->{"column_type"}) ne _norm_int_display_width($new->{"column_type"})
defined $new->{"column_type"}
_norm_int_display_width($old->{"column_type"}) ne _norm_int_display_width($new->{"column_type"})
Truth table66%2/3
A and B
A= defined $new->{"column_type"}B= _norm_int_display_width($old->{"column_type"}) ne _norm_int_display_width($new->{"column_type"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | && _norm_int_display_width($old->{column_type}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | ne _norm_int_display_width($new->{column_type})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 15 | push @changed, 'column_type'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | # A target that says whether its default is an expression (the introspection | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | # does for every column, the temporary database of an upgrade among them) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | # describes the whole column, and there default_value undef means "no | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | # default": the one the live column has is removed (karr k95). A target | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | # without that key (target_from_compiled) does not prescribe "none", and the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | # live default is left alone, as changed_fields does for every undef. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | push @changed, 'default_value' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | if !defined $new->{default_value} && defined $new->{default_is_expression} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 272 | ▶ | && defined $old->{default_value}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
not defined $new->{"default_value"} and defined $new->{"default_is_expression"} and defined $old->{"default_value"}
not defined $new->{"default_value"} and defined $new->{"default_is_expression"}
MC/DC100%3/3
not defined $new->{"default_value"} and defined $new->{"default_is_expression"} and defined $old->{"default_value"}
not defined $new->{"default_value"}
defined $new->{"default_is_expression"}
defined $old->{"default_value"}
Truth table100%4/4
not(A) and B and C
A= not defined $new->{"default_value"}B= defined $new->{"default_is_expression"}C= defined $old->{"default_value"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | # A default that is an expression on one side and a literal on the other is a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | # change even when the text is the same (karr k78); asked only when the target | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | # prescribes a default, like default_value itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | push @changed, 'default_is_expression' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | if defined $new->{default_value} && defined $old->{default_value} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 272 | ▶ | && ($old->{default_is_expression} ? 1 : 0) != ($new->{default_is_expression} ? 1 : 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition83%5/6
defined $new->{"default_value"} and defined $old->{"default_value"} and ($old->{"default_is_expression"} ? 1 : 0) != ($new->{"default_is_expression"} ? 1 : 0)
defined $new->{"default_value"} and defined $old->{"default_value"}
MC/DC66%2/3
defined $new->{"default_value"} and defined $old->{"default_value"} and ($old->{"default_is_expression"} ? 1 : 0) != ($new->{"default_is_expression"} ? 1 : 0)
defined $new->{"default_value"}
defined $old->{"default_value"}
($old->{"default_is_expression"} ? 1 : 0) != ($new->{"default_is_expression"} ? 1 : 0)
Truth table75%3/4
A and B and C
A= defined $new->{"default_value"}B= defined $old->{"default_value"}C= ($old->{"default_is_expression"} ? 1 : 0) != ($new->{"default_is_expression"} ? 1 : 0)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | # ON UPDATE (karr k108) is part of the column the introspection describes, so a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | # target that has the key says "none" with undef and the live one is removed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | # A target without the key (target_from_compiled) does not prescribe it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | push @changed, 'on_update' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | if exists $new->{on_update} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 272 | ▶ | && uc($old->{on_update} // '') ne uc($new->{on_update} // ''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%7/7
exists $new->{"on_update"} and uc($old->{"on_update"} // "") ne uc($new->{"on_update"} // "")
$old->{"on_update"} // ""
$new->{"on_update"} // ""
MC/DC100%2/2
exists $new->{"on_update"} and uc($old->{"on_update"} // "") ne uc($new->{"on_update"} // "")
exists $new->{"on_update"}
$old->{"on_update"}
MC/DC100%1/1
$new->{"on_update"} // ""
$new->{"on_update"}
Truth table100%3/3
A and B
A= exists $new->{"on_update"}B= $old->{"on_update"}
Truth table100%2/2
A
A= $new->{"on_update"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | # AUTO_INCREMENT is compared outright, not under the desired-state contract: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | # both models carry it as 0 or 1 (introspection, target_from_compiled), and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | # a column that gains or loses it is a change (karr k93). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | push @changed, 'is_auto_increment' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 272 | ▶ | if ($old->{is_auto_increment} ? 1 : 0) != ($new->{is_auto_increment} ? 1 : 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 272 | return scalar @changed; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | # Strip the parenthesised display width from integer-family column types | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | # (int / integer / tinyint / smallint / mediumint / bigint), e.g. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | # 'bigint(20)' -> 'bigint', 'int(10) unsigned' -> 'int unsigned'. tinyint(1) is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | # preserved because MySQL keeps that width to signal BOOLEAN. decimal / numeric | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | # / char / varchar widths are NOT stripped -- there the parenthesised value is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | # semantic, not a display width. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 544 | ▶ | sub _norm_int_display_width { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_norm_int_display_width: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 544 | my ($ct) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 544 | ▶ | return '' unless defined $ct; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 544 | my $s = lc $ct; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 544 | $s =~ s/\s+/ /g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 544 | $s =~ s/^\s+|\s+$//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 544 | $s =~ s/\btinyint\((?!1\))\d+\)/tinyint/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 544 | $s =~ s/\b(bigint|smallint|mediumint|integer|int)\(\d+\)/$1/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 544 | return $s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 58 | our %LOSSLESS_PAIRS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 58 | my @ladders = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | [qw(tinyint smallint mediumint int bigint)], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | [qw(tinytext text mediumtext longtext)], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | [qw(tinyblob blob mediumblob longblob)], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 58 | for my $ladder (@ladders) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 174 | for my $from (0 .. $#$ladder - 1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 580 | $LOSSLESS_PAIRS{"$ladder->[$from]->$ladder->[$_]"} = 1 for $from + 1 .. $#$ladder; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 58 | $LOSSLESS_PAIRS{'char->varchar'} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 58 | for my $from (qw(char varchar)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 116 | $LOSSLESS_PAIRS{"$from->$_"} = 1 for qw(text mediumtext longtext); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 58 | $LOSSLESS_PAIRS{'binary->varbinary'} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 58 | $LOSSLESS_PAIRS{"varbinary->$_"} = 1 for qw(blob mediumblob longblob); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 58 | $LOSSLESS_PAIRS{'date->datetime'} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | # the aliases the server reports one name for | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 58 | my %ALIAS = (integer => 'int', numeric => 'decimal', bool => 'tinyint', boolean => 'tinyint'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | # types whose size is the length or the fractional seconds in the parentheses | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 58 | my %SIZED = map { $_ => 1 } qw(char varchar binary varbinary bit datetime timestamp time); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 38 | ▶ | sub lossy { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
lossy: called CC=29 SCAR=34.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 38 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 38 | ▶ | return 0 unless $self->action eq 'modify'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 34 | ▶ | my ($old, $new) = ($self->old_info // {}, $self->new_info // {}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$self->old_info // {}
$self->new_info // {}
MC/DC0%0/1
$self->old_info // {}
$self->old_info
MC/DC0%0/1
$self->new_info // {}
$self->new_info
Truth table50%1/2
A
A= $self->old_info
Truth table50%1/2
A
A= $self->new_info
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 34 | my ($ot, $nt) = map { _base_type($_->{data_type}) } $old, $new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 34 | ▶ | $nt = $ot unless length $nt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 34 | ▶ | my $ctype = defined $new->{column_type} ? lc $new->{column_type} : lc($old->{column_type} // ''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$old->{"column_type"} // ""
MC/DC0%0/1
$old->{"column_type"} // ""
$old->{"column_type"}
Truth table50%1/2
A
A= $old->{"column_type"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 34 | ▶ | my $otype = lc($old->{column_type} // ''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$old->{"column_type"} // ""
MC/DC100%1/1
$old->{"column_type"} // ""
$old->{"column_type"}
Truth table100%2/2
A
A= $old->{"column_type"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 34 | ▶ | return 1 if ($otype =~ /\bunsigned\b/ ? 1 : 0) != ($ctype =~ /\bunsigned\b/ ? 1 : 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | return 1 if defined $new->{character_set} && defined $old->{character_set} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 32 | ▶ | && lc $new->{character_set} ne lc $old->{character_set}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
defined $new->{"character_set"} and defined $old->{"character_set"} and lc $new->{"character_set"} ne lc $old->{"character_set"}
defined $new->{"character_set"} and defined $old->{"character_set"}
MC/DC66%2/3
defined $new->{"character_set"} and defined $old->{"character_set"} and lc $new->{"character_set"} ne lc $old->{"character_set"}
defined $new->{"character_set"}
defined $old->{"character_set"}
lc $new->{"character_set"} ne lc $old->{"character_set"}
Truth table75%3/4
A and B and C
A= defined $new->{"character_set"}B= defined $old->{"character_set"}C= lc $new->{"character_set"} ne lc $old->{"character_set"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 31 | ▶ | if ($nt eq 'enum' || $nt eq 'set') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$nt eq "enum" or $nt eq "set"
MC/DC50%1/2
$nt eq "enum" or $nt eq "set"
$nt eq "enum"
$nt eq "set"
Truth table66%2/3
A or B
A= $nt eq "enum"B= $nt eq "set"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 3 | ▶ | return 1 unless $ot eq $nt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 3 | ▶ | my @was = @{ $old->{values} // [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$old->{"values"} // []
MC/DC0%0/1
$old->{"values"} // []
$old->{"values"}
Truth table50%1/2
A
A= $old->{"values"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 3 | ▶ | my @now = @{ $new->{values} // $old->{values} // [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition40%2/5
($new->{"values"} // $old->{"values"}) // []
$new->{"values"} // $old->{"values"}
MC/DC0%0/2
($new->{"values"} // $old->{"values"}) // []
$new->{"values"}
$old->{"values"}
Truth table33%1/3
A // B
A= $new->{"values"}B= $old->{"values"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 3 | ▶ | return 1 if @now < @was || grep { $was[$_] ne $now[$_] } 0 .. $#was; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@now < @was or grep {$was[$_] ne $now[$_];} 0 .. $#was
MC/DC100%2/2
@now < @was or grep {$was[$_] ne $now[$_];} 0 .. $#was
@now < @was
grep {$was[$_] ne $now[$_];} 0 .. $#was
Truth table100%3/3
A or B
A= @now < @wasB= grep {$was[$_] ne $now[$_];} 0 .. $#was
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 1 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | # a type without a size of its own: another parameterised string is a change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | # of the type itself (float(7,3) for float) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | return 1 if $ot eq $nt && !$SIZED{$nt} && $nt !~ /\A(?:tinyint|smallint|mediumint|int|bigint|decimal)\z/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 28 | ▶ | && defined $new->{column_type} && $otype ne $ctype; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%12/12
$ot eq $nt and not $SIZED{$nt} and not $nt =~ /\A(?:tinyint|smallint|mediumint|int|bigint|decimal)\z/ and defined $new->{"column_type"} and $otype ne $ctype
$ot eq $nt and not $SIZED{$nt} and not $nt =~ /\A(?:tinyint|smallint|mediumint|int|bigint|decimal)\z/ and defined $new->{"column_type"}
$ot eq $nt and not $SIZED{$nt} and not $nt =~ /\A(?:tinyint|smallint|mediumint|int|bigint|decimal)\z/
$ot eq $nt and not $SIZED{$nt}
MC/DC100%5/5
$ot eq $nt and not $SIZED{$nt} and not $nt =~ /\A(?:tinyint|smallint|mediumint|int|bigint|decimal)\z/ and defined $new->{"column_type"} and $otype ne $ctype
$ot eq $nt
not $SIZED{$nt}
not $nt =~ /\A(?:tinyint|smallint|mediumint|int|bigint|decimal)\z/
defined $new->{"column_type"}
$otype ne $ctype
Truth table100%6/6
A and not(B) and not(C) and D and E
A= $ot eq $ntB= not $SIZED{$nt}C= not $nt =~ /\A(?:tinyint|smallint|mediumint|int|bigint|decimal)\z/D= defined $new->{"column_type"}E= $otype ne $ctype
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | return column_change_lossy( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 27 | ▶ | _sized($old, $ot), _sized({ column_type => $new->{column_type} // $old->{column_type} }, $nt), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$new->{"column_type"} // $old->{"column_type"}
MC/DC50%1/2
$new->{"column_type"} // $old->{"column_type"}
$new->{"column_type"}
$old->{"column_type"}
Truth table66%2/3
A // B
A= $new->{"column_type"}B= $old->{"column_type"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | \%LOSSLESS_PAIRS, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | ) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 68 | ▶ | sub _base_type { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_base_type: called CC=3 SCAR=11.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 68 | my ($t) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 68 | ▶ | $t = lc($t // ''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$t // ""
MC/DC100%1/1
$t // ""
$t
Truth table100%2/2
A
A= $t
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 68 | $t =~ s/\s.*\z//s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 68 | ▶ | return $ALIAS{$t} // $t; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$ALIAS{$t} // $t
MC/DC0%0/2
$ALIAS{$t} // $t
$ALIAS{$t}
$t
Truth table33%1/3
A // B
A= $ALIAS{$t}B= $t
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | # The info as column_change_lossy reads it: data_type and a size that means | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | # something. Integers carry none (their width is for display). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 54 | ▶ | sub _sized { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_sized: called CC=13 SCAR=26.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 54 | my ($info, $type) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 54 | ▶ | my $ct = $info->{column_type} // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$info->{"column_type"} // ""
MC/DC100%1/1
$info->{"column_type"} // ""
$info->{"column_type"}
Truth table100%2/2
A
A= $info->{"column_type"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 54 | my $size; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 54 | ▶ | if ($type eq 'decimal') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 4 | ▶ | my ($p, $s) = $ct =~ /\(\s*(\d+)\s*(?:,\s*(\d+))?\s*\)/ ? ($1, $2 // 0) : (10, 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$2 // 0
MC/DC0%0/1
$2 // 0
$2
Truth table50%1/2
A
A= $2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 4 | $size = [ $p, $s ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | elsif ($SIZED{$type}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 24 | ($size) = $ct =~ /\(\s*(\d+)/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 24 | ▶ | $size //= 0 if $type =~ /\A(?:datetime|timestamp|time)\z/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$size //= 0
MC/DC100%1/1
$size //= 0
$size
Truth table100%2/2
A
A= $size
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 24 | ▶ | $size //= 1 if $type eq 'bit' || $type eq 'char' || $type eq 'binary'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition62%5/8
$type eq "bit" or $type eq "char" or $type eq "binary"
$type eq "bit" or $type eq "char"
$size //= 1
MC/DC33%1/3
$type eq "bit" or $type eq "char" or $type eq "binary"
$type eq "bit"
$type eq "char"
$type eq "binary"
MC/DC0%0/1
$size //= 1
$size
Truth table50%2/4
A or B or C
A= $type eq "bit"B= $type eq "char"C= $type eq "binary"
Truth table50%1/2
A
A= $size
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 54 | ▶ | return { data_type => $type, (defined $size ? (size => $size) : ()) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 192 | ▶ | sub collation_sql { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
collation_sql: called CC=11 SCAR=24.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 192 | my ($info, $table_collation) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 192 | ▶ | my ($charset, $collation) = map { defined $_ && length $_ ? lc $_ : undef } @{$info}{qw(character_set collation)}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $_ and length $_
MC/DC50%1/2
defined $_ and length $_
defined $_
length $_
Truth table66%2/3
A and B
A= defined $_B= length $_
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 192 | ▶ | return '' unless defined $charset || defined $collation; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $charset or defined $collation
MC/DC50%1/2
defined $charset or defined $collation
defined $charset
defined $collation
Truth table66%2/3
A or B
A= defined $charsetB= defined $collation
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 9 | ▶ | if (defined $table_collation) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 8 | my $default = lc $table_collation; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 8 | my ($default_charset) = $default =~ /\A([^_]+)_/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 8 | ▶ | return '' if defined $collation ? $collation eq $default | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
defined $default_charset and $charset eq $default_charset
MC/DC0%0/2
defined $default_charset and $charset eq $default_charset
defined $default_charset
$charset eq $default_charset
Truth table33%1/3
A and B
A= defined $default_charsetB= $charset eq $default_charset
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | : (defined $default_charset && $charset eq $default_charset); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 6 | ▶ | return (defined $charset ? " CHARACTER SET $charset" : '') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | . (defined $collation ? " COLLATE $collation" : ''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 86 | ▶ | sub as_sql { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
as_sql: called CC=9 SCAR=22.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 86 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 86 | my $tbl = quote_table_in($self->database, $self->table_name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 86 | my $col = quote_ident($self->column_name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 86 | ▶ | if ($self->action eq 'add') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 27 | return sprintf 'ALTER TABLE %s %s;', $tbl, $self->add_clause; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 59 | ▶ | if ($self->action eq 'drop') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 15 | return sprintf 'ALTER TABLE %s DROP COLUMN %s;', $tbl, $col; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 44 | ▶ | if ($self->action eq 'modify') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 44 | my $info = $self->new_info; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 44 | ▶ | my $type = $info->{column_type} || $info->{data_type} || 'text'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition40%2/5
$info->{'column_type'} || $info->{'data_type'} || 'text'
$info->{"column_type"} or $info->{"data_type"}
MC/DC0%0/2
$info->{'column_type'} || $info->{'data_type'} || 'text'
$info->{"column_type"}
$info->{"data_type"}
Truth table33%1/3
A or B
A= $info->{"column_type"}B= $info->{"data_type"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 44 | my $sql = sprintf 'ALTER TABLE %s MODIFY COLUMN %s %s', $tbl, $col, $type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 44 | $sql .= collation_sql($info, $self->table_collation); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 44 | ▶ | $sql .= ' NOT NULL' if $info->{not_null}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 44 | ▶ | $sql .= ' AUTO_INCREMENT' if $info->{is_auto_increment}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 44 | ▶ | if (defined $info->{default_value}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 8 | $sql .= " DEFAULT " . default_sql($info->{default_value}, $info->{default_is_expression}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 44 | $sql .= on_update_sql($info->{on_update}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 44 | return "$sql;"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 29 | ▶ | sub add_clause { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_clause: called CC=7 SCAR=19.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 29 | my ($self, $auto_increment) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 29 | my $info = $self->new_info; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 29 | ▶ | my $type = $info->{column_type} || $info->{data_type} || 'text'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition40%2/5
$info->{'column_type'} || $info->{'data_type'} || 'text'
$info->{"column_type"} or $info->{"data_type"}
MC/DC0%0/2
$info->{'column_type'} || $info->{'data_type'} || 'text'
$info->{"column_type"}
$info->{"data_type"}
Truth table33%1/3
A or B
A= $info->{"column_type"}B= $info->{"data_type"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 29 | my $sql = sprintf 'ADD COLUMN %s %s', quote_ident($self->column_name), $type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 29 | $sql .= collation_sql($info, $self->table_collation); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 29 | ▶ | $sql .= ' NOT NULL' if $info->{not_null}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 29 | ▶ | $sql .= ' AUTO_INCREMENT' if $auto_increment && $info->{is_auto_increment}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$auto_increment and $info->{"is_auto_increment"}
MC/DC50%1/2
$auto_increment and $info->{"is_auto_increment"}
$auto_increment
$info->{"is_auto_increment"}
Truth table66%2/3
A and B
A= $auto_incrementB= $info->{"is_auto_increment"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | $sql .= " DEFAULT " . default_sql($info->{default_value}, $info->{default_is_expression}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 29 | ▶ | if defined $info->{default_value}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 29 | $sql .= on_update_sql($info->{on_update}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 29 | return $sql; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 3 | ▶ | sub summary { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
summary: called CC=4 SCAR=14.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 3 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 3 | ▶ | my $prefix = $self->action eq 'add' ? '+' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | : $self->action eq 'drop' ? '-' : '~'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 3 | ▶ | my $type = $self->new_info ? " ($self->{new_info}{data_type})" : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 3 | return sprintf ' %scolumn: %s.%s%s', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | $prefix, $self->table_name, $self->column_name, $type; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 58 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||