[Dbix-class] PATCH: Support for arbitrary SQL in relationship
definition
Peter Rabbitson
rabbit+dbic at rabbit.us
Thu Jun 11 11:10:24 GMT 2009
Daniel Ruoso wrote:
> Hi,
>
> For some reason this patch is sitting on my local git copy for a while,
> and now I'm not sure it was even sent at some point... /me--
>
> So, here goes a patch against current 0.08 trunk to support arbitrary
> SQL in the join condition with an included test, which allow something
> like:
>
> __PACKAGE__->has_many(
> cds_90s => 'DBICTest::Schema::CD',
> { 'foreign.artist' => 'self.artistid',
> 'foreign.year' => \"LIKE '19%'" }
> );
>
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.
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.
More information about the DBIx-Class
mailing list