SQL::S...eration(3pm)

πŸ“¦
version 1.414 Β· 6 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– 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 calling operate 🫢
  • 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 and undefs 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. πŸŽ€

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 πŸ’œ


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