Branch Coverage

blib/lib/ETL/Yertl/Command/ysql.pm
Criterion Covered Total %
branch 71 88 80.6


line true false branch
16 0 39 if ($@)
21 39 0 if (ref $_[-1] eq 'HASH')
50 16 23 if ($opt{'config'}) { }
1 22 elsif ($opt{'drivers'}) { }
53 1 15 unless ($db_key)
62 3 7 unless (@args or grep {defined $_;} @opt{'dsn', 'driver', 'database', 'host', 'port', 'user', 'password'})
63 1 2 unless keys %$db_conf
74 55 17 unless $opt{$key}
79 7 5 if (my $dsn = $opt{'dsn'} || shift @args)
85 5 2 if (not $driver_dsn =~ /[=:;\@]/) { }
0 2 elsif ($driver_dsn =~ /^(\w+)\@([\w.]+)(?:\:(\d+))?$/) { }
2 0 elsif (my @parts = split(/\;/, $driver_dsn, 0)) { }
96 0 5 if ($part_key eq 'dbname')
109 6 6 unless (grep {/^$driver$/;} 'DBI'->available_drivers)
111 2 4 @possible ? :
125 0 22 if ($opt{'edit'})
137 2 20 if ($opt{'save'})
145 18 2 !$opt{'dsn'} ? :
146 1 2 unless ($db_key or $opt{'dsn'})
150 2 17 $opt{'dsn'} ? :
151 0 19 unless (@dbi_args)
156 1 18 unless ($dbh)
158 0 1 $dbi_args[1] ? :
168 2 16 if ($opt{'insert'})
169 2 0 if (not -t *STDIN || -z *STDIN) { }
176 1 2 if (grep {ref $_;} values %$doc)
181 1 1 if (not $query or $new_query ne $query)
183 0 1 unless $sth = $dbh->prepare($query)
187 0 2 unless $sth->execute(@bind_args)
197 0 0 unless my $sth = $dbh->prepare($query)
200 0 0 unless $sth->execute(@bind_args)
211 4 12 if ($opt{'select'}) { }
2 10 elsif ($opt{'count'}) { }
2 8 elsif ($opt{'delete'}) { }
224 7 1 if ($db_key)
226 2 5 if ($db_conf->{'query'}{$query})
236 2 14 unless my $sth = $dbh->prepare($query)
239 2 12 if (not -t *STDIN || -z *STDIN) { }
243 0 4 unless $sth->execute(map({select_doc($_, $doc);} @fields))
252 1 11 unless $sth->execute(@args)
266 33 6 if ($conf_file->exists)
275 14 24 if ($config)
277 6 8 unless ($conf_file->exists)
302 17 0 if ($conf_file->exists)