MyParsePP/Query.pm

filter: Statementstmt 82.6% 62 / 75 Branchbran 41.6% 5 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 72.2% 26 / 36 Podpod 0.0% 0 / 29 totaltotal 61.1% 93 / 152 SCAR 21.7
CC
8
Cov
77%
toString
6.0
new
3.1
getFields
2.1
CRAP 8.8
« MyParsePP/Rule.pm ↑ Summary MyParsePP.pm »
1 package DBIx::MyParsePP::Query;
2 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 6 ▶use DBIx::MyParsePP::Lexer;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 6 ▶use DBIx::MyParsePP::Rule;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 6 ▶use constant MYPARSE_QUERY_LEXER => 0;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 6 ▶use constant MYPARSE_QUERY_ROOT => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 6 ▶use constant MYPARSE_QUERY_EXPECTED => 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 6 ▶use constant MYPARSE_QUERY_ACTUAL => 3;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 6 my %args = (
13 lexer => MYPARSE_QUERY_LEXER,
14 root => MYPARSE_QUERY_ROOT
15 );
16  
17 6 1;
18  
19 sub new {
20 11 ▶ my $class = shift;
Subroutine new: called CC=3 SCAR=11.2
Pod undocumented
21  
22 11 my $query = bless([], $class);
23 11 my $max_arg = (scalar(@_) / 2) - 1;
24  
25 11 foreach my $i (0..$max_arg) {
26 11 ▶ if (exists $args{$_[$i * 2]}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args{$_[$i * 2]}) { } 11 0 11
27 11 $query->[$args{$_[$i * 2]}] = $_[$i * 2 + 1];
28 } else {
29 0 warn("Unkown argument '$_[$i * 2]' to DBIx::MyParsePP::Query->new()");
30 }
31 }
32  
33 11 return $query;
34 }
35  
36 sub getLexer {
37 3 ▶ return $_[0]->[MYPARSE_QUERY_LEXER];
Subroutine getLexer: called CC=1 SCAR=0.0
Pod undocumented
38 }
39  
40 sub setRoot {
41 9 ▶ $_[0]->[MYPARSE_QUERY_ROOT] = $_[1];
Subroutine setRoot: called CC=1 SCAR=0.0
Pod undocumented
42 }
43  
44 sub getRoot {
45 1 ▶ return $_[0]->[MYPARSE_QUERY_ROOT];
Subroutine getRoot: called CC=1 SCAR=0.0
Pod undocumented
46 }
47  
48 sub root {
49 10 ▶ return $_[0]->[MYPARSE_QUERY_ROOT];
Subroutine root: called CC=1 SCAR=0.0
Pod undocumented
50 }
51  
52 sub setExpected {
53 2 ▶ my $query = shift;
Subroutine setExpected: called CC=1 SCAR=0.0
Pod undocumented
54 2 $query->[MYPARSE_QUERY_EXPECTED] = \@_;
55 }
56  
57 sub getExpected {
58 0 ▶ return $_[0]->[MYPARSE_QUERY_EXPECTED];
Subroutine getExpected: not called CC=1 SCAR=6.9
Pod undocumented
59 }
60  
61 sub expected {
62 2 ▶ return $_[0]->[MYPARSE_QUERY_EXPECTED];
Subroutine expected: called CC=1 SCAR=0.0
Pod undocumented
63 }
64  
65 sub setActual {
66 2 ▶ $_[0]->[MYPARSE_QUERY_ACTUAL] = $_[1];
Subroutine setActual: called CC=1 SCAR=0.0
Pod undocumented
67 }
68  
69 sub getActual {
70 0 ▶ return $_[0]->[MYPARSE_QUERY_ACTUAL];
Subroutine getActual: not called CC=1 SCAR=6.9
Pod undocumented
71 }
72  
73 sub actual {
74 2 ▶ return $_[0]->[MYPARSE_QUERY_ACTUAL];
Subroutine actual: called CC=1 SCAR=0.0
Pod undocumented
75 }
76  
77 sub line {
78 1 ▶ $_[0]->getLine();
Subroutine line: called CC=1 SCAR=0.0
Pod undocumented
79 }
80
81 sub getLine {
82 1 ▶ my $query = shift;
Subroutine getLine: called CC=1 SCAR=0.0
Pod undocumented
83 1 my $lexer = $query->getLexer();
84 1 return $lexer->getLine();
85 }
86  
87 sub pos {
88 1 ▶ $_[0]->getPos();
Subroutine pos: called CC=1 SCAR=0.0
Pod undocumented
89 }
90 sub getPos {
91 1 ▶ my $query = shift;
Subroutine getPos: called CC=1 SCAR=0.0
Pod undocumented
92 1 my $lexer = $query->getLexer();
93 1 return $lexer->getPos();
94 }
95  
96 sub tokens {
97 1 ▶ $_[0]->getTokens();
Subroutine tokens: called CC=1 SCAR=0.0
Pod undocumented
98 }
99  
100 sub getTokens {
101 1 ▶ my $query = shift;
Subroutine getTokens: called CC=1 SCAR=0.0
Pod undocumented
102 1 my $lexer = $query->getLexer();
103 1 return $lexer->getTokens();
104 }
105  
106 sub toString() {
107 0 ▶ my $query = shift;
Subroutine toString: not called CC=2 SCAR=17.9
Pod undocumented
108 0 my $root = $query->root();
109 0 ▶ return defined $root ? $root->toString() : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $root ? : 0 0 0
110 }
111  
112 sub print {
113 0 ▶ return $_[0]->toString();
Subroutine print: not called CC=1 SCAR=6.9
Pod undocumented
114 }
115  
116 sub extract {
117 3 ▶ my $query = shift;
Subroutine extract: called CC=2 SCAR=7.1
Pod undocumented
118 3 my $root = $query->root();
119 3 ▶ return defined $root ? $root->extract(@_) : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $root ? : 3 0 3
120 }
121  
122 sub shrink {
123 2 ▶ my $query = shift;
Subroutine shrink: called CC=2 SCAR=7.1
Pod undocumented
124 2 my $root = $query->root();
125 2 ▶ return defined $root ? $root->shrink() : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $root ? : 2 0 2
126 }
127  
128 sub getWhere {
129 0 ▶ return $_[0]->extract('where_clause');
Subroutine getWhere: not called CC=1 SCAR=6.9
Pod undocumented
130 }
131  
132 sub getGroupBy {
133 0 ▶ return $_[0]->extract('group_clause');
Subroutine getGroupBy: not called CC=1 SCAR=6.9
Pod undocumented
134 }
135  
136 sub getOrderBy {
137 0 ▶ return $_[0]->extract('order_clause');
Subroutine getOrderBy: not called CC=1 SCAR=6.9
Pod undocumented
138 }
139  
140 sub getLimit {
141 0 ▶ return $_[0]->extract('limit_clause');
Subroutine getLimit: not called CC=1 SCAR=6.9
Pod undocumented
142 }
143  
144 sub getFrom {
145 0 ▶ return $_[0]->extract('table_factor','join_table','derived_table_list','select_from');
Subroutine getFrom: not called CC=1 SCAR=6.9
Pod undocumented
146 }
147  
148 sub getSelectItems {
149 0 ▶ return $_[0]->extract('select_item_list','select_part2','select_init');
Subroutine getSelectItems: not called CC=1 SCAR=6.9
Pod undocumented
150 }
151  
152 sub getFields {
153 1 ▶ my $root = $_[0]->root();
Subroutine getFields: called CC=2 SCAR=7.2
Pod undocumented
154 1 ▶ return defined $root ? $root->getFields() : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $root ? : 1 0 1
155 }
156  
157 sub getTables {
158 1 ▶ my $root = $_[0]->root();
Subroutine getTables: called CC=2 SCAR=7.2
Pod undocumented
159 1 ▶ return defined $root ? $root->getTables() : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $root ? : 1 0 1
160 }
161  
162 6 1;
163  
164 __END__
« MyParsePP/Rule.pm ↑ Summary MyParsePP.pm »