org.apache.xalan.lib.sql
Class XStatement

java.lang.Object
  |
  +--org.apache.xml.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()
          Clone this object
 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.
 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.
 NodeFilter getFilter()
          The filter used to screen nodes.
 Node getFirstChild()
          Return the row-set node.
 int getLast()
          Get index of the last found node
 Node getNextSibling()
          getNextSibling - This always returns null.
 java.lang.String getNodeName()
          Return node name: "#Document".
 short getNodeType()
          Return node type: 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()
          Get the ResultSet from executing the query string
 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
 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()
          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 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 org.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 org.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, 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 -  
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

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 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
Returns:
which node types are to be presented

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.
Throws:
DOMException -  

previousNode

public Node previousNode()
                  throws DOMException
Throw an exception, since streaming nodes and iterators can not go backwards.
Specified by:
previousNode in interface NodeIterator
Returns:
null
Throws:
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 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 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 Node getFirstChild()
Return the row-set node.
Returns:
the row-set node or null if not found.
Overrides:
getFirstChild in class UnImplNode

getNextSibling

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

getParentNode

public 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 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 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 -  

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


Copyright � 2000 Apache XML Project. All Rights Reserved.