Branch Coverage

blib/lib/DBI/SQL/Nano.pm
Criterion Covered Total %
branch 147 252 58.3


line true false branch
34 48 0 if ($ENV{'DBI_SQL_NANO'} or not eval { do { require SQL::Statement; $SQL::Statement::VERSION ge '1.400' } }) { }
83 80 644 if (/^\s*CREATE\s+TABLE\s+(.*?)\s*\((.+)\)\s*$/is)
86 80 0 if defined $2 and $2 ne ''
88 0 80 unless $$self{'column_names'}
92 128 596 if (/^\s*DROP\s+TABLE\s+(IF\s+EXISTS\s+)?(.*?)\s*$/is)
95 76 52 if defined $1 and $1 ne ''
100 156 568 if (/^\s*SELECT\s+(.*?)\s+FROM\s+(\S+)((.*))?/is)
102 156 0 if defined $1 and $1 ne ''
104 0 156 unless $$self{'column_names'}
106 56 100 if (my $clauses = $4)
108 48 8 if ($clauses =~ /^(.*)\s+ORDER\s+BY\s+(.*)$/is)
113 8 48 if $clauses
118 204 520 if (/^\s*INSERT\s+(?:INTO\s+)?(\S+)\s*(\((.*?)\))?\s*VALUES\s*\((.+)\)/is)
121 28 176 if defined $2 and $2 ne ''
123 204 0 if defined $4 and $4 ne ''
125 0 204 unless $$self{'values'}
129 64 660 if (/^\s*DELETE\s+FROM\s+(\S+)((.*))?/is)
132 32 32 if defined $3 and $3 ne ''
137 44 680 if (/^\s*UPDATE\s+(\S+)\s+SET\s+(.+)(\s+WHERE\s+.+)/is)
140 44 0 if defined $2 and $2 ne ''
142 44 0 if defined $3 and $3 ne ''
146 48 676 unless $$self{'command'} and $$self{'table_name'}
154 36 12 if @clause == 1
155 0 12 if @clause > 2
157 12 0 if $clause[1] =~ /^ASC$/i or $clause[1] =~ /^DESC$/i
169 152 0 if ($col =~ /^(\S+?)\s+.+/) { }
205 0 44 unless $$self{'column_names'} and $$self{'values'}
211 0 616 unless defined $str
214 164 452 if ($str =~ /^\?$/)
223 12 440 if $str =~ /^NULL$/i
227 136 304 if $str =~ /^'(.+)'$/s
231 172 132 if DBI::looks_like_number($str)
244 84 0 if ($str =~ /^\s*WHERE\s+(.*)/i) { }
255 0 84 unless defined $val1 and defined $op and defined $val2
272 0 476 unless $num_placeholders == $num_params
274 64 412 if (scalar @$params)
278 120 0 if ($$self{'values'}[$i]{'type'} eq 'placeholder')
283 0 64 if ($$self{'where_clause'})
285 0 0 if ($$self{'where_clause'}{'arg1'}{'type'} eq 'placeholder')
289 0 0 if ($$self{'where_clause'}{'arg2'}{'type'} eq 'placeholder')
314 40 32 if ($$self{'ignore_missing_table'} and $@ || @err and grep {$_ =~ /$enoentrx/;} @err, $@)
320 8 72 if $@ or @err
321 0 72 unless $table
341 124 0 unless $table->can('insert_one_row')
344 0 124 unless $$self{'column_names'}
345 124 0 if $$self{'column_names'}
348 0 124 unless $cNum
360 0 124 if $#$array < $maxCol
362 124 0 $table->can('insert_new_row') ? :
377 56 40 if ($self->eval_where($table, $array)) { }
380 8 48 if ($$self{'fetched_from_key'})
386 48 0 if $can_dor
390 0 40 unless $can_dor
393 16 0 if ($can_dor) { }
416 0 64 if (not defined $a && defined $b) { }
64 0 elsif (DBI::looks_like_number($a) and DBI::looks_like_number($b)) { }
426 0 0 $case_fold ? :
440 196 0 if ($self->eval_where($table, $array))
442 0 196 if $$self{'fetched_from_key'}
443 92 104 unless (keys %cols)
461 0 196 if $$self{'fetched_from_key'}
465 32 60 if ($$self{'order_clause'})
469 8 24 uc $desc eq 'DESC' ? :
479 40 24 if $desc
492 0 32 unless $table
501 56 0 if ($self->eval_where($table, $array)) { }
503 8 48 if $$self{'fetched_from_key'} and $can_rwu
504 56 0 if $can_usr
511 8 48 if ($$self{'fetched_value'})
513 8 0 if ($can_usr) { }
0 0 elsif ($can_uor) { }
523 48 0 $can_usr ? :
527 0 0 unless $can_rwu
530 24 0 if ($can_rwu) { }
534 48 0 if ($can_usr) { }
0 0 elsif ($can_uor) { }
561 48 224 if ($$self{'where_clause'})
563 48 0 if (my $col = $$self{'where_clause'}{'arg1'})
565 48 0 if $$col{'type'} eq 'column'
567 48 0 if (my $col = $$self{'where_clause'}{'arg2'})
569 0 48 if $$col{'type'} eq 'column'
584 852 124 if ($stmt_col_name and not $find_in_stmt)
588 852 400 if uc $k eq uc $stmt_col_name
592 32 92 if ($stmt_col_name and $find_in_stmt)
596 32 0 if uc $stmt_col_name eq uc $$self{'column_names'}[$i]
604 172 160 if uc $dbd_cols[$i] eq uc $stmt_col
628 120 0 if ($$val1{'type'} eq 'column') { }
637 0 120 if ($$val2{'type'} eq 'column') { }
647 120 0 if ($op eq '=' and not $neg and $table->can('fetch_one_row'))
650 16 104 if ($$pred{'arg1'}{'value'} =~ /^$key_col$/i)
658 0 0 $match ? :
0 104 if ($neg)
665 0 104 if ($op eq 'IS')
667 0 0 if not defined $val1 or $val1 eq ''
670 0 104 unless defined $val1
671 0 104 unless defined $val2
672 0 104 if ($op =~ /LIKE|CLIKE/i)
678 0 104 if ($op eq 'LIKE')
679 0 104 if ($op eq 'CLIKE')
680 0 104 if (DBI::looks_like_number($val1) and DBI::looks_like_number($val2)) { }
682 0 0 if ($op eq '<')
683 0 0 if ($op eq '>')
684 0 0 if ($op eq '=')
685 0 0 if ($op eq '<>')
686 0 0 if ($op eq '<=')
687 0 0 if ($op eq '>=')
691 0 104 if ($op eq '<')
692 0 104 if ($op eq '>')
693 104 0 if ($op eq '=')
694 0 0 if ($op eq '<>')
695 0 0 if ($op eq '<=')
696 0 0 if ($op eq '>=')
703 1412 216 unless ($$self{'params'})
704 0 216 if (defined $val_num)
709 0 216 wantarray ? :
718 72 404 if ($@)
723 0 404 unless $table
724 248 156 if (not $$self{'column_names'} or $$self{'column_names'}[0] eq '*')
734 0 304 unless ($$self{'values'})
735 304 0 if (defined $val_num)
739 0 0 if (wantarray) { }
753 456 940 if ($$self{'column_names'} and $$self{'column_names'}[0] ne '*')
771 0 404 unless defined $$self{'col_names'} and 'ARRAY' eq ref $$self{'col_names'}
773 404 0 unless exists $$self{'col_nums'}
774 0 404 unless defined $$self{'col_nums'} and 'HASH' eq ref $$self{'col_nums'}
787 0 628 unless $$col_names[$i]