[Dbix-class] PATCH: Support for arbitrary SQL in relationship definition

Peter Rabbitson rabbit+dbic at rabbit.us
Sun Jun 21 11:57:16 GMT 2009


Daniel Ruoso wrote:
> Em Qui, 2009-06-11 às 13:10 +0200, Peter Rabbitson escreveu:
>> It would be much better to introduce real arbitrary support via SQLA
>> where condition parsing. Only real problem is that a hashref is already
>> resrved for foreign./self. pairs, and what's even worse - it recently
>> started taking single unqualified column names too.
>> My vote would be to add an additional key to this hash, something like
>> -extra_cond => $arbitrary_sqla_where_structure. Or we could put the
>> join cond in the join attributes.
> 
> I'm not that all against it, but...
> 
>> In any case - just allowing scalar refs is really weak and incomplete.
>> We already have all the code to parse arbitrarily complex conditions.
>> All we need is a consensus on how to do it.
> 
> Using scalar ref to allow arbitrary SQL is consistent with SQLA, since
> you can use it in regular SQLA where data structures, so I think it's
> not really weak or incomplete...
> 

The problem is that if we release this, the de-facto standard of arbitrary
join conditions will become literal SQL. We might as well all start using
CDBI :) (and besides you already can include literal SQL in {from})

As I say in [1], as soon as a viable general solution is proposed, it will
be written. If not - the 09 dev cycle will come up with a new syntax which
will solve this shortcoming once and for all. (this btw seems more likely,
as any time a discussion to solve this within 08 is solicited, everyone
goes silent)

Cheers

[1] http://lists.scsys.co.uk/pipermail/dbix-class/2009-June/008070.html



More information about the DBIx-Class mailing list