[Dbix-class] SQL::Abstract 1.x subqueries patch

Dami Laurent (PJ) laurent.dami at justice.ge.ch
Tue Nov 4 09:02:40 GMT 2008


 

>-----Message d'origine-----
>De : Zbigniew Lukasiak [mailto:zzbbyy at gmail.com] 
>Envoyé : mardi, 4. novembre 2008 09:25
>À : DBIx::Class user and developer list
>Objet : Re: [Dbix-class] SQL::Abstract 1.x subqueries patch
>
>One thing that I am really missing from SQL::A is a way to specify an
>arbitrary SQL fragment together with bindings and have it interpolated
>into the rest of the query and bindings.  In DBIC with
>'search_literal' method and 'where' attribute you can add arbitrary
>SQL - but only at the beginning or the end of the query and frequently
>it gets the bindings in the wrong order.  In standard SQL::A there are
>many tricks you can do - but for example clause like:
>
>? REGEXP keyword
>
>cannot be normally represented in SQL::A ( you can try tricks like {
>$value => { '' => '' },...  } - but there is always something wrong in
>the resulting query).
>

Same problem with many other clauses like 'MATCH .. AGAINST ..', etc.


>Long time ago I've patched my SQL::A version and added a rule that
>double reference to array was resulting in $array[0] being
>interpolated into the query and the rest into the bindings array.
>This is in a way extending the convention that reference to a scalar
>is interpolated as literary SQL.  I did not used it for long - and it
>is lost now - but I can recreate it if such a hack could be accepted
>into the main SQL::A tree.
>


SQLA1.50 implements that convention : \[$sql, @bind] is interpreted
as literal SQL. There are a couple of other extensions -- have a look 
at the L<CHANGES> section. 

Laurent Dami



More information about the DBIx-Class mailing list