SQL::S...eration(3pm)
π SQL::Statement::Operation π
okay bestie, buckle up because this is the SQL::Statement::Operation family reunion and honestly? it's giving iconic Perl internals energy β¨ this is part 1 of 2 so don't you dare close the tab, we're not done yet π«Ά
β¨ NAME β¨
SQL::Statement::Operation β the abstract base class for all the operation terms π
it's the mama of the whole squad.
π SYNOPSIS π
# create an operation with an SQL::Statement object as owner, specifying
# the operation name (for error purposes), the left and the right
# operand
my $term = SQL::Statement::Operation->new( $owner, $op, $left, $right );
# access the result of that operation
$term->value( $eval );
πΈ DESCRIPTION πΈ
so SQL::Statement::Operation is an abstract base class, meaning you don't really use it directly β it's the vibe-setter that hands every operation term its shared interface. no cap π§
π¦ INHERITANCE π¦
SQL::Statement::Operation
ISA SQL::Statement::Term
π METHODS π
newβ spins up a brand new operation term, fresh out the box β¨valueβ hands you the result of the operation by callingoperateπ«Άoperateβ abstract method, it's the one that actually does the operation. derived classes must override it, fr fr.opβ tells you the name of the operation that ran πleftβ gives you the left operand (if there even is one) πrightβ gives you the right operand (if any) πDESTROYβ tears the term down andundefs the weak reference to the owner, plus the stored operation, the left operand and the right operand. it's the goodbye era π
π SQL::Statement::Operation::Neg π
NAME
SQL::Statement::Operation::Neg β the negate operation π«
SYNOPSIS
# create an <not> operation with an SQL::Statement object as owner,
# specifying the operation name, the left and B<no> right operand
my $term = SQL::Statement::Neg->new( $owner, $op, $left, undef );
# access the result of that operation
$term->value( $eval );
DESCRIPTION
SQL::Statement::Operation::Neg π
INHERITANCE
SQL::Statement::Operation::Neg
ISA SQL::Statement::Operation
ISA SQL::Statement::Term
METHODS
operateβ returns the logical negated value of the left operand. flip it and reverse it β¨
π SQL::Statement::Operation::And π
NAME
SQL::Statement::Operation::And β the and operation π«Ά
SYNOPSIS
# create an C<and> operation with an SQL::Statement object as owner,
# specifying the operation name, the left and the right operand
my $term = SQL::Statement::And->new( $owner, $op, $left, $right );
# access the result of that operation
$term->value( $eval );
DESCRIPTION
SQL::Statement::Operation::And implements the logical "and" operation between two terms β both gotta say yes or it's a no π
INHERITANCE
SQL::Statement::Operation::And
ISA SQL::Statement::Operation
ISA SQL::Statement::Term
METHODS
operateβ returns the result of the logical "and" operation for the values of the left and right operand π₯
π SQL::Statement::Operation::Or π
NAME
SQL::Statement::Operation::Or β the or operation
SYNOPSIS
# create an C<or> operation with an SQL::Statement object as owner,
# specifying the operation name, the left and the right operand
my $term = SQL::Statement::Or->new( $owner, $op, $left, $right );
# access the result of that operation
$term->value( $eval );
DESCRIPTION
SQL::Statement::Operation::Or implements the logical "or" operation between two terms β either one says yes and we're thriving β¨
INHERITANCE
SQL::Statement::Operation::Or
ISA SQL::Statement::Operation
ISA SQL::Statement::Term
METHODS
operateβ returns the result of the logical "or" operation for the values of the left and right operand πΈ
π¦ SQL::Statement::Operation::Is π¦
NAME
SQL::Statement::Operation::Is β the is operation
SYNOPSIS
# create an C<is> operation with an SQL::Statement object as owner,
# specifying the operation name, the left and the right operand
my $term = SQL::Statement::Is->new( $owner, $op, $left, $right );
# access the result of that operation
$term->value( $eval );
DESCRIPTION
SQL::Statement::Operation::Is supports: "IS NULL", "IS TRUE" and "IS FALSE" π
the right operand is always evaluated in boolean context when it's "IS TRUE" or "IS FALSE". and "IS NULL" returns true even if the left term is an empty string ('') β yeah, plot twist π
INHERITANCE
SQL::Statement::Operation::Is
ISA SQL::Statement::Operation
ISA SQL::Statement::Term
METHODS
operateβ returns true when the left term is null, true or false β all based on the requested right value π
π§ SQL::Statement::Operation::ANSI::Is π§
NAME
SQL::Statement::Operation::ANSI::Is β the is operation (ANSI edition)
SYNOPSIS
# create an C<is> operation with an SQL::Statement object as owner,
# specifying the operation name, the left and the right operand
my $term = SQL::Statement::Is->new( $owner, $op, $left, $right );
# access the result of that operation
$term->value( $eval );
DESCRIPTION
SQL::Statement::Operation::ANSI::Is supports: "IS NULL", "IS TRUE" and "IS FALSE" β¨ the right operand is always evaluated in boolean context for "IS TRUE" and "IS FALSE". and "IS NULL" returns true if the right term is not defined, and false otherwise β different from its non-ANSI cousin, iykyk π
INHERITANCE
SQL::Statement::Operation::Is
ISA SQL::Statement::Operation
ISA SQL::Statement::Term
METHODS
operateβ returns true when the left term is null, true or false β based on the requested right value π«Ά
π SQL::Statement::Operation::Contains π
NAME
SQL::Statement::Operation::Contains β the in operation
SYNOPSIS
# create an C<in> operation with an SQL::Statement object as owner,
# specifying the operation name, the left and the right operand
my $term = SQL::Statement::Contains->new( $owner, $op, $left, $right );
# access the result of that operation
$term->value( $eval );
DESCRIPTION
SQL::Statement::Operation::Contains expects the right operand to be an array of SQL::Statement::Term instances π it checks whether the left operand is in the list of right operands or not, like:
$left->value($eval) ~~ map { $_->value($eval) } @{$right}
INHERITANCE
SQL::Statement::Operation::Contains
ISA SQL::Statement::Operation
ISA SQL::Statement::Term
METHODS
operateβ returns true when the left term is equal to any of the right terms β¨
π SQL::Statement::Operation::Between π
NAME
SQL::Statement::Operation::Between β the between operation
SYNOPSIS
# create an C<between> operation with an SQL::Statement object as owner,
# specifying the operation name, the left and the right operand
my $term = SQL::Statement::Between->new( $owner, $op, $left, $right );
# access the result of that operation
$term->value( $eval );
DESCRIPTION
SQL::Statement::Operation::Between expects the right operand to be an array of 2 SQL::Statement::Term instances π
it checks whether the left operand sits between the right operands, like:
( $left->value($eval) >= $right[0]->value($eval) )
&& ( $left->value($eval) <= $right[1]->value($eval) )
INHERITANCE
SQL::Statement::Operation::Between
ISA SQL::Statement::Operation
ISA SQL::Statement::Term
METHODS
operateβ returns true when the left term is between both right terms πΈ
π SQL::Statement::Operation::Equality π
NAME
SQL::Statement::Operation::Equality β abstract base class for comparisons
SYNOPSIS
# create an C<equality> operation with an SQL::Statement object as owner,
# specifying the operation name, the left and the right operand
my $term = SQL::Statement::Equality->new( $owner, $op, $left, $right );
# access the result of that operation
$term->value( $eval );
DESCRIPTION
SQL::Statement::Operation::Equality implements compare operations between two terms β it picks either numerical comparison or string comparison, depending on whether both operands are numeric or not. the way it just knows π€
INHERITANCE
SQL::Statement::Operation::Equality
ISA SQL::Statement::Operation
ISA SQL::Statement::Term
METHODS
operateβ returns the result of the comparison β¨numcmpβ abstract method that does the numeric comparison of both terms. must be overridden by derived classes πstrcmpβ abstract method that does the string comparison of both terms. must be overridden by derived classes π
π SQL::Statement::Operation::Equal π
NAME
SQL::Statement::Operation::Equal β implements the equal operation
SYNOPSIS
# create an C<equal> operation with an SQL::Statement object as owner,
# specifying the operation name, the left and the right operand
my $term = SQL::Statement::Equal->new( $owner, $op, $left, $right );
# access the result of that operation
$term->value( $eval );
DESCRIPTION
SQL::Statement::Operation::Equal implements compare operations between two numbers and two strings π
INHERITANCE
SQL::Statement::Operation::Equal
ISA SQL::Statement::Operation::Equality
ISA SQL::Statement::Operation
ISA SQL::Statement::Term
METHODS
numcmpβ returns true when"$left == $right"π₯strcmpβ returns true when"$left eq $right"β¨
π SQL::Statement::Operation::NotEqual π
NAME
SQL::Statement::Operation::NotEqual β implements the not equal operation
SYNOPSIS
# create an C<not equal> operation with an SQL::Statement object as owner,
# specifying the operation name, the left and the right operand
my $term = SQL::Statement::NotEqual->new( $owner, $op, $left, $right );
# access the result of that operation
$term->value( $eval );
DESCRIPTION
SQL::Statement::Operation::NotEqual implements negated compare operations between two numbers and two strings π
INHERITANCE
SQL::Statement::Operation::NotEqual
ISA SQL::Statement::Operation::Equality
ISA SQL::Statement::Operation
ISA SQL::Statement::Term
METHODS
numcmpβ returns true when"$left != $right"πstrcmpβ returns true when"$left ne $right"πΈ
π¦ SQL::Statement::Operation::Lower π¦
NAME
SQL::Statement::Operation::Lower β implements the lower than operation
SYNOPSIS
# create an C<lower than> operation with an SQL::Statement object as owner,
# specifying the operation name, the left and the right operand
my $term = SQL::Statement::Lower->new( $owner, $op, $left, $right );
# access the result of that operation
$term->value( $eval );
DESCRIPTION
SQL::Statement::Operation::Lower implements lower than compare operations between two numbers and two strings π
INHERITANCE
SQL::Statement::Operation::Lower
ISA SQL::Statement::Operation::Equality
ISA SQL::Statement::Operation
ISA SQL::Statement::Term
METHODS
numcmpβ returns true when"$left < $right"πstrcmpβ returns true when"$left lt $right"β¨
π₯ SQL::Statement::Operation::Greater π₯
NAME
SQL::Statement::Operation::Greater β implements the greater than operation
SYNOPSIS
# create an C<greater than> operation with an SQL::Statement object as owner,
# specifying the operation name, the left and the right operand
my $term = SQL::Statement::Greater->new( $owner, $op, $left, $right );
# access the result of that operation
$term->value( $eval );
DESCRIPTION
SQL::Statement::Operation::Greater implements greater than compare operations between two numbers and two strings π
INHERITANCE
SQL::Statement::Operation::Greater
ISA SQL::Statement::Operation::Equality
ISA SQL::Statement::Operation
ISA SQL::Statement::Term
METHODS
numcmpβ returns true when$left $right>π«Άstrcmpβ returns true when"$left gt $right"π
π SQL::Statement::Operation::LowerEqual π
NAME
SQL::Statement::Operation::LowerEqual β implements the lower equal operation
SYNOPSIS
# create an C<lower equal> operation with an SQL::Statement object as owner,
# specifying the operation name, the left and the right operand
my $term = SQL::Statement::LowerEqual->new( $owner, $op, $left, $right );
# access the result of that operation
$term->value( $eval );
SQL::Statement::Operation::LowerEqual is the lil' gremlin in charge of lower-equal compares β think <= energy, and it works between two numbers and between two strings. π«Ά
𧬠INHERITANCE π§¬
SQL::Statement::Operation::LowerEqual
ISA SQL::Statement::Operation::Equality
ISA SQL::Statement::Operation
ISA SQL::Statement::Term
look at that bloodline bestie, it's giving legacy π
π οΈ METHODS π οΈ
numcmp
Returns true when $left <= $right
strcmp
Returns true when $left le $right
π NAME π
SQL::Statement::Operation::GreaterEqual β the one that implements the greater equal operation π
β¨ SYNOPSIS β¨
# create an C<greater equal> operation with an SQL::Statement object as owner,
# specifying the operation name, the left and the right operand
my $term = SQL::Statement::GreaterEqual->new( $owner, $op, $left, $right );
# access the result of that operation
$term->value( $eval );
π DESCRIPTION π
SQL::Statement::Operation::GreaterEqual implements greater equal compare operations between two numbers and two strings. no cap, that's the whole job π¦
𧬠INHERITANCE π§¬
SQL::Statement::Operation::GreaterEqual
ISA SQL::Statement::Operation::Equality
ISA SQL::Statement::Operation
ISA SQL::Statement::Term
π οΈ METHODS π οΈ
numcmp
Returns true when $left = $right>
strcmp
Returns true when "$left ge $right"
π NAME π
SQL::Statement::Operation::Regexp β an abstract base class for comparisons based on regular expressions π§
β¨ SYNOPSIS β¨
# create an C<regexp> operation with an SQL::Statement object as owner,
# specifying the operation name, the left and the right operand
my $term = SQL::Statement::Regexp->new( $owner, $op, $left, $right );
# access the result of that operation
$term->value( $eval );
π DESCRIPTION π
SQL::Statement::Operation::Regexp implements the comparisons for the "LIKE" operation family. it's the momager of the regexp-based comparisons, fr fr β¨
𧬠INHERITANCE π§¬
SQL::Statement::Operation::Regexp
ISA SQL::Statement::Operation
ISA SQL::Statement::Term
π οΈ METHODS π οΈ
operate
Returns the result of the comparison. π
right
Returns the regular expression based on the right term. The right term is expected to be constant β so "a LIKE b" is not supported. π
regexp
Abstract method which must return a regular expression (qr//) from the given string. Must be overridden by derived classes. π
π NAME π
SQL::Statement::Operation::Like β implements the like operation πΈ
β¨ SYNOPSIS β¨
# create an C<like> operation with an SQL::Statement object as owner,
# specifying the operation name, the left and the right operand
my $term = SQL::Statement::Like->new( $owner, $op, $left, $right );
# access the result of that operation
$term->value( $eval );
π DESCRIPTION π
SQL::Statement::Operation::Like is used to the comparisons for the "LIKE" operation. that's it, that's the vibe π¦
𧬠INHERITANCE π§¬
SQL::Statement::Operation::Like
ISA SQL::Statement::Operation::Regexp
ISA SQL::Statement::Operation
ISA SQL::Statement::Term
π οΈ METHODS π οΈ
regexp
Returns qr/^$right$/s π
π NAME π
SQL::Statement::Operation::Clike β implements the clike operation π
β¨ SYNOPSIS β¨
# create an C<clike> operation with an SQL::Statement object as owner,
# specifying the operation name, the left and the right operand
my $term = SQL::Statement::Clike->new( $owner, $op, $left, $right );
# access the result of that operation
$term->value( $eval );
π DESCRIPTION π
SQL::Statement::Operation::Clike is used to the comparisons for the "CLIKE" operation. iconic behavior honestly π
𧬠INHERITANCE π§¬
SQL::Statement::Operation::Clike
ISA SQL::Statement::Operation::Regexp
ISA SQL::Statement::Operation
ISA SQL::Statement::Term
π οΈ METHODS π οΈ
regexp
Returns qr/^$right$/si β¨
π NAME π
SQL::Statement::Operation::RLike β implements the rlike operation π₯
β¨ SYNOPSIS β¨
# create an C<rlike> operation with an SQL::Statement object as owner,
# specifying the operation name, the left and the right operand
my $term = SQL::Statement::RLike->new( $owner, $op, $left, $right );
# access the result of that operation
$term->value( $eval );
π DESCRIPTION π
SQL::Statement::Operation::RLike is used to the comparisons for the "RLIKE" operation. slay π
𧬠INHERITANCE π§¬
SQL::Statement::Operation::RLike
ISA SQL::Statement::Operation::Regexp
ISA SQL::Statement::Operation
ISA SQL::Statement::Term
π οΈ METHODS π οΈ
regexp
Returns qr/$right$/s π
π 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.
okay bestie that's a wrap on part 2, you ate the whole thing π
β¨ this was perl v5.30.3 dated 2020-10-23, and the page you just devoured is SQL::S...eration(3pm) β go forth and compare things, fr fr π¦π
π¦ where this page comes from
- debian bookworm: libsql-statement-perl 1.414-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libsql-statement-perl 1.414-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libsql-statement-perl 1.414-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libsql-statement-perl 1.414-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libsql-statement-perl 1.414-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libsql-statement-perl 1.414-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms