From: Stephen Leake <stephen_leake@stephe-leake.org>
Subject: Re: GNATCOLL.SQL.SQL_Select - I'm in Left_Join hell
Date: Sat, 21 Apr 2012 08:02:14 -0400
Date: 2012-04-21T08:02:14-04:00 [thread overview]
Message-ID: <82vckti989.fsf@stephe-leake.org> (raw)
In-Reply-To: 4f90233d$0$282$14726298@news.sunsite.dk
Thomas Løcke <thomas@12boo.net> writes:
> https://gist.github.com/2421241
>
> It is, IMHO, very unreadable with all those nested Left_Join calls. Is
> there a better/prettier way, without falling back to embedding an SQL
> string in the Ada source?
> The SQL generated by the above SQL_Select call works fine, it's just
> that I'm finding it very hard to read.
You could do each Left join in separate statements before the
SQL_Select, and pass the final table to SQL_Select.
or use named association to reorder the lines:
Left_Join
(Full => Organization,
On => Organization.Org_Id = Contactentity_Organization.Org_Id,
Partial => Left_Join
(Full => Contactentity_Organization,
On => Contactentity.Ce_Id = Contactentity_Organization.Ce_Id,
Partial => Left_Join
(Full => Contactentity,
On => Contactentity.Ce_Id = Contactentity_Tag.Ce_Id,
Partial => Left_Join
(Contactentity_Tag,
Tag,
Tag.Tag_Id = Contactentity_Tag.Tag_Id)))),
I don't like the 'full' and 'partial' names, but this looks a little better.
--
-- Stephe
next prev parent reply other threads:[~2012-04-21 12:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-19 14:37 GNATCOLL.SQL.SQL_Select - I'm in Left_Join hell Thomas Løcke
2012-04-21 12:02 ` Stephen Leake [this message]
2012-04-23 7:33 ` Thomas Løcke
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox