jcs.xml.resultset
Class XR
java.lang.Object
|
+--jcs.xml.resultset.XR
- public class XR
- extends java.lang.Object
- implements java.io.Serializable
A class whose static method converts an XML document that
contains an SQL result set into an SQL script that has a
create statement and a series of insert
statements that re-create the SQL result set in an SQL table.
This static method is the body of the toSqlScript
method of the ResultSetXml class.
- See Also:
- Serialized Form
|
Method Summary |
protected static boolean |
isQuotedType(java.lang.String t)
Tests for a datatype that requires quotes around the value. |
protected static java.lang.String |
lookUpTypeCode(java.lang.String tc)
Returns the datatype keyword for a datatype code. |
static java.lang.String |
toSqlScript(org.w3c.dom.Document doc,
java.lang.String resultTableName,
java.lang.String columnPrefix,
java.lang.String goOption)
Returns an SQL script with a create statement
and a list of insert statements that re-create
the SQL data contained in the XML document. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
toSqlScript
public static java.lang.String toSqlScript(org.w3c.dom.Document doc,
java.lang.String resultTableName,
java.lang.String columnPrefix,
java.lang.String goOption)
throws java.lang.Exception
- Returns an SQL script with a
create statement
and a list of insert statements that re-create
the SQL data contained in the XML document.
This static method is the body of the toSqlScript
method of the ResultSetXml class.
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.
- Parameters:
xml - a string that is the input XML document. This is
the actual document, not a name or reference.
The document must be a valid representation of an
SQL result set, using the JavaSqlResultSet DTD.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.- Throws:
- java.lang.Exception - Thrown for unrecognized nodes.
isQuotedType
protected static boolean isQuotedType(java.lang.String t)
- Tests for a datatype that requires quotes around the value.
LONGVARCHAR is a JDBC type not supported by Sybase.
TEXT is a Sybase type equivalent to LONGVARCHAR
- Parameters:
t - a string that is an SQL datatype- Returns:
- a boolean indication whether the type quotes
lookUpTypeCode
protected static java.lang.String lookUpTypeCode(java.lang.String tc)
- Returns the datatype keyword for a datatype code.
- Parameters:
t - a string that is a JDBC datatype code- Returns:
- string that is the corresponding SQL datatype name