Branch Coverage

blib/lib/SQL/Translator/Producer/MySQL.pm
Criterion Covered Total %
branch 172 204 84.3


line true false branch
166 303 296 if (ref $opt_name)
171 0 263 if (uc $key eq $_)
186 214 239 unless uc $key eq $opt_name
194 8 352 if ($extra_type)
215 201 90 unless $c->type eq "FOREIGN KEY"
222 14 76 unless length $c_name
231 143 12 if &$extra_to_options($table, "mysql_table_type", ["ENGINE", "TYPE"])
241 3 981 if exists $extra->{$_}
245 10 482 if (not $size[0] and $f->data_type =~ /char$/)
258 530 294 if exists $options->{'generator'}
260 91 203 normalize_quote_options($options) ? :
283 3 19 unless $no_comments
312 2 20 if ($mysql_version >= "5.000001")
329 2 20 if ($mysql_version >= "5.000002")
351 1 9 $create ? :
105 0 $_ ? :
10 12 wantarray ? :
366 4 4 if (@$events > 1)
372 0 4 if $options->{'show_warnings'}
376 7 1 unless ($action =~ /^ \s* BEGIN [\s\;] .*? [\s\;] END [\s\;]* $/six)
377 1 6 unless $action =~ /;\s*\z/
382 6 2 if $options->{'add_drop_trigger'}
395 2 4 unless $options->{'no_comments'}
411 0 6 unless $options->{'no_comments'}
413 4 2 if $options->{'add_replace_view'}
419 2 4 if (exists $extra->{'mysql_algorithm'} and defined(my $algorithm = $extra->{'mysql_algorithm'}))
421 2 0 if $algorithm =~ /(?:UNDEFINED|MERGE|TEMPTABLE)/i
426 2 4 if (exists $extra->{'mysql_definer'} and defined(my $user = $extra->{'mysql_definer'}))
432 2 4 if (exists $extra->{'mysql_security'} and defined(my $security = $extra->{'mysql_security'}))
434 2 0 if $security =~ /(?:DEFINER|INVOKER)/i
441 6 0 if (my(@fields) = $view->fields)
445 6 0 if (my $sql = $view->sql)
468 9 51 unless $options->{'no_comments'}
469 36 24 if $options->{'add_drop_table'}
497 116 18 if $constr
499 32 102 unless ($indexed_fields{($c->fields)[0]} or $c->type ne "FOREIGN KEY")
516 36 24 $drop ? :
530 47 12 if uc $key eq "ENGINE" or uc $key eq "TYPE"
533 6 53 if (uc $key eq 'CHARACTER SET') { }
6 47 elsif (uc $key eq 'COLLATE') { }
0 47 elsif (uc $key eq 'UNION') { }
547 0 65 if $mysql_table_type and not $table_type_defined
551 6 59 if $charset
552 6 59 if $collate
553 0 65 if $union
554 6 59 if $comments
580 8 303 if (lc $data_type eq 'number') { }
24 279 elsif ($data_type =~ /char/i and $size[0] > 255) { }
6 273 elsif ($data_type =~ /boolean/i) { }
114 159 elsif (exists $translate{lc $data_type}) { }
583 2 6 if (scalar @size > 1) { }
2 4 elsif ($size[0] and $size[0] >= 12) { }
2 2 elsif ($size[0] and $size[0] <= 1) { }
598 18 6 unless ($size[0] <= 65535 and $mysql_version >= "5.000003")
603 2 4 if ($mysql_version >= 4) { }
613 49 262 if $data_type =~ /(text|blob)/i
615 0 311 if ($data_type =~ /(double|float)/ and scalar @size == 1)
621 16 295 if (lc $data_type eq 'enum' or lc $data_type eq 'set') { }
174 183 elsif (defined $size[0] and $size[0] > 0 and not grep((lc $data_type eq $_), @no_length_attr)) { }
628 0 311 if $charset
629 0 311 if $collate
633 924 9 unless my $val = $extra{$qual} || $extra{uc $qual}
637 909 24 unless my $val = $extra{$qual} || $extra{uc $qual}
638 6 18 if (ref $val) { }
646 206 105 if ($field->is_nullable) { }
661 13 298 if (my $comments = $field->comments)
667 40 271 if $field->is_auto_increment
693 3 53 if (my $len = $field->extra->{'prefix_length'})
700 5 157 unless $_
702 49 5 lc $index->type eq 'normal' ? :
49 5 $index->name ? :
723 1 19 if ($c->type eq 'PRIMARY KEY') { }
726 11 8 $c->type eq 'FOREIGN KEY' ? :
748 47 107 if ($c->type eq 'PRIMARY KEY') { }
34 73 elsif ($c->type eq 'UNIQUE') { }
53 20 elsif ($c->type eq 'FOREIGN KEY') { }
2 18 elsif ($c->type eq 'CHECK') { }
749 0 47 unless @fields
752 0 34 unless @fields
760 28 6 defined $c->name && $c->name ? :
763 0 53 unless @fields
771 53 0 $c_name ? :
777 0 65 unless $_
778 0 53 unless (@rfields)
780 0 0 if (my $ref_table = $table->schema->get_table($rtable_name)) { }
784 0 0 if $options->{'show_warnings'}
788 53 0 if (@rfields) { }
792 0 0 if $options->{'show_warnings'}
795 0 53 if ($c->match_type)
796 0 0 ' MATCH ' . $c->match_type =~ /full/i ? :
799 1 52 if ($c->on_delete)
803 0 53 if ($c->on_update)
811 2 0 $c_name ? :
880 11 7 $_->type eq 'FOREIGN KEY' ? :
883 7 10 if ($_->type eq 'FOREIGN KEY') { }
885 1 6 if $fks_to_drop{$_->name}
893 1 34 if (scalar keys %fks_to_alter)
909 3 32 if $diff_hash->{'rename_table'} and @{$diff_hash->{'rename_table'};}
911 18 17 unless @stmts
914 6 11 unless @stmts > 1
920 3 8 $renamed_from ? :
962 80 10 unless (defined $used_names{$name})