
SQL::Entity::Condition - Entity SQL Condition abstraction.

Represents sql condition.

use SQL::Entity::Condition ':all';
#Creates "a = 1" condition
my $cond = sql_cond('a', '=', 1);
#Creates "a = 1 AND b > 1 AND c < 1" condition
my $cond = sql_and(
sql_cond('a', '=', 1),
sql_cond('b', '>', 1),
sql_cond('c', '<', 1),
);
Creates "a = 1 OR b > 1 OR c < 1" condition
my $cond = sql_or(
sql_cond('a', '=', 1),
sql_cond('b', '>', 1),
sql_cond('c', '<', 1),
);
Creates "(a = 1 AND b = 1) OR c LIKE 1" condition
my $cond = sql_and(
sql_cond('a', '=', 1),
sql_cond('b', '=', 1),
)->or(
sql_cond('c', 'LIKE', 1)
);
None by default. sql_cond sql_and sql_or by tag 'all'
First operand for condition.
Sets the first condition operand .
Operator
Second operand for condition.
Sets the secound condition operand .
Relation between compsite condition.
Association to composie condition
Create simple Condition object.
Create a composite Condition object with AND relation between current object and passed in condition list.
Create a composite Condition object with OR relation between current object an passed in condition list.
Create a composite Condition object with AND relation.
Create a composite Condition object with OR relation.
Create a composite Condition object.
Converts condition to string
Return expression for passed in operand.
Converts passed in data structure to condition object. SQL::Entity::Condition->struct_to_condition(a => 1, b => 3); converts to a = 1 AND b = 3
SQL::Entity::Condition->struct_to_condition(a => 1, b => [1,3]); converts to a = 1 AND b IN (1,3)
SQL::Entity::Condition->struct_to_condition(a => 1, b => {operator => '!=', operand => 3}); converts to a = 1 AND b != 3
SQL::Entity::Condition->struct_to_condition(a => 1, b => {operator => 'LIKE', operand => "'A%'", relation => 'OR'}); coverts to a = 1 OR b LIKE 'A%'
Return operator, operand2, relation for passed in operand

SQL::Query SQL::Entity SQL::Entity::Column

The SQL::Entity::Condition module is free software. You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.

Adrian Witas, adrian@webapp.strefa.pl