Hi Lain,
What you are looking for is the coderef syntax for declaring a relationship
as describe here:
https://metacpan.org/module/DBIx::Class::Relationship::Base#condition

Cheers,
Matt


On Wed, Apr 10, 2013 at 3:40 PM, Iain C Docherty <
dbix-cl...@iain-docherty.com> wrote:

> I have googled for this, as far as I can tell DBIx::Class does not support
> complex joins. An example of which is below.
>
> select star.id,star.name,body.id,body.name,building.class,empire.name
> from star
> LEFT JOIN probes
>   ON star.id = probes.star_id
>   AND probes.alliance_id=26
> LEFT JOIN body
>   ON star.id = body.star_id
>   AND probes.id is not null
> LEFT JOIN empire
>   ON body.empire_id = empire.id
> LEFT JOIN building
>   ON body.id = building.body_id
>   AND building.class='Lacuna::DB::Result::Building::Permanent::Ravine'
> WHERE star.x > -10
> AND star.x < 10
> AND star.y > -10
> AND star.y < 10
> group by body.id
>
> Is there any way that this could be implemented in DBIx::Class or do I
> have to drop down to SQL and implement a custom ResultSource?
>
> (and in case you are wondering, this is to do with the open source project
> at https://github.com/plainblack/Lacuna-Server-Open )
>
> --
> Kind Regards
> Iain
>
> _______________________________________________
> 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
>
_______________________________________________
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