Re: Using q() to define a query



Jonathan Leffler wrote:
On Jan 10, 2008 7:59 PM, Colin Wetherbee <cww@xxxxxxxxxxxxxxxx <mailto:cww@xxxxxxxxxxxxxxxx>> wrote:
[Fri Jan 11 03:49:09 2008] [debug] Log.pm(36): [client
192.168.171.80 <http://192.168.171.80>]
[JetSet] SELECT departure_date, eq.name <http://eq.name> AS
equipment,\n
dp.full_city AS departure_city, ap.full_city AS arrival_city,\n
ca.name <http://ca.name> AS carrier_name, number\n FROM
jsjourneys\n FULL OUTER
JOIN jscarriers AS ca ON jsjourneys.carrier = ca.id\n FULL OUTER
JOIN jsequipment AS eq ON jsjourneys.equipment = eq.id\n JOIN
jsports AS dp ON jsjourneys.departure_port = dp.id\n JOIN jsports
AS ap ON jsjourneys.arrival_port = ap.id\n ORDER BY departure_date

Notice the newline characters in there. If those were really in the
query, I can't imagine the database would run it, so I suppose they're
an artifact of the combination of using q() to quote my query and using
Apache's logger to output it.

If you're referring to the newlines in the $sql string - I'd be astonished if the DBMS did not handle them OK. If you're referring to the \n notation in the log output, I'd assume those are interpolated by the Apache logging module.

I'm somewhat surprised Apache didn't parse the newlines, though... which made me wonder whether they were showing up as literal '\n' in the query, too? Probably not.

Colin
.



Relevant Pages

  • RE: XML Cross Apply ...
    ... "The APPLY operator allows you to invoke a table-valued function for each ... row returned by an outer table expression of a query. ... CROSS APPLY allows us to use the nodes method (or ... I believe that the discrepancy between your query return and mine is due to ...
    (microsoft.public.sqlserver.xml)
  • Re: Great SWT Program
    ... Either a newline in a query is entered by hitting enter, ... literal newlines, namely whatever you need to hit instead of hitting ... and nonstandard tab behavior in such a text control. ... And if you want to show separator characters explicitly in a string representation, ^J is a good way of showing a line feed. ...
    (comp.lang.java.programmer)
  • Re: Query with left outer join all of a sudden wont work?
    ... I did change the join between the queries to an inner join and it worked. ... just doesn't work if it is a left or right outer join. ... rather than on the top most query calling it). ... can you post the whole SQL statement? ...
    (microsoft.public.access.queries)
  • Re: Great SWT Program
    ... matches newlines, then in the first case that means you type an enter ... something other than an enter into the query to match a newline. ... and neither of those is emacs. ... Well, while I didn't actually /call/ you a liar, it is interesting to ...
    (comp.lang.java.programmer)
  • RE: XML Cross Apply ...
    ... So in your query, wouldn't you need to use OUTER APPLY instead of CROSS ... In the following code 'noder' is a table that contains an xml column named ...
    (microsoft.public.sqlserver.xml)