Branch Coverage

blib/lib/DBD/File.pm
Criterion Covered Total %
branch 168 300 56.0


line true false branch
53 0 40 if $$DBD::File::drh{$class}
57 16 24 unless ($$attr{'Attribution'})
58 16 0 if $class eq 'DBD::File'
64 40 0 unless $$attr{'Name'}
96 0 128 if ref $str
97 48 80 unless defined $str
112 0 624 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 576 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 1152 unless (defined $phase)
210 0 0 if $phase
213 576 576 if (0 == $phase)
223 384 192 if (exists $$dbh{$drv_prefix . 'meta'} and not $$dbh{'sql_engine_in_gofer'})
225 0 384 if defined $$dbh{'f_valid_attrs'}{'f_meta'}
239 0 0 if $attrib eq 'f_meta' and $$dbh{'sql_engine_in_gofer'}
248 492 3580 if ($attrib eq 'f_dir' and defined $value)
249 0 492 unless -d $value
251 8 484 unless 'File::Spec'->file_name_is_absolute($value)
255 108 3964 if ($attrib eq 'f_ext')
256 0 108 unless $value eq '' or $value =~ m[^\.\w+(?:/[rR]*)?$]
260 0 4072 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 744 1262 if ($supported_attrs{$attr})
318 0 744 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'})
327 0 0 unless exists $$meta{'table_defs'} and ref $$meta{'table_defs'}
336 0 0 unless $$sth{'f_overall_defs'}{$_}{'data_type'}
337 0 0 if $attr eq 'TYPE'
340 0 0 unless $$sth{'f_overall_defs'}{$_}{'data_length'}
341 0 0 if $attr eq 'PRECISION'
345 0 0 unless $$sth{'f_overall_defs'}{$_}{'constraints'}
0 0 if $attr eq 'NULLABLE'
346 0 0 grep({$_ eq 'NOT NULL';} @{[] unless $$sth{'f_overall_defs'}{$_}{'constraints'};}) ? :
369 32 0 $attr && exists $$attr{'f_dir'} ? :
372 0 32 unless defined $dir
373 0 32 unless (-d $dir and -r $dir and -x $dir)
378 32 0 if $attr
384 0 32 if $$attr{'f_dir_search'} and ref $$attr{'f_dir_search'} eq 'ARRAY'
388 0 32 unless (defined $dirh)
394 32 0 $$drh{'ImplementorClass'} =~ /^dbd\:\:([^\:]+)\:\:/i ? :
400 40 0 $dsnextra ? :
40 32 if $file ne 'File::Spec'->updir and -d $d
411 0 36 unless defined $dir
417 4 32 if $$dbh{'f_dir_search'} and ref $$dbh{'f_dir_search'} eq 'ARRAY'
421 0 40 unless (defined $dirh)
432 0 16 defined $$dbh{'f_schema'} && $$dbh{'f_schema'} ne '' ? :
16 24 exists $$dbh{'f_schema'} ? :
434 128 48 unless my($tbl, $meta) = $class->get_table_meta($dbh, $file, 0, 0)
436 16 32 defined $schema ? :
48 0 unless $seen{defined $schema ? $schema : "\000"}{$dir}{$tbl}++
439 0 40 unless $dirh->close
473 0 0 if (not $respect_case and $$meta{'sql_identifier_case'} == 1) { }
0 0 elsif (not $respect_case and $$meta{'sql_identifier_case'} == 2) { }
492 44 0 unless defined $fn
493 44 0 if (my $enc = $$meta{'f_encoding'}) { }
494 0 44 unless binmode $$meta{'fh'}, ":encoding($enc)"
498 0 0 unless binmode $$meta{'fh'}
506 0 0 if $$flags{'dropMode'}
509 0 0 if ($$flags{'createMode'} or $$flags{'lockMode'}) { }
510 0 0 unless $$meta{'fh'} = 'IO::Handle'->new_from_fd(fileno $$meta{'f_file'}, 'w+')
514 0 0 unless $$meta{'fh'} = 'IO::Handle'->new_from_fd(fileno $$meta{'f_file'}, 'r')
518 0 0 if ($$meta{'fh'})
522 0 0 if ($self->can_flock and $$meta{'fh'})
523 0 0 $$flags{'lockMode'} ? :
0 0 defined $$flags{'f_lock'} && $$flags{'f_lock'} =~ /^[012]$/ ? :
527 0 0 if ($lm == 2) { }
0 0 elsif ($lm == 1) { }
528 0 0 unless flock $$meta{'fh'}, 2
531 0 0 unless flock $$meta{'fh'}, 1
554 80 420 if $file eq '.' or $file eq '..'
558 420 0 if ($$meta{'f_ext'})
560 288 132 if ($ext and $opt)
561 288 0 if $opt =~ /r/i
567 4 416 if ($file_is_table and defined $$meta{'f_file'}) { }
577 32 384 if ($dir =~ m(^(?:[.][/\\]?|\[\])$) and ref $$meta{'f_dir_search'} eq 'ARRAY')
580 28 24 unless -f $f
590 16 404 if (not $respect_case and $$meta{'sql_identifier_case'} == 1) { }
404 0 elsif (not $respect_case and $$meta{'sql_identifier_case'} == 2) { }
599 396 24 unless (defined $searchdir)
600 4 392 'File::Spec'->file_name_is_absolute($dir) ? :
604 0 420 unless -d $searchdir
607 408 12 if $searchdir eq $$meta{'f_dir'}
610 416 4 unless ($user_spec_file)
611 324 92 if $file_is_table
615 0 416 if ($respect_case) { }
618 0 0 if $^O eq 'VMS' and $sfx eq '.'
620 0 0 if $fn eq $basename
628 0 1856 if $^O eq 'VMS' and $sfx eq '.'
630 588 1268 if lc $fn eq lc $basename
637 0 416 unless my $dh = 'IO::Dir'->new($searchdir)
641 0 416 unless $dh->close
643 260 156 if @f > 0 and @f <= 2
644 0 416 if not $respect_case and $$meta{'sql_identifier_case'} == 4
648 284 132 if ($ext and $req)
650 48 236 unless $tmpfn =~ s/$ext$//i
659 240 132 if defined $$meta{'f_lockfile'} and $$meta{'f_lockfile'}
662 0 372 if $dir and not $user_spec_file
672 0 452 unless defined $$meta{'f_fqfn'} and $$meta{'f_fqfn'} ne ''
675 52 400 unless ($$meta{'f_dontopen'})
677 8 44 if ($$flags{'createMode'}) { }
678 0 8 if -f $$meta{'f_fqfn'}
680 0 8 unless $fh = 'IO::File'->new($fn, 'a+')
684 24 20 $$flags{'lockMode'} ? :
8 36 unless ($fh = 'IO::File'->new($fn, $$flags{'lockMode'} ? 'r+' : 'r'))
691 44 0 if ($fh)
692 0 44 unless $fh->seek(0, 0)
698 400 44 if ($$meta{'f_fqln'})
700 52 348 if ($$flags{'createMode'}) { }
701 0 52 if -f $fn
703 0 52 unless $fh = 'IO::File'->new($fn, 'a+')
707 268 80 $$flags{'lockMode'} ? :
40 308 unless ($fh = 'IO::File'->new($fn, $$flags{'lockMode'} ? 'r+' : 'r'))
715 404 0 if ($self->can_flock and $fh)
716 312 92 $$flags{'lockMode'} ? :
0 404 defined $$flags{'f_lock'} && $$flags{'f_lock'} =~ /^[012]$/ ? :
720 312 92 if ($lm == 2) { }
92 0 elsif ($lm == 1) { }
721 0 312 unless flock $fh, 2
724 0 92 unless flock $fh, 1
814 472 36 unless exists $$meta{'f_dir'}
815 472 36 unless exists $$meta{'f_dir_search'}
816 132 376 unless defined $$meta{'f_ext'}
817 476 32 unless defined $$meta{'f_encoding'}
818 472 36 unless exists $$meta{'f_lock'}
819 472 36 unless exists $$meta{'f_lockfile'}
820 508 0 unless defined $$meta{'f_schema'}
822 472 36 unless defined $$meta{'f_open_file_needed'}
825 0 476 _HANDLE($$meta{'f_file'}) ? :
476 32 unless defined $$meta{'sql_data_source'}
837 128 968 unless $table
871 0 452 $$meta{'f_open_file_needed'} ? :
886 24 48 if $$meta{'fh'}
887 48 24 if $$meta{'lockfh'}
890 72 0 if $$meta{'f_fqfn'}
891 48 24 if $$meta{'f_fqln'}
900 0 0 if ($whence == 0 and $pos == 0) { }
0 0 elsif ($whence != 2 or $pos != 0) { }
901 0 0 defined $$meta{'first_row_pos'} ? :
907 0 0 unless $$meta{'fh'}->seek($pos, $whence)
915 0 0 unless $$meta{'fh'}->truncate($$meta{'fh'}->tell)
924 20 384 if $$meta{'fh'}
925 312 92 if $$meta{'lockfh'}