|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jcs.xml.JXml | +--jcs.xml.resultset.ResultSetXml
A class to contain an XML document that represents an SQL result set.
Field Summary | |
static java.lang.String |
DTD
The static final text of the DTD for SQL ResultSet documents. |
static java.lang.String |
DTD_NAME
The static final name of the ResultSet DTD. |
Fields inherited from class jcs.xml.JXml |
xmlText |
Constructor Summary | |
ResultSetXml(java.lang.String xmlText)
Constructs a ResultSetXml instance from
an existing XML document. |
|
ResultSetXml(java.lang.String query,
java.lang.String cdataColumns,
java.lang.String columnNameOption,
java.lang.String server)
Constructs a ResultSetXml instance from the
SQL result set returned by the argument query. |
Method Summary | |
java.lang.Boolean |
allString(int columnNumber,
java.lang.String compOp,
java.lang.String comparand)
Returns the universal quantification of a given comparison to a given column of the ResultSetVector . |
java.lang.String |
getColumn(int rowNumber,
int columnNumber)
Returns the String value of row 'rowNumber' column 'columnNumber'. |
java.lang.String |
getColumn(int rowNumber,
java.lang.String columnName)
Return the String value of row 'rowNumber' column 'columnName'. |
java.lang.String |
resolveExternal(java.lang.String publicId,
java.lang.String systemId)
Returns the ResultSet DTD. |
void |
setColumn(int rowNumber,
int columnNumber,
java.lang.String newValue)
Update the value of row number i column number j and return the updated ResultSetXml document. |
void |
setColumn(int rowNumber,
java.lang.String columnName,
java.lang.String newValue)
Updates the value of row number i column columnName, and returns the updated ResultSetXml document. |
java.lang.Boolean |
someString(int columnNumber,
java.lang.String compOp,
java.lang.String comparand)
Returns the existential quantification of a given comparison to a given column of the ResultSetXml . |
ResultSetVector |
toResultSetVector()
Constructs a ResultSetVector from a ResultSetXml document. |
java.lang.String |
toSqlScript(java.lang.String resultTableName,
java.lang.String columnPrefix,
java.lang.String goOption)
Generates an SQL script from the ResultSetXml document. |
Methods inherited from class jcs.xml.JXml |
parse,
parse,
toString |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static final java.lang.String DTD_NAME
<!DOCTYPE ResultSet SYSTEM "ResultSet.dtd">
public static final java.lang.String DTD
Constructor Detail |
public ResultSetXml(java.lang.String xmlText) throws java.lang.Exception
ResultSetXml
instance from
an existing XML document.doc
- a string that is an XML document. The document must
be a valid SQL result set, using the JavaSqlResultSet DTD.public ResultSetXml(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
ResultSetXml
instance from the
SQL result set returned by the argument query.
Example Java code:
ResultSetXml rsx = new ResultSetXml("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");
query
- a string that is the SQL query whose result set is to be
returned as an XML document. The query must have no
question mark parameters, and must return a single result set.cdataColumns
- 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 server in which to execute
the query. See the connectTo
method for a description of this parameter.Method Detail |
public java.lang.String resolveExternal(java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException
parse
method of the superclass JXml, to obtain the DTD for a given ID.
The publicId
and systemId
parameters
are the PUBLIC and SYSTEM values from an external entity declaration
in the document being parsed.
If the SYSTEM value is "ResultSet.dtd", then this method returns the
ResultSet DTD. Otherwise, it raises an exception, which indicates
that a document other than a Result Set XML document is being parsed
as a ResultSet XML document.publicId
- a String with the PUBLIC value from an external entity
declaration.systemId
- a String with the SYSTEM value from an external entity
declaration.systemId
is not "ResultSet.dtd".public java.lang.String toSqlScript(java.lang.String resultTableName, java.lang.String columnPrefix, java.lang.String goOption) throws java.lang.Exception
ResultSetXml
document.
The SQL script will contain an SQL create
statement and
a sequence of SQL insert
statements that
create and populate a table with the data of the result set.
The goOption
parameter indicates whether you want
the output script to include go
commands after
the create
and insert
statements.
This depends on how you plan to execute the script: ISQL requires
the go
commands, and JDBC doesn't allow them.
resultTableName
- a string that is the SQL table name to
specify in the output create
and
insert
statementscolumnPrefix
- a string to use as a prefix when generating
column names in the output script. Such generated
names are needed when the result set has columns
with no names or with duplicate names.goOption
- a string indicating whether the output script should
include go
commands. This is indicated by
yes
or no
. See above.public java.lang.String getColumn(int rowNumber, int columnNumber) throws java.lang.Exception
rowNumber
- an int that is the number of a row of the result setcolumnNumber
- an int that is the number of a column of the result setpublic java.lang.String getColumn(int rowNumber, java.lang.String columnName) throws java.lang.Exception
rowNumber
- an int that is the number of a row of the result setcolumnName
- a string that is the name of a column of the result setpublic void setColumn(int rowNumber, java.lang.String columnName, java.lang.String newValue) throws java.lang.Exception
rowNumber
- an int that is the number of a row of the result setcolumnName
- a string that is the name of a column of the result setnewValue
- a string that is the new value of the given columnpublic void setColumn(int rowNumber, int columnNumber, java.lang.String newValue) throws java.lang.Exception
rowNumber
- an int that is the number of a row of the result setcolumnNumber
- a string that is the number of a column of the result setnewValue
- a string that is the new value of the given columnpublic ResultSetVector toResultSetVector() throws java.lang.Exception
xml
- a string containing an XML document that is an SQL
result set. It must conform to the JavaSqlResultSet DTD.public java.lang.Boolean allString(int columnNumber, java.lang.String compOp, java.lang.String comparand) throws java.lang.Exception
ResultSetVector
.
Example Java code:
rsv.allString(i, "<=", "xxx")returns true iff for all elements ci of column i of rsv,
ci <= "xxx"The
allString
method performs only String comparisons.columnNumber
- the number of a column of the result setcompOp
- a string that is one of "=,==,<,>,<>,!=, >=,<=".comparand
- a string that will be the second operand of the compares.public java.lang.Boolean someString(int columnNumber, java.lang.String compOp, java.lang.String comparand) throws java.lang.Exception
ResultSetXml
.
Example Java code:
rsx.someString(i, "<=", "xxx")returns true iff for some element ci of column i of rsx,
ci <= "xxx"The
someString
method performs only String comparisons.columnNumber
- the number of a column of the result setcompOp
- a string that is one of "=,==,<,>,<>,!=, >=,<=".comparand
- a string that will be the second operand of the compares.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |