line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package DBIx::Romani::Query::Function; |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=begin xmldoc |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
DBIx::Romani::Query::Function |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# Don't use directy, create a sub-class! |
10
|
|
|
|
|
|
|
use DBIx::Romani::Query::Function; |
11
|
|
|
|
|
|
|
my $func = DBIx::Romani::Query::Function->new(); |
12
|
|
|
|
|
|
|
$func->add( DBIx::Romani::Query::SQL::Column->new('column_name') ); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
The parent class of all query functions. A query function is something |
17
|
|
|
|
|
|
|
like COUNT() in SQL, but can include control flow functions that are |
18
|
|
|
|
|
|
|
executed in the query engine and not in SQL. This class is abstract and |
19
|
|
|
|
|
|
|
can't be used directly. |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=cut |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
288
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=begin xmldoc |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
new() |
30
|
|
|
|
|
|
|
Constructs a new query object |
31
|
|
|
|
|
|
|
none |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=cut |
35
|
|
|
|
|
|
|
sub new |
36
|
|
|
|
|
|
|
{ |
37
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
38
|
0
|
|
|
|
|
|
my $args = shift; |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
my $self = { |
41
|
|
|
|
|
|
|
arguments => [ ] |
42
|
|
|
|
|
|
|
}; |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
bless $self, $class; |
45
|
0
|
|
|
|
|
|
return $self; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=begin xmldoc |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
get_arguments() |
52
|
|
|
|
|
|
|
Gets the argument list. |
53
|
|
|
|
|
|
|
A list reference. |
54
|
|
|
|
|
|
|
none |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |
58
|
0
|
|
|
0
|
0
|
|
sub get_arguments { return shift->{arguments}; } |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=begin xmldoc |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
add() |
64
|
|
|
|
|
|
|
Add an object to the argument list |
65
|
|
|
|
|
|
|
object |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=cut |
69
|
|
|
|
|
|
|
sub add |
70
|
|
|
|
|
|
|
{ |
71
|
0
|
|
|
0
|
0
|
|
my ($self, $arg) = @_; |
72
|
0
|
|
|
|
|
|
push @{$self->{arguments}}, $arg; |
|
0
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=begin xmldoc |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
visit() |
79
|
|
|
|
|
|
|
Abstract method to "execute" the function |
80
|
|
|
|
|
|
|
visitor |
81
|
|
|
|
|
|
|
The result of the function |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |
85
|
|
|
|
|
|
|
sub visit |
86
|
|
|
|
|
|
|
{ |
87
|
0
|
|
|
0
|
0
|
|
die "Abstract."; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub copy_arguments |
91
|
|
|
|
|
|
|
{ |
92
|
0
|
|
|
0
|
0
|
|
my ($self, $other) = @_; |
93
|
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
foreach my $arg ( @{$other->get_arguments()} ) |
|
0
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
{ |
96
|
0
|
|
|
|
|
|
$self->add_arguments( $arg->clone() ); |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub clone |
101
|
|
|
|
|
|
|
{ |
102
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
103
|
0
|
|
|
|
|
|
my $class = ref($self); |
104
|
|
|
|
|
|
|
|
105
|
0
|
|
|
|
|
|
my $clone; |
106
|
0
|
|
|
|
|
|
$clone = $class->new(); |
107
|
0
|
|
|
|
|
|
$clone->copy_arguments( $self ); |
108
|
|
|
|
|
|
|
|
109
|
0
|
|
|
|
|
|
return $clone; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
1; |
113
|
|
|
|
|
|
|
|