NAME
DBIx::Custom::Where - Where clause
SYNOPSYS
my $where = $dbi ->where;
$where ->clause([ 'and' , 'title like :title' , 'price = :price' ]);
$where ->clause([ 'and' , ':title{like}' , ':price{=}' ]);
my $where_clause = "$where" ;
my $where_clause = $where ->to_string;
$where ->clause([ 'and' , ':title{like}' , ':price{=}' ]);
$where ->param({ price => 1900});
$where ->clause([ 'and' , ':title{like}' , ':price{=}' ]);
$where ->param({ title => 'Perl' });
$where ->clause([ 'and' , ':title{like}' , ':price{=}' ]);
$where ->param({});
$where ->clause([ 'or' , ':title{like}' , ':price{=}' ]);
$where ->clause([ 'and' , ':price{>}' , ':price{<}' ]);
$where ->param({ price => [1000, 2000]});
$where ->clause([ 'and' , ':price{>}' , ':price{<}' ]);
$where ->param({ price => [1000, $dbi ->not_exists]});
$where ->clause([ 'and' , ':price{>}' , ':price{<}' ]);
$where ->param({ price => [ $dbi ->not_exists, 2000]});
$where ->clause(
[
'and' ,
':price{=}' ,
[ 'or' , ':title{=}' , ':title{=}' , ':title{=}' ]
]
);
$where ->clause([ 'and' , ':book.title{like}' , ':book.price{=}' ]);
|
ATTRIBUTES
clause
my $clause = $where ->clause;
$where = $where ->clause(
[ 'and' ,
':title{=}' ,
[ 'or' , ':date{<}' , ':date{>}' ]
]
);
|
Where clause. Above one is expanded to the following SQL by to_string If all parameter names is exists.
where title = :title and ( date < :date or date > :date )
|
param
my $param = $where ->param;
$where = $where ->param({
title => 'Perl' ,
date => [ '2010-11-11' , '2011-03-05' ],
});
|
dbi
my $dbi = $where ->dbi;
$where = $where ->dbi( $dbi );
|
DBIx::Custom object.
join
my $join = $where -> join ;
$join = $where -> join ( $join );
|
join information. This values is addd to select method join
option values.
$where -> join ([ 'left join author on book.author = authro.id' ]);
|
METHODS
DBIx::Custom::Where inherits all methods from Object::Simple and implements the following new ones.
to_string
Convert where clause to string.
double quote is override to execute to_string
method.
my $string_where = "$where" ;
|