1SQL::Statement::OperatiUosne(r3)Contributed Perl DocumenStQaLt:i:oSntatement::Operation(3)
2
3
4
6 SQL::Statement::Operation - base class for all operation terms
7
9 # create an operation with an SQL::Statement object as owner, specifying
10 # the operation name (for error purposes), the left and the right
11 # operand
12 my $term = SQL::Statement::Operation->new( $owner, $op, $left, $right );
13 # access the result of that operation
14 $term->value( $eval );
15
17 SQL::Statement::Operation is an abstract base class providing the
18 interface for all operation terms.
19
21 SQL::Statement::Operation
22 ISA SQL::Statement::Term
23
25 new
26 Instantiates new operation term.
27
28 value
29 Return the result of the operation of the term by calling operate
30
31 operate
32 Abstract method which will do the operation of the term. Must be
33 overridden by derived classes.
34
35 op
36 Returns the name of the executed operation.
37
38 left
39 Returns the left operand (if any).
40
41 right
42 Returns the right operand (if any).
43
44 DESTROY
45 Destroys the term and undefines the weak reference to the owner as well
46 as the stored operation, the left and the right operand.
47
49 SQL::Statement::Operation::Neg - negate operation
50
52 # create an <not> operation with an SQL::Statement object as owner,
53 # specifying the operation name, the left and B<no> right operand
54 my $term = SQL::Statement::Neg->new( $owner, $op, $left, undef );
55 # access the result of that operation
56 $term->value( $eval );
57
59 SQL::Statement::Operation::Neg
60
62 SQL::Statement::Operation::Neg
63 ISA SQL::Statement::Operation
64 ISA SQL::Statement::Term
65
67 operate
68 Return the logical negated value of the left operand.
69
71 SQL::Statement::Operation::And - and operation
72
74 # create an C<and> operation with an SQL::Statement object as owner,
75 # specifying the operation name, the left and the right operand
76 my $term = SQL::Statement::And->new( $owner, $op, $left, $right );
77 # access the result of that operation
78 $term->value( $eval );
79
81 SQL::Statement::Operation::And implements the logical "and" operation
82 between two terms.
83
85 SQL::Statement::Operation::And
86 ISA SQL::Statement::Operation
87 ISA SQL::Statement::Term
88
90 operate
91 Return the result of the logical "and" operation for the values of the
92 left and right operand.
93
95 SQL::Statement::Operation::Or - or operation
96
98 # create an C<or> operation with an SQL::Statement object as owner,
99 # specifying the operation name, the left and the right operand
100 my $term = SQL::Statement::Or->new( $owner, $op, $left, $right );
101 # access the result of that operation
102 $term->value( $eval );
103
105 SQL::Statement::Operation::Or implements the logical "or" operation
106 between two terms.
107
109 SQL::Statement::Operation::Or
110 ISA SQL::Statement::Operation
111 ISA SQL::Statement::Term
112
114 operate
115 Return the result of the logical "or" operation for the values of the
116 left and right operand.
117
119 SQL::Statement::Operation::Is - is operation
120
122 # create an C<is> operation with an SQL::Statement object as owner,
123 # specifying the operation name, the left and the right operand
124 my $term = SQL::Statement::Is->new( $owner, $op, $left, $right );
125 # access the result of that operation
126 $term->value( $eval );
127
129 SQL::Statement::Operation::Is supports: "IS NULL", "IS TRUE" and "IS
130 FALSE". The right operand is always evaluated in boolean context in
131 case of "IS TRUE" and "IS FALSE". "IS NULL" returns true even if the
132 left term is an empty string ('').
133
135 SQL::Statement::Operation::Is
136 ISA SQL::Statement::Operation
137 ISA SQL::Statement::Term
138
140 operate
141 Returns true when the left term is null, true or false - based on the
142 requested right value.
143
145 SQL::Statement::Operation::ANSI::Is - is operation
146
148 # create an C<is> operation with an SQL::Statement object as owner,
149 # specifying the operation name, the left and the right operand
150 my $term = SQL::Statement::Is->new( $owner, $op, $left, $right );
151 # access the result of that operation
152 $term->value( $eval );
153
155 SQL::Statement::Operation::ANSI::Is supports: "IS NULL", "IS TRUE" and
156 "IS FALSE". The right operand is always evaluated in boolean context
157 in case of "IS TRUE" and "IS FALSE". "IS NULL" returns true if the
158 right term is not defined, false otherwise.
159
161 SQL::Statement::Operation::Is
162 ISA SQL::Statement::Operation
163 ISA SQL::Statement::Term
164
166 operate
167 Returns true when the left term is null, true or false - based on the
168 requested right value.
169
171 SQL::Statement::Operation::Contains - in operation
172
174 # create an C<in> operation with an SQL::Statement object as owner,
175 # specifying the operation name, the left and the right operand
176 my $term = SQL::Statement::Contains->new( $owner, $op, $left, $right );
177 # access the result of that operation
178 $term->value( $eval );
179
181 SQL::Statement::Operation::Contains expects the right operand is an
182 array of SQL::Statement::Term instances. It checks whether the left
183 operand is in the list of the right operands or not like:
184
185 $left->value($eval) ~~ map { $_->value($eval) } @{$right}
186
188 SQL::Statement::Operation::Contains
189 ISA SQL::Statement::Operation
190 ISA SQL::Statement::Term
191
193 operate
194 Returns true when the left term is equal to any of the right terms
195
197 SQL::Statement::Operation::Between - between operation
198
200 # create an C<between> operation with an SQL::Statement object as owner,
201 # specifying the operation name, the left and the right operand
202 my $term = SQL::Statement::Between->new( $owner, $op, $left, $right );
203 # access the result of that operation
204 $term->value( $eval );
205
207 SQL::Statement::Operation::Between expects the right operand is an
208 array of 2 SQL::Statement::Term instances. It checks whether the left
209 operand is between the right operands like:
210
211 ( $left->value($eval) >= $right[0]->value($eval) )
212 && ( $left->value($eval) <= $right[1]->value($eval) )
213
215 SQL::Statement::Operation::Between
216 ISA SQL::Statement::Operation
217 ISA SQL::Statement::Term
218
220 operate
221 Returns true when the left term is between both right terms
222
224 SQL::Statement::Operation::Equality - abstract base class for
225 comparisons
226
228 # create an C<equality> operation with an SQL::Statement object as owner,
229 # specifying the operation name, the left and the right operand
230 my $term = SQL::Statement::Equality->new( $owner, $op, $left, $right );
231 # access the result of that operation
232 $term->value( $eval );
233
235 SQL::Statement::Operation::Equality implements compare operations
236 between two terms - choosing either numerical comparison or string
237 comparison, depending whether both operands are numeric or not.
238
240 SQL::Statement::Operation::Equality
241 ISA SQL::Statement::Operation
242 ISA SQL::Statement::Term
243
245 operate
246 Return the result of the comparison.
247
248 numcmp
249 Abstract method which will do the numeric comparison of both terms.
250 Must be overridden by derived classes.
251
252 strcmp
253 Abstract method which will do the string comparison of both terms. Must
254 be overridden by derived classes.
255
257 SQL::Statement::Operation::Equal - implements equal operation
258
260 # create an C<equal> operation with an SQL::Statement object as owner,
261 # specifying the operation name, the left and the right operand
262 my $term = SQL::Statement::Equal->new( $owner, $op, $left, $right );
263 # access the result of that operation
264 $term->value( $eval );
265
267 SQL::Statement::Operation::Equal implements compare operations between
268 two numbers and two strings.
269
271 SQL::Statement::Operation::Equal
272 ISA SQL::Statement::Operation::Equality
273 ISA SQL::Statement::Operation
274 ISA SQL::Statement::Term
275
277 numcmp
278 Return true when "$left == $right"
279
280 strcmp
281 Return true when "$left eq $right"
282
284 SQL::Statement::Operation::NotEqual - implements not equal operation
285
287 # create an C<not equal> operation with an SQL::Statement object as owner,
288 # specifying the operation name, the left and the right operand
289 my $term = SQL::Statement::NotEqual->new( $owner, $op, $left, $right );
290 # access the result of that operation
291 $term->value( $eval );
292
294 SQL::Statement::Operation::NotEqual implements negated compare
295 operations between two numbers and two strings.
296
298 SQL::Statement::Operation::NotEqual
299 ISA SQL::Statement::Operation::Equality
300 ISA SQL::Statement::Operation
301 ISA SQL::Statement::Term
302
304 numcmp
305 Return true when "$left != $right"
306
307 strcmp
308 Return true when "$left ne $right"
309
311 SQL::Statement::Operation::Lower - implements lower than operation
312
314 # create an C<lower than> operation with an SQL::Statement object as owner,
315 # specifying the operation name, the left and the right operand
316 my $term = SQL::Statement::Lower->new( $owner, $op, $left, $right );
317 # access the result of that operation
318 $term->value( $eval );
319
321 SQL::Statement::Operation::Lower implements lower than compare
322 operations between two numbers and two strings.
323
325 SQL::Statement::Operation::Lower
326 ISA SQL::Statement::Operation::Equality
327 ISA SQL::Statement::Operation
328 ISA SQL::Statement::Term
329
331 numcmp
332 Return true when "$left < $right"
333
334 strcmp
335 Return true when "$left lt $right"
336
338 SQL::Statement::Operation::Greater - implements greater than operation
339
341 # create an C<greater than> operation with an SQL::Statement object as owner,
342 # specifying the operation name, the left and the right operand
343 my $term = SQL::Statement::Greater->new( $owner, $op, $left, $right );
344 # access the result of that operation
345 $term->value( $eval );
346
348 SQL::Statement::Operation::Greater implements greater than compare
349 operations between two numbers and two strings.
350
352 SQL::Statement::Operation::Greater
353 ISA SQL::Statement::Operation::Equality
354 ISA SQL::Statement::Operation
355 ISA SQL::Statement::Term
356
358 numcmp
359 Return true when $left $right>
360
361 strcmp
362 Return true when "$left gt $right"
363
365 SQL::Statement::Operation::LowerEqual - implements lower equal
366 operation
367
369 # create an C<lower equal> operation with an SQL::Statement object as owner,
370 # specifying the operation name, the left and the right operand
371 my $term = SQL::Statement::LowerEqual->new( $owner, $op, $left, $right );
372 # access the result of that operation
373 $term->value( $eval );
374
376 SQL::Statement::Operation::LowerEqual implements lower equal compare
377 operations between two numbers and two strings.
378
380 SQL::Statement::Operation::LowerEqual
381 ISA SQL::Statement::Operation::Equality
382 ISA SQL::Statement::Operation
383 ISA SQL::Statement::Term
384
386 numcmp
387 Return true when "$left <= $right"
388
389 strcmp
390 Return true when "$left le $right"
391
393 SQL::Statement::Operation::GreaterEqual - implements greater equal
394 operation
395
397 # create an C<greater equal> operation with an SQL::Statement object as owner,
398 # specifying the operation name, the left and the right operand
399 my $term = SQL::Statement::GreaterEqual->new( $owner, $op, $left, $right );
400 # access the result of that operation
401 $term->value( $eval );
402
404 SQL::Statement::Operation::GreaterEqual implements greater equal
405 compare operations between two numbers and two strings.
406
408 SQL::Statement::Operation::GreaterEqual
409 ISA SQL::Statement::Operation::Equality
410 ISA SQL::Statement::Operation
411 ISA SQL::Statement::Term
412
414 numcmp
415 Return true when $left = $right>
416
417 strcmp
418 Return true when "$left ge $right"
419
421 SQL::Statement::Operation::Regexp - abstract base class for comparisons
422 based on regular expressions
423
425 # create an C<regexp> operation with an SQL::Statement object as owner,
426 # specifying the operation name, the left and the right operand
427 my $term = SQL::Statement::Regexp->new( $owner, $op, $left, $right );
428 # access the result of that operation
429 $term->value( $eval );
430
432 SQL::Statement::Operation::Regexp implements the comparisons for the
433 "LIKE" operation family.
434
436 SQL::Statement::Operation::Regexp
437 ISA SQL::Statement::Operation
438 ISA SQL::Statement::Term
439
441 operate
442 Return the result of the comparison.
443
444 right
445 Returns the regular expression based on the right term. The right term
446 is expected to be constant - so "a LIKE b" in not supported.
447
448 regexp
449 Abstract method which must return a regular expression ("qr//") from
450 the given string. Must be overridden by derived classes.
451
453 SQL::Statement::Operation::Like - implements the like operation
454
456 # create an C<like> operation with an SQL::Statement object as owner,
457 # specifying the operation name, the left and the right operand
458 my $term = SQL::Statement::Like->new( $owner, $op, $left, $right );
459 # access the result of that operation
460 $term->value( $eval );
461
463 SQL::Statement::Operation::Like is used to the comparisons for the
464 "LIKE" operation.
465
467 SQL::Statement::Operation::Like
468 ISA SQL::Statement::Operation::Regexp
469 ISA SQL::Statement::Operation
470 ISA SQL::Statement::Term
471
473 regexp
474 Returns "qr/^$right$/s"
475
477 SQL::Statement::Operation::Clike - implements the clike operation
478
480 # create an C<clike> operation with an SQL::Statement object as owner,
481 # specifying the operation name, the left and the right operand
482 my $term = SQL::Statement::Clike->new( $owner, $op, $left, $right );
483 # access the result of that operation
484 $term->value( $eval );
485
487 SQL::Statement::Operation::Clike is used to the comparisons for the
488 "CLIKE" operation.
489
491 SQL::Statement::Operation::Clike
492 ISA SQL::Statement::Operation::Regexp
493 ISA SQL::Statement::Operation
494 ISA SQL::Statement::Term
495
497 regexp
498 Returns "qr/^$right$/si"
499
501 SQL::Statement::Operation::RLike - implements the rlike operation
502
504 # create an C<rlike> operation with an SQL::Statement object as owner,
505 # specifying the operation name, the left and the right operand
506 my $term = SQL::Statement::RLike->new( $owner, $op, $left, $right );
507 # access the result of that operation
508 $term->value( $eval );
509
511 SQL::Statement::Operation::RLike is used to the comparisons for the
512 "RLIKE" operation.
513
515 SQL::Statement::Operation::RLike
516 ISA SQL::Statement::Operation::Regexp
517 ISA SQL::Statement::Operation
518 ISA SQL::Statement::Term
519
521 regexp
522 Returns "qr/$right$/s"
523
525 Copyright (c) 2009-2020 by Jens Rehsack: rehsackATcpan.org
526
527 All rights reserved.
528
529 You may distribute this module under the terms of either the GNU
530 General Public License or the Artistic License, as specified in the
531 Perl README file.
532
533
534
535perl v5.32.1 2021-01-27 SQL::Statement::Operation(3)