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