ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 28681] - [PATCH] Xml output for the SQL task
Date Tue, 04 May 2004 15:25:29 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28681>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28681

[PATCH] Xml output for the SQL task





------- Additional Comments From nicolaken@apache.org  2004-05-04 15:25 -------
Added a nesting option, where the tags are nested to the level specified.

Example:

  <sql...
    showheaders="false"
    outputFormat="xml"
    >
      ${data.sql}
    </sql>

gives

<sqlresults>
    <row><cell header="A">one</cell><cell header="B">1</cell></row>
    <row><cell header="A">one</cell><cell header="B">11</cell></row>
    <row><cell header="A">two</cell><cell header="B">2</cell></row>
</sqlresults>


while

  <sql...
    showheaders="false"
    outputFormat="xml"
    nestLevel="1"
    >
      ${data.sql}
    </sql>

gives

<sqlresults>
  <nest group-by="A" value="one">
    <row><cell header="B">1</cell></row>
    <row><cell header="B">11</cell></row>
  </nest>
  <nest group-by="A" value="two">
    <row><cell header="B">2</cell></row>
  </nest>
</sqlresults>

To keep memory low and good speed it deals with the values as they arrive.

So if this is nested;

<sqlresults>
    <row><cell header="A">one</cell><cell header="B">1</cell></row>
    <row><cell header="A">two</cell><cell header="B">2</cell></row>
    <row><cell header="A">one</cell><cell header="B">11</cell></row>
</sqlresults>

it gives this:

<sqlresults>
  <nest group-by="A" value="one">
    <row><cell header="B">1</cell></row>
  </nest>
  <nest group-by="A" value="two">
    <row><cell header="B">2</cell></row>
  </nest>
  <nest group-by="A" value="one">
    <row><cell header="B">11</cell></row>
  </nest>
</sqlresults>

Just remember to make the query so that nesting values come first, and include
them in an "ORDER BY" clause in the same order.

IE:

for a nestingLevel=1

SELECT A,B,C
FROM T
ORDER BY A

for a nestingLevel=2

SELECT A,B,C
FROM T
ORDER BY A,B

etc...

NOTE: the patch supercedes and includes the previous ones

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message