SQL call formatting style
myk at mozilla.org
Tue Mar 25 17:00:04 UTC 2003
Gervase Markham wrote:
> The new DBI stuff has raised a few issues about how we write SQL
> statements in Perl code (see bug 180635 for some discussion.) IMO,
> it's important to have a consistent style, because it makes code
> easier to read. What that style is is far less important than the
> One of the factors is multi-line strings. Myk: am I correct in saying
> that you have asked for
> "separate quotes for " .
> "each line of the string"
> because it makes logs look better than
> "one string which runs
> over multiple lines"?
Yes, because newlines mess up the structured format in which "mysqladmin
processlist" displays queries, making it hard to identify errant
queries, especially programmatically. Otherwise I'd be on bbaetz' side,
since I find multi-line strings easier to work with, but being able to
work with the MySQL process list is really important for Bugzilla system
administrators, so I think we should use concatenation or newline
substitution where possible (queries with strings that may have newlines
in them can't be easily stripped of newlines with s/\s+/ /g).
More information about the developers