[Vtigercrm-developers] Postgres Integration in 4.2.5

Allan Bush allan.bush+vtiger_dev at gmail.com
Tue Mar 14 08:53:36 PST 2006


I usually write queries in a slightly more compact format:

$query = "SELECT <select list>
                 FROM <table1>
                           INNER JOIN <table2>
                                     ON <clause>
                 WHERE <clause1>
                           AND <clause2>
                 GROUP BY <clause>
                 ORDER BY <order>";

The uppercase SQL commands and lower case tables/columns is definitely
a must though.  Also for short queries I find putting everything in
one line to be reasonable, as a rule of thumb if the query doesn't
wrap in an 80 character wide terminal I usually put it in one line.

On 3/14/06, Jeff Kowalczyk <jtk at yahoo.com> wrote:
> Sergio A. Kessler wrote:
> > I always write queries like this:
> >
> > $query = <<<END
> >     select
> >         *
> >     from
> >         table1,
> >         table2,
> >     where
> >         foo = ?
> >         and
> >         zeta = ?
> >     group by
> >         tita
> >     order by
> >         zeta
> > END;
>
> I usually don't go the extra mile to indent, but your way is the clearest
> and most diff-friendly, by far.
>
> I do like to capitalize SQL keywords though, could we agree on adding that
> to the style standard?
>
>  $query = <<<END
>      SELECT
>          *
>      FROM
>          table1,
>          table2,
>      WHERE
>          foo = ?
>          AND
>          zeta = ?
>      GROUP BY
>          tita
>      ORDER BY
>          zeta
>  END;
>
> +1 on reformatting SQL queries according to a strict style standard.
>
> Once consensus is reached on a style, a trac ticket should be created, and
> each reformat-only commit should include 'refs #XX' in the checkin
> message
>
> _______________________________________________
> This vtiger.com email is sponsored by Zoho Planner. Still scribbling down your To-Do's on bits of paper & palms of your hands? Try the AJAX enabled, personal organizer online, Zoho Planner for FREE instead! http://zohoplanner.com/?vt
>




More information about the vtigercrm-developers mailing list