1SQL::Statement::FunctioUns(e3r)Contributed Perl DocumentSaQtLi:o:nStatement::Function(3)
2
3
4
6 SQL::Statement::Function - abstract base class for all function
7 executing terms
8
10 # this class doesn't have a common constructor, because all derived classes
11 # have their special requirements
12
14 SQL::Statement::Function is an abstract base class providing the
15 interface for all function executing terms.
16
18 SQL::Statement::Function
19 ISA SQL::Statement::Term
20
22 DESTROY
23 Destroys the term and undefines the weak reference to the owner as well
24 as the reference to the parameter list.
25
27 SQL::Statement::Function::UserFunc - implements executing a perl
28 subroutine
29
31 # create an user function term with an SQL::Statement object as owner,
32 # specifying the function name, the subroutine name (full qualified)
33 # and the parameters to the subroutine
34 my $term = SQL::Statement::Function::UserFunc->new( $owner, $name, $sub, \@params );
35 # access the result of that operation
36 $term->value( $eval );
37
39 SQL::Statement::Function::UserFunc implements a term which returns the
40 result of the specified subroutine.
41
43 SQL::Statement::Function
44 ISA SQL::Statement::Term
45
47 new
48 Instantiates a new "SQL::Statement::Function::UserFunc" instance.
49
50 value
51 Invokes the given subroutine with the values of the params and return
52 it's result:
53
54 my @params = map { $_->value($eval); } @{ $self->{PARAMS} };
55 return $subpkg->$subname( $self->{OWNER}, @params );
56
58 SQL::Statement::Function::NumericEval - implements numeric evaluation
59 of a term
60
62 # create an user function term with an SQL::Statement object as owner,
63 # specifying the expression to evaluate and the parameters to the subroutine
64 my $term = SQL::Statement::NumericEval->new( $owner, $expr, \@params );
65 # access the result of that operation
66 $term->value( $eval );
67
69 SQL::Statement::Function::NumericEval implements the numeric evaluation
70 of a term. All parameters are expected to be numeric.
71
73 SQL::Statement::Function::NumericEval
74 ISA SQL::Statement::Function
75 ISA SQL::Statement::Term
76
78 new
79 Instantiates a new "SQL::Statement::Function::NumericEval" instance.
80 Takes $owner, $expr and \@params as arguments (in specified order).
81
82 value
83 Returns the result of the evaluated expression.
84
86 SQL::Statement::Function::Trim - implements the built-in trim function
87 support
88
90 # create an trim function term with an SQL::Statement object as owner,
91 # specifying the spec, char and the parameters to the subroutine
92 my $term = SQL::Statement::Trim->new( $owner, $spec, $char, \@params );
93 # access the result of that operation
94 $term->value( $eval );
95
97 SQL::Statement::Function::Trim implements string trimming.
98
100 SQL::Statement::Function::Trim
101 ISA SQL::Statement::Function
102 ISA SQL::Statement::Term
103
105 new
106 Instantiates a new "SQL::Statement::Function::Trim" instance. Takes
107 $owner, $spec, $char and \@params as arguments (in specified order).
108
109 Meaning of the parameters:
110
111 $spec
112 Can be on of 'LEADING', 'TRAILING' 'BOTH'. Trims the leading chars,
113 trailing chars or at both ends, respectively.
114
115 Defaults to 'BOTH'.
116
117 $char
118 The character to trim - defaults to ' '
119
120 \@params
121 Expected to be an array with exact 1 element (more aren't
122 evaluated).
123
124 value
125 Returns the trimmed value of first parameter argument.
126
128 SQL::Statement::Function::SubString - implements the built-in
129 sub-string function support
130
132 # create an substr function term with an SQL::Statement object as owner,
133 # specifying the start and length of the sub string to extract from the
134 # first element of \@params
135 my $term = SQL::Statement::SubString->new( $owner, $start, $length, \@params );
136 # access the result of that operation
137 $term->value( $eval );
138
140 SQL::Statement::Function::SubString implements a sub-string extraction
141 term.
142
144 SQL::Statement::Function::SubString
145 ISA SQL::Statement::Function
146 ISA SQL::Statement::Term
147
149 new
150 Instantiates a new "SQL::Statement::Function::SubString" instance.
151 Takes $owner, $start, $length and \@params as arguments (in specified
152 order).
153
154 Meaning of the parameters:
155
156 $start
157 Specifies the start position to extract the sub-string. This is
158 expected to be a SQL::Statement::Term instance. The first character
159 in a string has the position 1.
160
161 $length
162 Specifies the length of the extracted sub-string. This is expected
163 to be a SQL::Statement::Term instance.
164
165 If omitted, everything to the end of the string is returned.
166
167 \@params
168 Expected to be an array with exact 1 element (more aren't
169 evaluated).
170
171 value
172 Returns the extracted sub-string value from first parameter argument.
173
175 SQL::Statement::Function::StrConcat - implements the built-in string
176 concatenation
177
179 # create an substr function term with an SQL::Statement object as owner
180 # and \@params to concatenate
181 my $term = SQL::Statement::StrConcat->new( $owner, \@params );
182 # access the result of that operation
183 $term->value( $eval );
184
186 SQL::Statement::Function::StrConcat implements a string concatenation
187 term.
188
190 SQL::Statement::Function::StrConcat
191 ISA SQL::Statement::Function
192 ISA SQL::Statement::Term
193
195 new
196 Instantiates a new "SQL::Statement::Function::StrConcat" instance.
197
198 value
199 Returns the concatenated string composed of the parameter values.
200
202 Copyright (c) 2009-2017 by Jens Rehsack: rehsackATcpan.org
203
204 All rights reserved.
205
206 You may distribute this module under the terms of either the GNU
207 General Public License or the Artistic License, as specified in the
208 Perl README file.
209
210
211
212perl v5.28.0 2017-04-06 SQL::Statement::Function(3)