SQL call formatting style

Gervase Markham gerv at mozilla.org
Wed Mar 26 07:23:38 UTC 2003


>>No, I mean, one objection to the s/\s+/ /gs; thing was (if I read it
>>right) that it would remove newlines embedded in e.g. search strings in
>>queries. I was asking whether we actually do that?
> 
> In Search.pm we do.  Everything gets quoted where appropriate and appended
> to the appropriate section of the query.  By the time we're done, we have
> one big long query string.

Yes, I know :-) What I mean is, is there ever a reason to have a \n 
embedded in a query string? If not, you could do:

s/\s*\n\s*/ /gs;

to remove all the whitespace introduced by linebreaking the SQL, while 
keeping all other whitespace intact.

Gerv




More information about the developers mailing list