[Dbix-class] Constructing "WHERE" clause in DBIx

fREW Schmidt frioux at gmail.com
Tue Aug 11 03:50:29 GMT 2009


Yeah, that's gonna need to be

-or =3D> [ ... ]

And I don't think the -and is needed.

On Aug 10, 2009 8:58 PM, "Rob Kinyon" <rob.kinyon at gmail.com> wrote:

On Mon, Aug 10, 2009 at 19:42, Eric Wee<EWee at au.westfield.com> wrote: >
$c->model(DB::Client)->searc...
This should do the trick. Peter will chime in with corrections as needed.

->search({ is_retail =3D> '1', enabled_date =3D> { '!=3D' =3D> undef },
   enabled_date =3D> { '<' =3D> \'NOW()' },
   -and =3D> {
       -or =3D> {
           disabled_date =3D> undef,
           disabled_date =3D> { '<' =3D> 'enabled_date' },
           disabled_date =3D> { '>' =3D> \'NOW()', }
       },
   },
});

The scalarref is important for NOW() otherwise it won't work.

Rob

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive:
http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20090810/ce4=
d01fe/attachment.htm


More information about the DBIx-Class mailing list