BEA Systems, Inc.

WebLogic Server 6.1 API Reference

weblogic.apache.xalan.lib.sql
Class XStatement

java.lang.Object
  |
  +--weblogic.apache.xml.utils.UnImplNode
        |
        +--weblogic.apache.xalan.lib.sql.StreamableNode
              |
              +--weblogic.apache.xalan.lib.sql.XStatement

public class XStatement
extends StreamableNode
implements org.w3c.dom.traversal.NodeIterator, ContextNodeList, java.lang.Cloneable

Represents a JDBC query statement. Also acts as both a NodeIterator and the Document node for the row-set representation of the query result set.

This class is based on an implementation from the Apache XML Project. In future releases the XML parser, XSLT processor, and associated classes will likely be updated to be based on a later version of the Apache implementations. Since Apache does not guarantee backwards compatibility between versions of their software, we cannot guarantee backwards compatibility of any of the classes contained in the weblogic.apache package or sub-packages.


Constructor Summary
XStatement(XConnection connection, java.lang.String queryString)
          The XConnection query() method uses this constructor to execute a SQL query statement.
XStatement(XConnection connection, java.lang.String queryString, java.util.Vector pList)
           
 
Method Summary
 java.lang.Object clone()
          Clone this object
 org.w3c.dom.traversal.NodeIterator cloneWithReset()
          Overide cloneWithReset method
 void detach()
          Detaches the iterator from the set which it iterated over, releasing any computational resources and placing the iterator in the INVALID state.
 org.w3c.dom.Node getCurrentNode()
          The current node is the RowSet
 int getCurrentPos()
          Get Current Position
 boolean getExpandEntityReferences()
          The value of this flag determines whether the children of entity reference nodes are visible to the iterator.
 org.w3c.dom.traversal.NodeFilter getFilter()
          The filter used to screen nodes.
 org.w3c.dom.Node getFirstChild()
          Return the row-set node.
 int getLast()
          Get index of the last found node
 org.w3c.dom.Node getNextSibling()
          getNextSibling - This always returns null.
 java.lang.String getNodeName()
          Return node name: "#Document".
 short getNodeType()
          Return node type: Node.DOCUMENT_NODE.
 org.w3c.dom.Document getOwnerDocument()
          The parent of a document is null.
 org.w3c.dom.Node getParentNode()
          The parent node of document is always null.
 java.sql.ResultSet getResultSet()
          Get the ResultSet from executing the query string
 org.w3c.dom.Node getRoot()
          The XStatement object is the NodeIterator root.
 java.sql.Statement getStatement()
          Get the JDBC Query statement
 int getWhatToShow()
          This attribute determines which node types are presented via the iterator.
 XStatement getXStatement()
          Get the representation of the JDBC Query statement
 boolean hasChildNodes()
          Tell if there are any children of the document, which is always true.
 boolean isFresh()
          Return whether this iterator is fresh
 org.w3c.dom.Node nextNode()
          Return the #Document node (one role the XStatement plays) the first time called; return null thereafter.
 org.w3c.dom.Node previousNode()
          Throw an exception, since streaming nodes and iterators can not go backwards.
 void reset()
          Reset this object
 void runTo(int index)
          Not implemented
 void setCurrentPos(int i)
          Not implemented
 void setLast(int last)
          Set the index of the last found node
 void setParameter(int pos, java.sql.PreparedStatement stmt, QueryParameter p)
          Set the parameter for a Prepared Statement
 void setShouldCacheNodes(boolean b)
          Set whether nodes should be cached - not implemented
 int size()
          Return size
 java.lang.String toString()
          Return the String value of this object
 
Methods inherited from class weblogic.apache.xalan.lib.sql.StreamableNode
getAttributes, getLength, getLocalName, getNamedItem, getNamedItemNS, getNamespaceURI, getNodeTest, getPrefix, getUid, isSupported, item, removeNamedItem, removeNamedItemNS, setNamedItem, setNamedItemNS, setNodeTest
 
Methods inherited from class weblogic.apache.xml.utils.UnImplNode
appendChild, appendData, cloneNode, createAttribute, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createElement, createElementNS, createEntityReference, createProcessingInstruction, createTextNode, deleteData, error, error, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getChildNodes, getDoctype, getDocumentElement, getElementById, getElementsByTagName, getElementsByTagNameNS, getImplementation, getLastChild, getNodeValue, getOwnerElement, getPreviousSibling, getSpecified, getTagName, hasAttribute, hasAttributeNS, hasAttributes, importNode, insertBefore, insertData, normalize, removeAttribute, removeAttributeNode, removeAttributeNS, removeChild, replaceChild, replaceData, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setData, setNodeValue, setPrefix, setValue, splitText, substringData
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XStatement

public XStatement(XConnection connection,
                  java.lang.String queryString)
           throws java.sql.SQLException
The XConnection query() method uses this constructor to execute a SQL query statement. When instantiated, XStatement executes the query and creates a RowSet, a row-set element associated with the query result set.

Parameters:
connection - the XConnection object that calls this constructor.
queryString - the SQL query.
Throws:
java.sql.SQLException -  

XStatement

public XStatement(XConnection connection,
                  java.lang.String queryString,
                  java.util.Vector pList)
           throws java.sql.SQLException
Method Detail

getStatement

public java.sql.Statement getStatement()
Get the JDBC Query statement

Returns:
the JDBC Query statement

getResultSet

public java.sql.ResultSet getResultSet()
Get the ResultSet from executing the query string

Returns:
ResultSet instance

setParameter

public void setParameter(int pos,
                         java.sql.PreparedStatement stmt,
                         QueryParameter p)
                  throws java.sql.SQLException
Set the parameter for a Prepared Statement


getXStatement

public XStatement getXStatement()
Get the representation of the JDBC Query statement

Returns:
the representation of the JDBC Query statement, this
Overrides:
getXStatement in class StreamableNode

getRoot

public org.w3c.dom.Node getRoot()
The XStatement object is the NodeIterator root.
Specified by:
getRoot in interface org.w3c.dom.traversal.NodeIterator

Returns:
itself.

getWhatToShow

public int getWhatToShow()
This attribute determines which node types are presented via the iterator. The available set of constants is defined in the NodeFilter interface.
Specified by:
getWhatToShow in interface org.w3c.dom.traversal.NodeIterator

Returns:
which node types are to be presented

getFilter

public org.w3c.dom.traversal.NodeFilter getFilter()
The filter used to screen nodes.
Specified by:
getFilter in interface org.w3c.dom.traversal.NodeIterator

Returns:
null.

getExpandEntityReferences

public boolean getExpandEntityReferences()
The value of this flag determines whether the children of entity reference nodes are visible to the iterator. If false, they will be skipped over.
To produce a view of the document that has entity references expanded and does not expose the entity reference node itself, use the whatToShow flags to hide the entity reference node and set expandEntityReferences to true when creating the iterator. To produce a view of the document that has entity reference nodes but no entity expansion, use the whatToShow flags to show the entity reference node and set expandEntityReferences to false.
Specified by:
getExpandEntityReferences in interface org.w3c.dom.traversal.NodeIterator

Returns:
true.

nextNode

public org.w3c.dom.Node nextNode()
                          throws org.w3c.dom.DOMException
Return the #Document node (one role the XStatement plays) the first time called; return null thereafter.
Specified by:
nextNode in interface org.w3c.dom.traversal.NodeIterator

Returns:
this or null.
Throws:
org.w3c.dom.DOMException -  

previousNode

public org.w3c.dom.Node previousNode()
                              throws org.w3c.dom.DOMException
Throw an exception, since streaming nodes and iterators can not go backwards.
Specified by:
previousNode in interface org.w3c.dom.traversal.NodeIterator

Returns:
null
Throws:
org.w3c.dom.DOMException -  

detach

public void detach()
Detaches the iterator from the set which it iterated over, releasing any computational resources and placing the iterator in the INVALID state. Afterdetach has been invoked, calls to nextNode orpreviousNode will raise the exception INVALID_STATE_ERR.
Specified by:
detach in interface org.w3c.dom.traversal.NodeIterator


toString

public java.lang.String toString()
Return the String value of this object

Returns:
String value of the JDBC query string
Overrides:
toString in class java.lang.Object

getOwnerDocument

public org.w3c.dom.Document getOwnerDocument()
The parent of a document is null.

Returns:
null
Overrides:
getOwnerDocument in class StreamableNode

getNodeType

public short getNodeType()
Return node type: Node.DOCUMENT_NODE.

Returns:
Node.DOCUMENT_NODE.
Overrides:
getNodeType in class StreamableNode

getNodeName

public java.lang.String getNodeName()
Return node name: "#Document".

Returns:
"#Document".
Overrides:
getNodeName in class UnImplNode

getFirstChild

public org.w3c.dom.Node getFirstChild()
Return the row-set node.

Returns:
the row-set node or null if not found.
Overrides:
getFirstChild in class UnImplNode

getNextSibling

public org.w3c.dom.Node getNextSibling()
getNextSibling - This always returns null.

Returns:
null
Overrides:
getNextSibling in class UnImplNode

getParentNode

public org.w3c.dom.Node getParentNode()
The parent node of document is always null.

Returns:
null
Overrides:
getParentNode in class UnImplNode

hasChildNodes

public boolean hasChildNodes()
Tell if there are any children of the document, which is always true.

Returns:
true
Overrides:
hasChildNodes in class UnImplNode

getCurrentNode

public org.w3c.dom.Node getCurrentNode()
The current node is the RowSet
Specified by:
getCurrentNode in interface ContextNodeList

Returns:
The row-set

getCurrentPos

public int getCurrentPos()
Get Current Position
Specified by:
getCurrentPos in interface ContextNodeList

Returns:
0

reset

public void reset()
Reset this object
Specified by:
reset in interface ContextNodeList


setShouldCacheNodes

public void setShouldCacheNodes(boolean b)
Set whether nodes should be cached - not implemented
Specified by:
setShouldCacheNodes in interface ContextNodeList

Parameters:
b - Flag indicating whether nodes should be cached

runTo

public void runTo(int index)
Not implemented
Specified by:
runTo in interface ContextNodeList

Parameters:
index -  

setCurrentPos

public void setCurrentPos(int i)
Not implemented
Specified by:
setCurrentPos in interface ContextNodeList

Parameters:
i -  

size

public int size()
Return size
Specified by:
size in interface ContextNodeList

Returns:
1

isFresh

public boolean isFresh()
Return whether this iterator is fresh
Specified by:
isFresh in interface ContextNodeList

Returns:
True if this has not been called

cloneWithReset

public org.w3c.dom.traversal.NodeIterator cloneWithReset()
                                                  throws java.lang.CloneNotSupportedException
Overide cloneWithReset method
Specified by:
cloneWithReset in interface ContextNodeList

Returns:
A clone of this which has been reset
Throws:
java.lang.CloneNotSupportedException -  

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Clone this object
Specified by:
clone in interface ContextNodeList

Returns:
A clone of this object
Throws:
java.lang.CloneNotSupportedException -  
Overrides:
clone in class java.lang.Object

getLast

public int getLast()
Get index of the last found node
Specified by:
getLast in interface ContextNodeList

Returns:
index of last found node

setLast

public void setLast(int last)
Set the index of the last found node
Specified by:
setLast in interface ContextNodeList


Documentation is available at
http://download.oracle.com/docs/cd/E13222_01/wls/docs61

WebLogic classes and methods that do not appear in this reference are not public and are not supported.