NAME

DB::Object::LIKE - LIKE Operator Object

SYNOPSIS

my $op = $dbh->LIKE( '%something%' );
# or, byt providing a list of arguments
my $op = $dbh->LIKE( '%', @something, '%' );
# will produce:
LIKE '%something%'

"'something'" == $dbh->LIKE( '%something%' );
# 'something' LIKE '%something%';
"something" != $dbh->LIKE( '%something%' );
# 'something' NOT LIKE '%something%';

my $tbl = $dbh->my_table || die( $dbh->error );
$tbl->as( 't' );
my $sql = $tbl->fo->somefield == $dbh->LIKE( '%something%' );
say $sql;
# t.somefield LIKE '%something%';

DESCRIPTION

This is the LIKE object class inheriting from DB::Object::Operator

METHODS

new

Takes a list of values that are saved in the newly created object returned.

as_string

Returns a string representation of this operator.

For example:

$dbh->LIKE( '%something%' );
# or
$dbh->LIKE( '%', @something, '%' );
# LIKE '%something%';

operator

Returns LIKE

value

In list context, returns an array of those values passed to "new" and in scalar context, it returns those value as array reference.

OVERLOADING

Objects for this class have their == and != operators overloaded.

When overloading is called, it returns a new DB::Object::Expression that represents the formatted statement.

SEE ALSO

https://www.postgresql.org/docs/current/functions-matching.html

https://dev.mysql.com/doc/refman/8.4/en/pattern-matching.html

https://www.sqlite.org/lang_corefunc.html#like, https://www.sqlite.org/lang_expr.html#the_like_glob_regexp_match_and_extract_operators

AUTHOR

Jacques Deguest <jack@deguest.jp>

COPYRIGHT & LICENSE

Copyright (c) 2025 DEGUEST Pte. Ltd.

You can use, copy, modify and redistribute this package and associated files under the same terms as Perl itself.