|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jcs.xml.resultset.RX
A class whose static method sql2Xml
converts the SQL
result set yielded by a given SQL query into an XML
<ResultSet>
document.
Method Summary | |
static java.lang.String |
sql2Xml(java.lang.String query,
java.lang.String cdataColumns,
java.lang.String columnNameOption,
java.lang.String server)
Returns an XML representation of the SQL result set returned by the argument query. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Method Detail |
public static java.lang.String sql2Xml(java.lang.String query, java.lang.String cdataColumns, java.lang.String columnNameOption, java.lang.String server) throws java.lang.ClassNotFoundException, java.sql.SQLException, java.lang.Exception
This method is the body of the ResultSetXml
constructor. It is placed in a separate class to make it easier
to examine and maintain. It can also be useful as a standalone
routine.
Example Java code:
String rsx = RX.sql2Xml("select d.name, e.name, d.dno " +"from emps e, dept d " + " where e.dno = d.dno order by d.name, e.name", "000", "yes", "antibes:4000?user=sa");
This call evaluates the given query and returns a String containing an XML representation of the result set.
Comparison of this method RX.sql2Xml
and the constructor
for ResultSetXml
.
RX.sql2Xml(...)
returns the XML result set as
a String. Use this method when you simply want the result set document.
ResultSetXml(...)
invokes
RX.sql2Xml
, and returns a ResultSetXml
object containing the result set string.
Use this when you want to store the result set document as a typed object,
and then use the other methods of ResultSetXml
to access and
update the components of the result set.
The cdataColumns
parameter is a string whose i-th character
is 0
or 1
indicating whether (or not)
the i-th column should be a CDATA
section. For example,
the following value of the cdataColumns
parameter would
indicate that columns 2, 5, and 7 should be CDATA
sections,
and columns 1, 3, 4, 6, 8, and 9 are normal text:
"010010100"
The columnNameOption
parameter indicates whether the
output XML document should include column name attributes in the
individual column tags. The column names are not needed or used by the
XS.resultSet2Script
method. The column names increase
the size of the output XML document, but improve its readability and
may be useful for some applications.
query
- a string that is the SQL query whose result set is to be
returned as an XML documentcdataColumns
- a string indicating which columns of the result set
should be specified as CDATA
sections
in the output XML document. See above.columnNameOption
- a string indicating whether (yes
)
or not (no
) the
<Column>
tags in the output XML
document should have column name attributes.
See above.server
- a string that identifies the SQL server in which to execute
the query. See the connectTo method
for a description of this parameter.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |