Bob MacCallum <uncool...@gmail.com> writes:

> Hello,
>
> I can't seem to (>1h banging head against wall) get this search
> condition working
>
> $interval = '1 hour';
> $rs->search(
> {
>  birth_time => { '<' => \[ "now() - interval ?", [interval => $interval] ] }
> }
> )->count

> Can anyone tell me what I'm doing wrong, please?
>
> For more, including the runtime error, please see
> http://paste.scsys.co.uk/269786

The "INTERVAL '...'" syntax (and generally TYPE '...') only works for
literal strings, not bind parameters.  You need to use a cast instead,
like this: \["now() - ?::interval", $interval ]


-- 
"The surreality of the universe tends towards a maximum" -- Skud's Law
"Never formulate a law or axiom that you're not prepared to live with
 the consequences of."                              -- Skud's Meta-Law


_______________________________________________
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

Reply via email to