Branch Coverage

blib/lib/DBD/File.pm
Criterion Covered Total %
branch 173 326 53.0


line true false branch
53 0 44 if $DBD::File::drh->{$class}
57 18 26 unless ($attr->{'Attribution'})
59 18 0 if $class eq 'DBD::File'
64 44 0 unless $attr->{'Name'}
96 0 128 if ref $str
97 48 80 unless defined $str
112 0 628 if (my $attr_hash = ('DBI'->parse_dsn($dbname))[3])
113 0 0 if (defined $attr_hash->{'f_dir'} and not -d $attr_hash->{'f_dir'})
116 0 0 if $attr_hash->{'RaiseError'}
120 48 580 if ($attr and (defined $attr->{'f_dir'} and not -d $attr->{'f_dir'}))
123 36 12 if $attr->{'RaiseError'}
159 0 24 unless ref $attr eq 'HASH'
160 24 0 unless exists $attr->{'f_dir'}
161 24 0 unless exists $attr->{'f_dir_search'}
207 0 1160 unless (defined $phase)
210 0 0 if $phase
213 580 580 if (0 == $phase)
223 386 194 if (exists $$dbh{$drv_prefix . 'meta'} and not $dbh->{'sql_engine_in_gofer'})
226 0 386 if defined $dbh->{'f_valid_attrs'}{'f_meta'}
239 0 0 if $attrib eq 'f_meta' and $dbh->{'sql_engine_in_gofer'}
248 496 3592 if ($attrib eq 'f_dir' and defined $value)
249 0 496 unless -d $value
251 8 488 unless 'File::Spec'->file_name_is_absolute($value)
255 108 3980 if ($attrib eq 'f_ext')
256 0 108 unless $value eq '' or $value =~ m[^\.\w+(?:/[rR]*)?$]
260 0 0 if $attrib eq 'f_meta' and $dbh->{'sql_engine_in_gofer'}
281 0 16 if ($table)
283 0 0 if $table
284 0 0 if $meta and $meta->{'f_encoding'}
288 0 16 if $f_encoding
315 748 1270 if ($supported_attrs{$attr})
318 0 748 if (exists $sth->{'ImplementorClass'} and exists $sth->{'sql_stmt'} and $sth->{'sql_stmt'}->isa('SQL::Statement'))
323 0 0 unless (exists $sth->{'f_overall_defs'} and ref $sth->{'f_overall_defs'})
325 0 0 unless ($types)
326 0 0 if (my $t = $sth->{'Database'}->type_info_all)
347 0 0 unless exists $meta->{'table_defs'} and ref $meta->{'table_defs'}
350 0 0 if (defined $field_info->{'data_type'} and not $field_info->{'data_type'} =~ /^[0-9]+$/)
364 0 0 unless $sth->{'f_overall_defs'}{$_}{'data_type'}
0 0 if $attr eq 'TYPE'
368 0 0 unless $sth->{'f_overall_defs'}{$_}{'type_name'}
0 0 if $attr eq 'TYPE_NAME'
372 0 0 unless $sth->{'f_overall_defs'}{$_}{'data_length'}
0 0 if $attr eq 'PRECISION'
376 0 0 if $attr eq 'NULLABLE'
377 0 0 unless $sth->{'f_overall_defs'}{$_}{'constraints'}
0 0 grep({$_ eq 'NOT NULL';} @{[] unless $sth->{'f_overall_defs'}{$_}{'constraints'};}) ? :
402 32 0 $attr && exists $attr->{'f_dir'} ? :
403 0 32 unless defined $dir
404 0 32 unless (-d $dir and -r $dir and -x $dir)
409 32 0 if $attr
415 0 32 if $attr->{'f_dir_search'} and ref $attr->{'f_dir_search'} eq 'ARRAY'
419 0 32 unless (defined $dirh)
425 32 0 $drh->{'ImplementorClass'} =~ /^dbd\:\:([^\:]+)\:\:/i ? :
431 40 0 $dsnextra ? :
40 32 if $file ne 'File::Spec'->updir and -d $d
442 0 36 unless defined $dir
448 4 32 if $dbh->{'f_dir_search'} and ref $dbh->{'f_dir_search'} eq 'ARRAY'
452 0 40 unless (defined $dirh)
463 0 16 defined $dbh->{'f_schema'} && $dbh->{'f_schema'} ne '' ? :
16 24 exists $dbh->{'f_schema'} ? :
465 128 48 unless my($tbl, $meta) = $class->get_table_meta($dbh, $file, 0, 0)
467 16 32 defined $schema ? :
48 0 unless $seen{defined $schema ? $schema : "\000"}{$dir}{$tbl}++
470 0 40 unless $dirh->close
504 0 0 if (not $respect_case and $meta->{'sql_identifier_case'} == 1) { }
0 0 elsif (not $respect_case and $meta->{'sql_identifier_case'} == 2) { }
523 44 0 unless defined $fn
524 44 0 if (my $enc = $meta->{'f_encoding'}) { }
525 0 44 unless binmode $meta->{'fh'}, ":encoding($enc)"
529 0 0 unless binmode $meta->{'fh'}
537 0 0 if $flags->{'dropMode'}
540 0 0 if ($flags->{'createMode'} or $flags->{'lockMode'}) { }
541 0 0 unless $meta->{'fh'} = 'IO::Handle'->new_from_fd(fileno $meta->{'f_file'}, 'w+')
545 0 0 unless $meta->{'fh'} = 'IO::Handle'->new_from_fd(fileno $meta->{'f_file'}, 'r')
549 0 0 if ($meta->{'fh'})
553 0 0 if ($self->can_flock and $meta->{'fh'})
557 0 0 $flags->{'lockMode'} ? :
0 0 defined $flags->{'f_lock'} && $flags->{'f_lock'} =~ /^[012]$/ ? :
558 0 0 if ($lm == 2) { }
0 0 elsif ($lm == 1) { }
559 0 0 unless flock $meta->{'fh'}, 2
562 0 0 unless flock $meta->{'fh'}, 1
585 80 434 if $file eq '.' or $file eq '..'
589 432 2 if ($meta->{'f_ext'})
591 296 136 if ($ext and $opt)
592 296 0 if $opt =~ /r/i
598 4 430 if ($file_is_table and defined $meta->{'f_file'}) { }
608 32 398 if ($dir =~ m(^(?:[.][/\\]?|\[\])$) and ref $meta->{'f_dir_search'} eq 'ARRAY')
611 28 24 unless -f $f
621 16 418 if (not $respect_case and $meta->{'sql_identifier_case'} == 1) { }
418 0 elsif (not $respect_case and $meta->{'sql_identifier_case'} == 2) { }
630 410 24 unless (defined $searchdir)
633 4 406 'File::Spec'->file_name_is_absolute($dir) ? :
635 0 434 unless -d $searchdir
639 422 12 if $searchdir eq $meta->{'f_dir'}
641 430 4 unless ($user_spec_file)
642 330 100 if $file_is_table
646 0 430 if ($respect_case) { }
649 0 0 if $^O eq 'VMS' and $sfx eq '.'
651 0 0 if $fn eq $basename
659 0 1926 if $^O eq 'VMS' and $sfx eq '.'
661 612 1314 if lc $fn eq lc $basename
668 0 430 unless my $dh = 'IO::Dir'->new($searchdir)
672 0 430 unless $dh->close
674 266 164 if @f > 0 and @f <= 2
675 0 430 if not $respect_case and $meta->{'sql_identifier_case'} == 4
679 292 138 if ($ext and $req)
681 48 244 unless $tmpfn =~ s/\Q$ext\E$//i
691 244 0 if defined $meta->{'f_lockfile'} and $meta->{'f_lockfile'}
693 0 386 if $dir and not $user_spec_file
703 0 460 unless defined $meta->{'f_fqfn'} and $meta->{'f_fqfn'} ne ''
706 52 408 unless ($meta->{'f_dontopen'})
708 8 44 if ($flags->{'createMode'}) { }
710 0 8 if -f $meta->{'f_fqfn'}
711 0 8 unless $fh = 'IO::File'->new($fn, 'a+')
715 24 20 $flags->{'lockMode'} ? :
8 36 unless ($fh = 'IO::File'->new($fn, $flags->{'lockMode'} ? 'r+' : 'r'))
722 44 0 if ($fh)
723 0 44 unless $fh->seek(0, 0)
729 406 46 if ($meta->{'f_fqln'})
731 54 352 if ($flags->{'createMode'}) { }
732 0 54 if -f $fn
734 0 54 unless $fh = 'IO::File'->new($fn, 'a+')
738 272 80 $flags->{'lockMode'} ? :
40 312 unless ($fh = 'IO::File'->new($fn, $flags->{'lockMode'} ? 'r+' : 'r'))
746 410 2 if ($self->can_flock and $fh)
750 318 92 $flags->{'lockMode'} ? :
0 410 defined $flags->{'f_lock'} && $flags->{'f_lock'} =~ /^[012]$/ ? :
751 318 92 if ($lm == 2) { }
92 0 elsif ($lm == 1) { }
752 0 318 unless flock $fh, 2
755 0 92 unless flock $fh, 1
795 484 4 unless defined $_[0]
798 0 4 if ref $_[0] eq 'GLOB'
802 0 4 if tied $_[0] and tied($_[0])->can('TIEHANDLE')
805 4 0 unless &Scalar::Util::blessed($_[0])
808 0 0 if $_[0]->isa('IO::Handle')
811 0 0 if $_[0]->isa('Tie::Handle')
815 0 0 if $_[0]->isa('IO::Scalar')
819 0 0 if $_[0]->isa('IO::String')
845 480 42 unless exists $meta->{'f_dir'}
846 484 38 unless exists $meta->{'f_dir_search'}
847 138 384 unless defined $meta->{'f_ext'}
848 490 32 unless defined $meta->{'f_encoding'}
849 484 38 unless exists $meta->{'f_lock'}
850 484 38 unless exists $meta->{'f_lockfile'}
851 522 0 unless defined $meta->{'f_schema'}
854 484 38 unless defined $meta->{'f_open_file_needed'}
858 0 488 _HANDLE($meta->{'f_file'}) ? :
488 34 unless defined $meta->{'sql_data_source'}
868 128 1096 unless $table
903 0 460 $meta->{'f_open_file_needed'} ? :
917 24 48 if $meta->{'fh'}
918 48 24 if $meta->{'lockfh'}
921 72 0 if $meta->{'f_fqfn'}
922 48 24 if $meta->{'f_fqln'}
931 0 0 if ($whence == 0 and $pos == 0) { }
0 0 elsif ($whence != 2 or $pos != 0) { }
932 0 0 defined $meta->{'first_row_pos'} ? :
939 0 0 unless $meta->{'fh'}->seek($pos, $whence)
947 0 0 unless $meta->{'fh'}->truncate($meta->{'fh'}->tell)
955 20 392 if $meta->{'fh'}
956 318 94 if $meta->{'lockfh'}