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 [EMAIL PROTECTED]  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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to