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