Sybase/SQLMaker.pm

filter: Statementstmt 100% 28 / 28 Branchbran 83.3% 5 / 6 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 100% 7 / 7 Podpod 100% 2 / 2 totaltotal 84.6% 44 / 52 CC 6 SCAR 13.3
CC
6
Cov
88%
_render_op_nulls
6.6
BEGIN
1.0
BEGIN
1.0
CRAP 3.8
« Sybase/Diff/View.pm ↑ Summary Sybase/Storage/ASE/NoBindVars.pm »
1 package DBIO::Sybase::SQLMaker;
2 # ABSTRACT: Sybase ASE-specific SQL generation for DBIO
3  
4 16 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 16 our $VERSION = '0.900007';
7  
8 16 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 16 ▶use base qw( DBIO::SQLMaker );
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12  
13 53 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
14 53 my $self = shift->next::method(@_);
15  
16 # copy first: the table of render ops may be shared with other makers
17 $self->{render_op} = {
18 53 %{ $self->{render_op} },
19 nulls_first => '_render_op_nulls',
20 nulls_last => '_render_op_nulls',
21 };
22  
23 53 return $self;
24 }
25  
26  
27 19 ▶sub _order_by_chunks {
Subroutine _order_by_chunks: called CC=1 SCAR=0.0
28 19 my $self = shift;
29 19 local $self->{_sybase_nulls_chunking} = 1;
30 19 return $self->next::method(@_);
31 }
32  
33  
34 23 ▶sub _render_op_nulls {
Subroutine _render_op_nulls: called CC=6 SCAR=18.8
35 23 my ($self, $op, $args) = @_;
36 23 my ($node) = @$args;
37  
38 return $self->_render_unop_postfix($op, $args)
39 23 ▶ if $self->{_sybase_nulls_chunking};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_sybase_nulls_chunking"} 12 11 23
40  
41 11 my $expr = $node;
42 11 ▶ if (ref $node eq 'HASH' and ref $node->{-op} eq 'ARRAY'
Branch: 1 branch
BranchTrueFalseTotal
if (ref $node eq "HASH" and ref $node->{"-op"} eq "ARRAY" and $node->{"-op"}[0] =~ /\A(?:asc|desc)\z/) 11 0 11
Condition33%2/6
ref $node eq "HASH" and ref $node->{"-op"} eq "ARRAY" and $node->{"-op"}[0] =~ /\A(?:asc|desc)\z/
!ll&&!rl&&r
0011
ref $node eq "HASH" and ref $node->{"-op"} eq "ARRAY"
!ll&&!rl&&r
0011
MC/DC0%0/3
ref $node eq "HASH" and ref $node->{"-op"} eq "ARRAY" and $node->{"-op"}[0] =~ /\A(?:asc|desc)\z/
ref $node eq "HASH" ref $node->{"-op"} eq "ARRAY" $node->{"-op"}[0] =~ /\A(?:asc|desc)\z/
Truth table25%1/4
A and B and C
A= ref $node eq "HASH"B= ref $node->{"-op"} eq "ARRAY"C= $node->{"-op"}[0] =~ /\A(?:asc|desc)\z/
ABCresult
0XX0
10X0
1100
1111
43 and $node->{-op}[0] =~ /\A(?:asc|desc)\z/) {
44 11 $expr = $node->{-op}[1];
45 }
46  
47 11 ▶ my ($null, $other) = $op eq 'nulls_first' ? (0, 1) : (1, 0);
Branch: 1 branch
BranchTrueFalseTotal
$op eq 'nulls_first' ? : 7 4 11
48  
49 11 return $self->join_query_parts(', ',
50 $self->join_query_parts(' ',
51 'CASE WHEN', { -op => [ 'is_null', $expr ] },
52 "THEN $null ELSE $other END",
53 ),
54 $node,
55 );
56 }
57  
58  
59 7 ▶sub apply_limit {
Subroutine apply_limit: called CC=1 SCAR=0.0
Pod documented
60 7 my ($self, $sql, $rs_attrs, $rows, $offset) = @_;
61 7 return $self->_GenericSubQ($sql, $rs_attrs, $rows, $offset);
62 }
63  
64  
65 16 1;
66  
67 __END__
« Sybase/Diff/View.pm ↑ Summary Sybase/Storage/ASE/NoBindVars.pm »