Download Stylus Studio - The World's Best XML Development Environment!


com.ddtek.jxtr
Class JXTRSingleTableUpdate

java.lang.Object
  |
  +--com.ddtek.jxtr.JXTRBase
        |
        +--com.ddtek.jxtr.JXTRUpdateBase
              |
              +--com.ddtek.jxtr.JXTRSingleTableUpdate

public class JXTRSingleTableUpdate
extends JXTRUpdateBase

JXTRSingleTableUpdate implements the methods required to execute any row count generating statement (Insert, Update, Delete, and so on) supported by the database and return the count of rows in the database that were updated (update count).


Field Summary
 
Fields inherited from class com.ddtek.jxtr.JXTRBase
BINARY_AS_BASE64, BINARY_AS_HEX, TIMESTAMP_AS_ISO8601, TIMESTAMP_AS_ODBC
 
Constructor Summary
JXTRSingleTableUpdate(java.sql.Connection con, java.lang.String sql)
          Creates a new JXTRSingleTableUpdate statement.
 
Method Summary
 void close()
          Closes database prepared statement(s).
 int[] executeUpdate()
          Executes the jXTransformer write statement.
 void setXMLDocument(org.w3c.dom.Document doc)
          Sets the XML input document to the specified DOM document object.
 void setXMLDocument(org.xml.sax.InputSource input)
          Sets the XML input document to the specified SAX input source.
 void setXMLDocument(org.w3c.dom.Node node)
          Sets the XML input document to the specified DOM element node.
 void setXMLDocument(java.io.Reader reader, boolean ignoreWhitespace)
          Sets the XML input document to the specified Reader object.
 void setXMLDocument(java.lang.String url, boolean ignoreWhitespace)
          Sets the XML input document to the specified URL.
 void setXMLNamespaces(java.util.Map namespaceMap)
          Sets the namespaces that are used in the XPath expressions.
 void setXMLRowPattern(java.lang.String exprString)
          Sets the XML row pattern.
 void setXMLXPath(int paramIx, java.lang.String exprString)
          Sets the parameter with the specified index to the value returned from the XPath expression.
 void setXMLXPath(int paramIx, java.lang.String exprString, int targetSqlType)
          Sets the parameter with the specified index to the value returned from the XPath expression.
 void setXMLXPath(int paramIx, java.lang.String exprString, int targetSqlType, int scale)
          Sets the parameter with the specified index to the value returned from the XPath expression.
 void setXMLXPath(int paramIx, java.lang.String exprString, int targetSqlType, int scale, int mixedContentIx)
          Sets the parameter with the specified index to the value returned from the XPath expression.
 
Methods inherited from class com.ddtek.jxtr.JXTRUpdateBase
getBatchSize, getBinaryEncoding, getNullRepresentationValue, getTimestampEncoding, getUseNullReplacementWithNullRepresentation, setBatchSize, setBigDecimal, setBinaryEncoding, setBoolean, setByte, setBytes, setDate, setDouble, setFloat, setInt, setLong, setNull, setNullReplacementValue, setNullRepresentationValue, setObject, setObject, setObject, setShort, setString, setTime, setTimestamp, setTimestampEncoding, setUseNullReplacementWithNullRepresentation
 
Methods inherited from class com.ddtek.jxtr.JXTRBase
clearWarnings, getPreparedStatementCloseBehaviour, getWarnings, setPreparedStatementCloseBehaviour, unlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JXTRSingleTableUpdate

public JXTRSingleTableUpdate(java.sql.Connection con,
                             java.lang.String sql)
                      throws JXTRException
Creates a new JXTRSingleTableUpdate statement.

Parameters:
con - The JDBC connection.
sql - The row count generating statement supported by the database.
Throws:
java.lang.IllegalArgumentException - if con or sql are null.
JXTRException - Refer to the JXTRException class for more information about possible error conditions.
Method Detail

close

public void close()
           throws JXTRException
Description copied from class: JXTRBase
Closes database prepared statement(s).

Specified by:
close in class JXTRBase
Throws:
JXTRException - if an error occured during closing of resources or database statement(s).

setXMLDocument

public void setXMLDocument(org.w3c.dom.Document doc)
Sets the XML input document to the specified DOM document object.

Parameters:
doc - The DOM document node that contains the XML input.
Throws:
java.lang.IllegalArgumentException - if node is null.

setXMLDocument

public void setXMLDocument(org.w3c.dom.Node node)
Sets the XML input document to the specified DOM element node.

Parameters:
node - The DOM node that contains the XML input.
Throws:
java.lang.IllegalArgumentException - if node is null.

setXMLDocument

public void setXMLDocument(org.xml.sax.InputSource input)
Sets the XML input document to the specified SAX input source.

Parameters:
input - The SAX input source that contains the XML input.
Throws:
java.lang.IllegalArgumentException - if input is null.

setXMLDocument

public void setXMLDocument(java.lang.String url,
                           boolean ignoreWhitespace)
Sets the XML input document to the specified URL.

Parameters:
url - The URL that refers to the XML input.
ignoreWhitespace - If true, whitespace nodes will be stripped.
Throws:
java.lang.IllegalArgumentException - if url is null.

setXMLDocument

public void setXMLDocument(java.io.Reader reader,
                           boolean ignoreWhitespace)
Sets the XML input document to the specified Reader object.

Parameters:
reader - Reader object that contains the XML input.
ignoreWhitespace - If true, whitespace nodes will be stripped.
Throws:
java.lang.IllegalArgumentException - if reader is null.

setXMLRowPattern

public void setXMLRowPattern(java.lang.String exprString)
Sets the XML row pattern.

Parameters:
exprString - The XPath expression that will be used to extract the node set from the XML input document.
Throws:
java.lang.IllegalArgumentException - if exprString is null.

setXMLXPath

public void setXMLXPath(int paramIx,
                        java.lang.String exprString)
Sets the parameter with the specified index to the value returned from the XPath expression.

Parameters:
paramIx - Query parameter index (1 based).
exprString - The XPath expression that will be used to extract the node set from the XML input document.
Throws:
java.lang.IllegalArgumentException - if exprString is null.

setXMLXPath

public void setXMLXPath(int paramIx,
                        java.lang.String exprString,
                        int targetSqlType)
Sets the parameter with the specified index to the value returned from the XPath expression.

Parameters:
paramIx - Query parameter index (1 based).
exprString - The XPath expression that will be used to extract the node set from the XML input document.
targetSqlType - The SQL type (as defined in java.sql.Types) to be sent to the database.
Throws:
java.lang.IllegalArgumentException - if exprString is null.

setXMLXPath

public void setXMLXPath(int paramIx,
                        java.lang.String exprString,
                        int targetSqlType,
                        int scale)
Sets the parameter with the specified index to the value returned from the XPath expression.

Parameters:
paramIx - Query parameter index (1 based).
exprString - The XPath expression that will be used to extract the node set from the XML input document.
targetSqlType - The SQL type (as defined in java.sql.Types) to be sent to the database.
scale - The scale for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types. This is the number of digits after the decimal point. For all other data types, this value will be ignored.
Throws:
java.lang.IllegalArgumentException - if exprString is null.

setXMLXPath

public void setXMLXPath(int paramIx,
                        java.lang.String exprString,
                        int targetSqlType,
                        int scale,
                        int mixedContentIx)
Sets the parameter with the specified index to the value returned from the XPath expression.

Parameters:
paramIx - Query parameter index (1 based).
exprString - The XPath expression that will be used to extract the node set from the XML input document.
targetSqlType - The SQL type (as defined in java.sql.Types) to be sent to the database.
scale - The scale for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types. This is the number of digits after the decimal point. For all other data types, this value will be ignored.
mixedContentIx - When the XPath expression returns a node set of content nodes for a mixed content element, this 1 based index indicates the content node to use as the value. If 0 is specified, all content nodes are used and concatenated.
Throws:
java.lang.IllegalArgumentException - if exprString is null or mixedContentIx < 0.

setXMLNamespaces

public void setXMLNamespaces(java.util.Map namespaceMap)
Sets the namespaces that are used in the XPath expressions.

Parameters:
namespaceMap - HashMap that maps the namespace prefixes used in the XPath expressions as key and value pairs for each namespace URI. Use null as a key to specify the default namespace URI.

executeUpdate

public int[] executeUpdate()
                    throws JXTRException,
                           JXTRSingleTableUpdateException
Executes the jXTransformer write statement.

Returns:
An array of update counts. The returned values correspond to the row counts that result from executing the statement with each set of parameters extracted with the XPath expressions from the row pattern nodes. The returned int elements in the array equal the int elements returned by java.sql.Statement#executeBatch().
Throws:
JXTRException - Refer to the JXTRException class for more information about possible error conditions.
JXTRSingleTableUpdateException - Refer to the JXTRSingleTableUpdateException class for more information about possible error conditions and retrieving update counts.
See Also:
java.sql.Statement#executeBatch().


Stylus Studio features SQL/XML tools for building XML views of relational data.