[Dbix-class] Re: using 'if' within where

Sung Gong sung at bio.cc
Tue Jul 3 13:20:09 GMT 2012


Well, the query actually can be reduced to '(column_a is null or
column_a>=10)', which is equivalent with:
$cons{"column_a"}=[undef,{'>='=>10}];
then
schema->search(\%cons)

On 3 July 2012 13:34, Sung Gong <sung at bio.cc> wrote:
> Hi all,
>
> Is it possible to use 'if' function within a where clause?
> For example:
> where if (column_a is null, 1, column_a>=10)
>
> I know the sql can be registered as a custom resultset, but my case of
> a bit complex (the number of binding values actually depends on the
> number of parameters received).
>
> SQL::Abstract does not explain the use of control flow functions.
>
> Any help for this?
>
> Regards,
> Sung



More information about the DBIx-Class mailing list