org.apache.xalan.lib.sql
Class XStatement

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

public class XStatement
extends StreamableNode
implements 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.


Constructor Summary
XStatement(XConnection connection, java.lang.String queryString)
          The XConnection query() method uses this constructor to execute a SQL query statement.
 
Method Summary
 java.lang.Object clone()
           
 NodeIterator cloneWithReset()
           
 void detach()
          Detaches the iterator from the set which it iterated over, releasing any computational resources and placing the iterator in the INVALID state.
 Node getCurrentNode()
           
 int getCurrentPos()
           
 boolean getExpandEntityReferences()
          The value of this flag determines whether the children of entity reference nodes are visible to the iterator.
 NodeFilter getFilter()
          The filter used to screen nodes.
 Node getFirstChild()
          Return the row-set node.
 Node getNextSibling()
          This always returns null.
 java.lang.String getNodeName()
          Return "#Document".
 short getNodeType()
          Return Node.DOCUMENT_NODE.
 Document getOwnerDocument()
          The parent of a document is null.
 Node getParentNode()
          The parent node of document is always null.
 java.sql.ResultSet getResultSet()
           
 Node getRoot()
          The XStatement object is the NodeIterator root.
 java.sql.Statement getStatement()
           
 int getWhatToShow()
          This attribute determines which node types are presented via the iterator.
 XStatement getXStatement()
           
 boolean hasChildNodes()
          Tell if there are any children of the document, which is always true.
 boolean isFresh()
           
 Node nextNode()
          Return the #Document node (one role the XStatement plays) the first time called; return null thereafter.
 Node previousNode()
          Throw an exception, since streaming nodes and iterators can not go backwards.
 void reset()
           
 void runTo(int index)
           
 void setCurrentPos(int i)
           
 void setShouldCacheNodes(boolean b)
           
 int size()
           
 java.lang.String toString()
           
 
Methods inherited from class org.apache.xalan.lib.sql.StreamableNode
getAttributes, getLength, getLocalName, getNamedItem, getNamedItemNS, getNamespaceURI, getNodeTest, getPrefix, getUid, item, removeNamedItem, removeNamedItemNS, setNamedItem, setNamedItemNS, setNodeTest, supports
 
Methods inherited from class org.apache.xalan.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, 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.
Method Detail

getStatement

public java.sql.Statement getStatement()

getResultSet

public java.sql.ResultSet getResultSet()

getXStatement

public XStatement getXStatement()
Overrides:
getXStatement in class StreamableNode

getRoot

public Node getRoot()
The XStatement object is the NodeIterator root.
Specified by:
getRoot in interface 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 NodeIterator

getFilter

public NodeFilter getFilter()
The filter used to screen nodes.
Specified by:
getFilter in interface 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 NodeIterator
Returns:
true.

nextNode

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

previousNode

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

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 NodeIterator

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getOwnerDocument

public Document getOwnerDocument()
The parent of a document is null.
Overrides:
getOwnerDocument in class StreamableNode

getNodeType

public short getNodeType()
Return Node.DOCUMENT_NODE.
Overrides:
getNodeType in class StreamableNode

getNodeName

public java.lang.String getNodeName()
Return "#Document".
Overrides:
getNodeName in class UnImplNode

getFirstChild

public Node getFirstChild()
Return the row-set node.
Overrides:
getFirstChild in class UnImplNode

getNextSibling

public Node getNextSibling()
This always returns null.
Overrides:
getNextSibling in class UnImplNode

getParentNode

public Node getParentNode()
The parent node of document is always null.
Overrides:
getParentNode in class UnImplNode

hasChildNodes

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

getCurrentNode

public Node getCurrentNode()
Specified by:
getCurrentNode in interface ContextNodeList

getCurrentPos

public int getCurrentPos()
Specified by:
getCurrentPos in interface ContextNodeList

reset

public void reset()
Specified by:
reset in interface ContextNodeList

setShouldCacheNodes

public void setShouldCacheNodes(boolean b)
Specified by:
setShouldCacheNodes in interface ContextNodeList

runTo

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

setCurrentPos

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

size

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

isFresh

public boolean isFresh()
Specified by:
isFresh in interface ContextNodeList

cloneWithReset

public NodeIterator cloneWithReset()
                            throws java.lang.CloneNotSupportedException
Specified by:
cloneWithReset in interface ContextNodeList

clone

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


Copyright © 2000 Apache XML Project. All Rights Reserved.