[Dbix-class] Complex joins

Iain C Docherty dbix-class at iain-docherty.com
Wed Apr 10 19:40:20 GMT 2013


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 =3D probes.star_id
  AND probes.alliance_id=3D26
LEFT JOIN body
  ON star.id =3D body.star_id
  AND probes.id is not null
LEFT JOIN empire
  ON body.empire_id =3D empire.id
LEFT JOIN building
  ON body.id =3D building.body_id
  AND building.class=3D'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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20130410/b53=
829f6/attachment.htm


More information about the DBIx-Class mailing list