[Catalyst] Class::DBI, Controller::Root, set_sql "redefined"

Len Jaffe lenjaffe at jaffesystems.com
Wed Jun 7 02:30:33 CEST 2006



--- Marc Brooks <marc at xconcepts.com> wrote:
> statements.  Does the DBIx::Class have an equivalent
> of the set_sql()?
> 
> EXAMPLE:
> 
>         SELECT *
>           FROM catalog AS node1, catalog AS node2
>          WHERE node2.lft BETWEEN node1.lft AND
> node1.rgt
>            AND $level = (     
>                SELECT COUNT(*)
>                  FROM catalog AS node3
>                 WHERE node3.lft BETWEEN node1.lft
> AND node1.rgt
>                   AND node2.lft BETWEEN node3.lft
> AND node3.rgt
>                   AND node3.id
>                       NOT IN (node2.id, node1.id)
>            )
>            AND node2.id != node1.id AND node1.id =
> '$id'

I'm surprised SQL expresses that at all. It looks like
your writing a relational calculus algorithm to braid
hair...

BTW: you should replace '$id' with a bind variable or
the SQL injection gremlins will get you.





More information about the Catalyst mailing list