From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,333d8690b2d403e5 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Received: by 10.68.125.233 with SMTP id mt9mr8652480pbb.5.1335009705096; Sat, 21 Apr 2012 05:01:45 -0700 (PDT) Path: r9ni81644pbh.0!nntp.google.com!news1.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!news.flashnewsgroups.com-b7.4zTQh5tI3A!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: GNATCOLL.SQL.SQL_Select - I'm in Left_Join hell References: <4f90233d$0$282$14726298@news.sunsite.dk> Date: Sat, 21 Apr 2012 08:02:14 -0400 Message-ID: <82vckti989.fsf@stephe-leake.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (windows-nt) Cancel-Lock: sha1:Z0PXak/VOP+RUzStDcloHBZ3DYM= MIME-Version: 1.0 X-Complaints-To: abuse@flashnewsgroups.com Organization: FlashNewsgroups.com X-Trace: e0c484f92a1a8e029e66127655 X-Received-Bytes: 1939 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Date: 2012-04-21T08:02:14-04:00 List-Id: Thomas Løcke 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