SQL call formatting style

David Miller justdave at syndicomm.com
Tue Mar 25 23:35:17 UTC 2003


On 3/25/03 11:27 PM +0000, Gervase Markham wrote:

> If we are to allow newlines, then my proposal would become:
>
>    my ($comma, $separated, $list, $of, $vars, $on, $one, $line) =
>      $dbh->some_longwinded_methodname("SELECT some SQL variables
>                                        ON multiple lines
>                                        IF necessary
>                                        AND enclosed in quotes
>                                        BECAUSE we all understand them
>                                        WITH placeholders ?, ?, ?",
>                                       undef,
>                                       $placeholder, $variables, $here);
>
> I believe this strikes a reasonable balance between clarity and
> longwindedness. It may be true that if you space the SQL out a lot, it's
> easier to read the SQL - but it's much harder to follow the flow of the
> code around it.
>
> Re: Myk's point: when do we ever do queries with newlines embedded in
> the query data?

The example you just posted (quoted here) does. :)
-- 
Dave Miller      Project Leader, Bugzilla Bug Tracking System
http://www.justdave.net/             http://www.bugzilla.org/



More information about the developers mailing list