Branch Coverage

blib/lib/SQL/Translator/Producer/MySQL.pm
Criterion Covered Total %
branch 163 202 80.6


line true false branch
167 291 284 if (ref $opt_name)
172 0 255 if (uc $key eq $_)
188 202 231 unless uc $key eq $opt_name
196 4 340 if ($extra_type)
217 189 87 unless $c->type eq "FOREIGN KEY"
223 12 75 unless length $c_name
230 137 12 if &$extra_to_options($table, "mysql_table_type", ["ENGINE", "TYPE"])
239 3 915 if exists $extra->{$_}
243 4 455 if (not $size[0] and $f->data_type =~ /char$/)
255 461 287 if exists $options->{'generator'}
257 88 199 normalize_quote_options($options) ? :
282 2 17 unless $no_comments
305 0 19 if ($mysql_version >= "5.000001")
318 0 19 if ($mysql_version >= "5.000002")
335 1 8 $create ? :
86 0 $_ ? :
9 10 wantarray ? :
350 0 2 if (@$events > 1)
355 0 0 if $options->{'show_warnings'}
359 1 1 unless ($action =~ /^ \s* BEGIN [\s\;] .*? [\s\;] END [\s\;]* $/six)
360 1 0 unless $action =~ /;\s*\z/
364 0 2 if $options->{'add_drop_trigger'}
373 2 0 unless $options->{'no_comments'}
388 0 4 unless $options->{'no_comments'}
390 2 2 if $options->{'add_replace_view'}
395 2 2 if (exists $extra->{'mysql_algorithm'} and defined(my $algorithm = $extra->{'mysql_algorithm'}))
396 2 0 if $algorithm =~ /(?:UNDEFINED|MERGE|TEMPTABLE)/i
399 2 2 if (exists $extra->{'mysql_definer'} and defined(my $user = $extra->{'mysql_definer'}))
403 2 2 if (exists $extra->{'mysql_security'} and defined(my $security = $extra->{'mysql_security'}))
404 2 0 if $security =~ /(?:DEFINER|INVOKER)/i
410 4 0 if (my(@fields) = $view->fields)
414 4 0 if (my $sql = $view->sql)
436 7 47 unless $options->{'no_comments'}
437 30 24 if $options->{'add_drop_table'}
465 101 18 if $constr
467 29 90 unless ($indexed_fields{($c->fields)[0]} or $c->type ne "FOREIGN KEY")
484 30 24 $drop ? :
499 41 12 if uc $key eq "ENGINE" or uc $key eq "TYPE"
501 6 47 if (uc $key eq 'CHARACTER SET') { }
6 41 elsif (uc $key eq 'COLLATE') { }
0 41 elsif (uc $key eq 'UNION') { }
515 0 59 if $mysql_table_type and not $table_type_defined
519 6 53 if $charset
520 6 53 if $collate
521 0 59 if $union
522 6 53 if $comments
549 8 270 if (lc $data_type eq 'number') { }
21 249 elsif ($data_type =~ /char/i and $size[0] > 255) { }
6 243 elsif ($data_type =~ /boolean/i) { }
102 141 elsif (exists $translate{lc $data_type}) { }
551 2 6 if (scalar @size > 1) { }
2 4 elsif ($size[0] and $size[0] >= 12) { }
2 2 elsif ($size[0] and $size[0] <= 1) { }
569 17 4 unless ($size[0] <= 65535 and $mysql_version >= "5.000003")
575 2 4 if ($mysql_version >= 4) { }
586 45 233 if $data_type =~ /(text|blob)/i
588 0 278 if ($data_type =~ /(double|float)/ and scalar @size == 1)
594 16 262 if (lc $data_type eq 'enum' or lc $data_type eq 'set') { }
148 173 elsif (defined $size[0] and $size[0] > 0 and not grep((lc $data_type eq $_), @no_length_attr)) { }
606 0 278 if $charset
607 0 278 if $collate
611 828 6 unless my $val = $extra{$qual} || $extra{uc $qual}
615 810 24 unless my $val = $extra{$qual} || $extra{uc $qual}
616 6 18 if (ref $val) { }
625 182 96 if ($field->is_nullable) { }
641 10 268 if (my $comments = $field->comments)
647 34 244 if $field->is_auto_increment
679 3 138 unless $_
687 43 4 lc $index->type eq 'normal' ? :
44 3 $index->name ? :
715 1 19 if ($c->type eq 'PRIMARY KEY') { }
719 11 8 $c->type eq 'FOREIGN KEY' ? :
748 41 98 if ($c->type eq 'PRIMARY KEY') { }
28 70 elsif ($c->type eq 'UNIQUE') { }
50 20 elsif ($c->type eq 'FOREIGN KEY') { }
2 18 elsif ($c->type eq 'CHECK') { }
749 0 41 unless @fields
753 0 28 unless @fields
761 22 6 defined $c->name && $c->name ? :
765 0 50 unless @fields
773 50 0 $c_name ? :
784 0 62 unless $_
785 0 50 unless (@rfields)
787 0 0 if (my $ref_table = $table->schema->get_table($rtable_name)) { }
792 0 0 if $options->{'show_warnings'}
796 50 0 if (@rfields) { }
802 0 0 if $options->{'show_warnings'}
805 0 50 if ($c->match_type)
806 0 0 ' MATCH ' . $c->match_type =~ /full/i ? :
810 1 49 if ($c->on_delete)
814 0 50 if ($c->on_update)
823 2 0 $c_name ? :
905 11 7 $_->type eq 'FOREIGN KEY' ? :
911 7 10 if ($_->type eq 'FOREIGN KEY') { }
912 1 6 if $fks_to_drop{$_->name}
918 1 34 if (scalar keys %fks_to_alter)
935 3 32 if $diff_hash->{'rename_table'} and @{$diff_hash->{'rename_table'};}
937 18 17 unless @stmts
939 6 11 unless @stmts > 1
945 3 8 $renamed_from ? :
982 77 10 unless (defined $used_names{$name})