Branch Coverage

blib/lib/SQL/Translator/Producer/MySQL.pm
Criterion Covered Total %
branch 170 202 84.1


line true false branch
167 303 296 if (ref $opt_name)
172 0 263 if (uc $key eq $_)
188 214 239 unless uc $key eq $opt_name
196 8 352 if ($extra_type)
217 201 90 unless $c->type eq "FOREIGN KEY"
223 14 76 unless length $c_name
230 143 12 if &$extra_to_options($table, "mysql_table_type", ["ENGINE", "TYPE"])
239 3 981 if exists $extra->{$_}
243 10 482 if (not $size[0] and $f->data_type =~ /char$/)
255 530 290 if exists $options->{'generator'}
257 91 199 normalize_quote_options($options) ? :
282 3 19 unless $no_comments
305 2 20 if ($mysql_version >= "5.000001")
318 2 20 if ($mysql_version >= "5.000002")
335 1 9 $create ? :
105 0 $_ ? :
10 12 wantarray ? :
350 4 4 if (@$events > 1)
355 0 4 if $options->{'show_warnings'}
359 7 1 unless ($action =~ /^ \s* BEGIN [\s\;] .*? [\s\;] END [\s\;]* $/six)
360 1 6 unless $action =~ /;\s*\z/
364 6 2 if $options->{'add_drop_trigger'}
373 2 4 unless $options->{'no_comments'}
388 0 6 unless $options->{'no_comments'}
390 4 2 if $options->{'add_replace_view'}
395 2 4 if (exists $extra->{'mysql_algorithm'} and defined(my $algorithm = $extra->{'mysql_algorithm'}))
396 2 0 if $algorithm =~ /(?:UNDEFINED|MERGE|TEMPTABLE)/i
399 2 4 if (exists $extra->{'mysql_definer'} and defined(my $user = $extra->{'mysql_definer'}))
403 2 4 if (exists $extra->{'mysql_security'} and defined(my $security = $extra->{'mysql_security'}))
404 2 0 if $security =~ /(?:DEFINER|INVOKER)/i
410 6 0 if (my(@fields) = $view->fields)
414 6 0 if (my $sql = $view->sql)
436 9 51 unless $options->{'no_comments'}
437 36 24 if $options->{'add_drop_table'}
465 116 18 if $constr
467 32 102 unless ($indexed_fields{($c->fields)[0]} or $c->type ne "FOREIGN KEY")
484 36 24 $drop ? :
499 47 12 if uc $key eq "ENGINE" or uc $key eq "TYPE"
501 6 53 if (uc $key eq 'CHARACTER SET') { }
6 47 elsif (uc $key eq 'COLLATE') { }
0 47 elsif (uc $key eq 'UNION') { }
515 0 65 if $mysql_table_type and not $table_type_defined
519 6 59 if $charset
520 6 59 if $collate
521 0 65 if $union
522 6 59 if $comments
549 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}) { }
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 18 6 unless ($size[0] <= 65535 and $mysql_version >= "5.000003")
575 2 4 if ($mysql_version >= 4) { }
586 49 262 if $data_type =~ /(text|blob)/i
588 0 311 if ($data_type =~ /(double|float)/ and scalar @size == 1)
594 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)) { }
606 0 311 if $charset
607 0 311 if $collate
611 924 9 unless my $val = $extra{$qual} || $extra{uc $qual}
615 909 24 unless my $val = $extra{$qual} || $extra{uc $qual}
616 6 18 if (ref $val) { }
625 206 105 if ($field->is_nullable) { }
641 13 298 if (my $comments = $field->comments)
647 40 271 if $field->is_auto_increment
679 3 147 unless $_
687 46 4 lc $index->type eq 'normal' ? :
47 3 $index->name ? :
715 1 19 if ($c->type eq 'PRIMARY KEY') { }
719 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
753 0 34 unless @fields
761 28 6 defined $c->name && $c->name ? :
765 0 53 unless @fields
773 53 0 $c_name ? :
784 0 65 unless $_
785 0 53 unless (@rfields)
787 0 0 if (my $ref_table = $table->schema->get_table($rtable_name)) { }
792 0 0 if $options->{'show_warnings'}
796 53 0 if (@rfields) { }
802 0 0 if $options->{'show_warnings'}
805 0 53 if ($c->match_type)
806 0 0 ' MATCH ' . $c->match_type =~ /full/i ? :
810 1 52 if ($c->on_delete)
814 0 53 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 80 10 unless (defined $used_names{$name})