SQL call formatting style

Gervase Markham gerv at mozilla.org
Tue Mar 25 23:27:59 UTC 2003


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?

Gerv




More information about the developers mailing list