SQL::Statement::Function3pm
Abstract base class for all function executing terms
Usage
# this class does not have a common constructor, because all derived classes# have their special requirements
# create an user function term with an SQL::Statement object as owner,# specifying the function name, the subroutine name (full qualified)# and the parameters to the subroutinemy $term = SQL::Statement::Function::UserFunc->new( $owner, $name, $sub, \@params );# access the result of that operation$term->value( $eval );
# create an user function term with an SQL::Statement object as owner,# specifying the expression to evaluate and the parameters to the subroutinemy $term = SQL::Statement::NumericEval->new( $owner, $expr, \@params );# access the result of that operation$term->value( $eval );
# create an trim function term with an SQL::Statement object as owner,# specifying the spec, char and the parameters to the subroutinemy $term = SQL::Statement::Trim->new( $owner, $spec, $char, \@params );# access the result of that operation$term->value( $eval );
# create an substr function term with an SQL::Statement object as owner,# specifying the start and length of the sub string to extract from the# first element of \@paramsmy $term = SQL::Statement::SubString->new( $owner, $start, $length, \@params );# access the result of that operation$term->value( $eval );
# create an substr function term with an SQL::Statement object as owner# and \@params to concatenatemy $term = SQL::Statement::StrConcat->new( $owner, \@params );# access the result of that operation$term->value( $eval );
Overview
SQL::Statement::Function is an abstract base class providing the interface for all function executing terms.
Inheritance
SQL::Statement::FunctionISA SQL::Statement::Term
Methods
Destroy
Destroys the term and undefines the weak reference to the owner as well as the reference to the parameter list.
Overview
SQL::Statement::Function::UserFunc implements a term which returns the result of the specified subroutine.
Inheritance
SQL::Statement::FunctionISA SQL::Statement::Term
Methods
new
Instantiates a new "SQL::Statement::Function::UserFunc" instance.
value
Invokes the given subroutine with the values of the params and return it's result:
my @params = map { $_->value($eval); } @{ $self->{PARAMS} };return $subpkg->$subname( $self->{OWNER}, @params );
Overview
SQL::Statement::Function::NumericEval implements the numeric evaluation of a term. All parameters are expected to be numeric.
Inheritance
SQL::Statement::Function::NumericEvalISA SQL::Statement::FunctionISA SQL::Statement::Term
Methods
new
Instantiates a new "SQL::Statement::Function::NumericEval" instance. Takes $owner, $expr and \@params as arguments (in specified order).
value
Returns the result of the evaluated expression.
Overview
SQL::Statement::Function::Trim implements string trimming.
Inheritance
SQL::Statement::Function::TrimISA SQL::Statement::FunctionISA SQL::Statement::Term
Methods
new
Instantiates a new "SQL::Statement::Function::Trim" instance. Takes $owner, $spec, $char and \@params as arguments (in specified order).
Meaning of the parameters:
- $spec
-
Can be on of 'LEADING', 'TRAILING' 'BOTH'. Trims the leading chars, trailing chars or at both ends, respectively.
Defaults to 'BOTH'.
- $char
-
The character to trim - defaults to
' '
- \@params
-
Expected to be an array with exact 1 element (more are not evaluated).
value
Returns the trimmed value of first parameter argument.
Overview
SQL::Statement::Function::SubString implements a sub-string extraction term.
Inheritance
SQL::Statement::Function::SubStringISA SQL::Statement::FunctionISA SQL::Statement::Term
Methods
new
Instantiates a new "SQL::Statement::Function::SubString" instance. Takes $owner, $start, $length and \@params as arguments (in specified order).
Meaning of the parameters:
- $start
-
Specifies the start position to extract the sub-string. This is expected to be a SQL::Statement::Term instance. The first character in a string has the position 1.
- $length
-
Specifies the length of the extracted sub-string. This is expected to be a SQL::Statement::Term instance.
If omitted, everything to the end of the string is returned.
- \@params
-
Expected to be an array with exact 1 element (more are not evaluated).
value
Returns the extracted sub-string value from first parameter argument.
Overview
SQL::Statement::Function::StrConcat implements a string concatenation term.
Inheritance
SQL::Statement::Function::StrConcatISA SQL::Statement::FunctionISA SQL::Statement::Term
Methods
new
Instantiates a new "SQL::Statement::Function::StrConcat" instance.
value
Returns the concatenated string composed of the parameter values.
Author and copyright
Copyright (c) 2009-2020 by Jens Rehsack: rehsackATcpan.org
All rights reserved.
You may distribute this module under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.
Releases
8 releases since Debian 6.0 (Squeeze); the text changed 5 times.