Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#38 JS Formatting Error in window.open('showSql.jsp call

v2.4.beta
open
nobody
5
2012-12-05
2007-08-08
Jeremy Thomerson
No

If you have a multi-line SQL query, the new lines are not escaped in the onclick attribute of the link, which creates an "unterminated string constant" error when clicked. See example link below...

[NOTE - I also attached the HTML for the link as a TXT file in case the UI messes up the HTML pasted below]

------

<td class="wrappedTD hotSpot" width="30%">

<a href="javascript:;" onClick="window.open('showSql.jsp?name=select [removed list of fields and changed most table names - DID NOT alter formatting],

            \(
                SELECT SUM\(rt.pv\) 
                  FROM foo r
                  LEFT JOIN bar rt
                    ON r.rtid = rt.rtid 
                 WHERE r.uid = user1\_.ID
                   AND month\(r.de\) = month\(GetDate\(\)\)
                   AND year\(r.de\) = year\(GetDate\(\)\)
            \)

         as formula6\_0\_,

            \(
                SELECT SUM\(rt.pv\) 
                  FROM foo r
                  LEFT JOIN bar rt
                    ON r.rtid = rt.rtid 
                 WHERE r.uid = user1\_.ID
                   AND year\(r.de\) = year\(GetDate\(\)\)
            \)

         as formula7\_0\_,

            \(
                SELECT SUM\(rt.pv\) 
                  FROM foo r
                  LEFT JOIN bar rt
                    ON r.rtid = rt.rtid 
                 WHERE r.uid = user1\_.ID
            \)

         as formula8\_0\_,

            \(
                SELECT COUNT\(\*\)
                  FROM fub p
                 WHERE p.uid = user1\_.ID
                   AND p.en = 1
                   AND p.pcid = 100
            \)

         as formula9\_0\_,

                \(
                    SELECT COUNT\(\*\)
                      FROM fub p
                     WHERE p.uid = user1\_.ID
                       AND p.en = 1
                       AND p.pcid = 200
                \) + \(
                    SELECT COUNT\(\*\)
                      FROM Comments c
                     WHERE c.uid = user1\_.ID
                \)

         as formula10\_0\_, entityinfo2\_.eid as entityIn1\_8\_1\_ from fub mchildren0\_ left outer join fuu user1\_ on mchildren0\_.uid=user1\_.id left outer join ei entityinfo2\_ on mchildren0\_.eiID=entityinfo2\_.eiID where mchildren0\_.parentPostID in \(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?\)','SqlQuery','height=200,width=400,location=no,resizable=yes,scrollbars=yes,toolbars=no'\)"&gt; 
                        select mchildren0\_.parent...
                    &lt;/a&gt;

</td>

Discussion

  • example of html with bad link

     
    Attachments