Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.basex.api.xqj
Class BXQPreparedExpression

    java.lang.Object
      org.basex.api.xqj.BXQPreparedExpression

All Implemented Interfaces:
  XQDynamicContext, XQPreparedExpression

    public final class BXQPreparedExpression

extends java.lang.Object
implements XQPreparedExpression

Java XQuery API - Prepared Expression.

Author:
  Workgroup DBIS, University of Konstanz 2005-08, ISC License, Andreas Weiler

Constructor Summary
`BXQPreparedExpression(java.lang.String input, BXQStaticContext s, BXQConnection c)` Constructor.

Method Summary
`void` | `bindAtomicValue(javax.xml.namespace.QName qn, java.lang.String v, XQItemType t)` Binds a value to the given external variable or the context item.
`void` | `bindBoolean(javax.xml.namespace.QName qn, boolean v, XQItemType it)` Binds a value to the given external variable or the context item.
`void` | `bindByte(javax.xml.namespace.QName qn, byte v, XQItemType t)` Binds a value to the given external variable or the context item.
`void` | `bindDocument(javax.xml.namespace.QName qn, java.io.InputStream is, java.lang.String base, XQItemType t)` Binds a value to the given external variable or the context item.
`void` | `bindDocument(javax.xml.namespace.QName qn, java.io.Reader r, java.lang.String base, XQItemType t)` Binds a value to the given external variable or the context item.
`void` | `bindDocument(javax.xml.namespace.QName qn, javax.xml.transform.Source s, XQItemType t)` Binds a value to the given external variable or the context item from the given `Source`.
`void` | `bindDocument(javax.xml.namespace.QName qn, java.lang.String v, java.lang.String base, XQItemType t)` Binds a value to the given external variable or the context item.
`void` | `bindDocument(javax.xml.namespace.QName qn, org.xml.sax.XMLReader r, XQItemType t)` Binds a value to the given external variable.
`void` | `bindDocument(javax.xml.namespace.QName qn, javax.xml.stream.XMLStreamReader sr, XQItemType t)` Binds a value to the given external variable or the context item.
`void` | `bindDouble(javax.xml.namespace.QName qn, double v, XQItemType t)` Binds a value to the given external variable or the context item.
`void` | `bindFloat(javax.xml.namespace.QName qn, float v, XQItemType t)` Binds a value to the given external variable or the context item.
`void` | `bindInt(javax.xml.namespace.QName qn, int v, XQItemType t)` Binds a value to the given external variable or the context item.
`void` | `bindItem(javax.xml.namespace.QName qn, XQItem t)` Binds a value to the given external variable.
`void` | `bindLong(javax.xml.namespace.QName qn, long v, XQItemType t)` Binds a value to the given external variable or the context item.
`void` | `bindNode(javax.xml.namespace.QName qn, org.w3c.dom.Node n, XQItemType t)` Binds a value to the given external variable or the context item.
`void` | `bindObject(javax.xml.namespace.QName qn, java.lang.Object v, XQItemType t)` Binds a value to the given external variable or the context item.
`void` | `bindSequence(javax.xml.namespace.QName qn, XQSequence s)` Binds a value to the given external variable or the context item.
`void` | `bindShort(javax.xml.namespace.QName qn, short v, XQItemType t)` Binds a value to the given external variable or the context item.
`void` | `bindString(javax.xml.namespace.QName qn, java.lang.String v, XQItemType t)` Binds a value to the given external variable or the context item.
`void` | `cancel()` Attempts to cancel the execution if both the XQuery engine and XQJ driver support aborting the execution of an `XQPreparedExpression`.
`void` | `close()` Closes the class.
`XQResultSequence` | `executeQuery()` Executes the prepared query expression.
`javax.xml.namespace.QName[]` | `getAllExternalVariables()` Retrieves all the external variables defined in the prolog of the prepared expression.
`javax.xml.namespace.QName[]` | `getAllUnboundExternalVariables()` Retrieves the names of all unbound external variables.
`java.util.TimeZone` | `getImplicitTimeZone()` Gets the implicit timezone
`XQStaticContext` | `getStaticContext()` Gets an `XQStaticContext` representing the values for all expression properties.
`XQSequenceType` | `getStaticResultType()` Gets the static type information of the result sequence.
`XQSequenceType` | `getStaticVariableType(javax.xml.namespace.QName qn)` Retrieves the static type of a given external variable.
`boolean` | `isClosed()` Returns the closed flag.
`void` | `setImplicitTimeZone(java.util.TimeZone tz)` Sets the implicit timezone

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface javax.xml.xquery.XQPreparedExpression
`close, isClosed`

Methods inherited from interface javax.xml.xquery.XQDynamicContext
`bindAtomicValue, bindBoolean, bindByte, bindDocument, bindDocument, bindDocument, bindDocument, bindDocument, bindDocument, bindDouble, bindFloat, bindInt, bindItem, bindLong, bindNode, bindObject, bindSequence, bindShort, bindString, getImplicitTimeZone, setImplicitTimeZone`

Constructor Detail

### BXQPreparedExpression

    public BXQPreparedExpression(java.lang.String input,
                                 BXQStaticContext s,
                                 BXQConnection c)
                          throws XQQueryException

  Constructor.

  Parameters:
    `input` - query instance
    `s` - static context
    `c` - closer
  Throws:
    `XQQueryException` - exception

Method Detail

### cancel

    public void cancel()
                throws XQException

  Description copied from interface: `XQPreparedExpression`
  Attempts to cancel the execution if both the XQuery engine and XQJ driver support aborting the execution of an `XQPreparedExpression`. This method can be used by one thread to cancel an `XQPreparedExpression`, that is being executed in another thread. If cancellation is not supported or the attempt to cancel the execution was not successful, the method returns without any error. If the cancellation is successful, an `XQException` is thrown, to indicate that it has been aborted, by `executeQuery`, `executeCommand` or any method accessing the `XQResultSequence` returned by `executeQuery`. If applicable, any open `XQResultSequence` and `XQResultItem` objects will also be implicitly closed in this case.

  Specified by:
    `cancel` in interface `XQPreparedExpression`
  Throws:
    `XQException` - if the prepared expression is in a closed state

### executeQuery

    public XQResultSequence executeQuery()
                                  throws XQException

  Description copied from interface: `XQPreparedExpression`
  Executes the prepared query expression. Calling this method implicitly closes any previous result sequence obtained from this expression.

  Specified by:
    `executeQuery` in interface `XQPreparedExpression`
  Returns:
    the xquery sequence object containing the result of the query execution
  Throws:
    `XQException` - if (1) there are errors when executing the prepared expression, (2) the prepared expression is in a closed state, or (3) the query execution is cancelled

### getAllExternalVariables

    public javax.xml.namespace.QName[] getAllExternalVariables()
                                                        throws XQException

  Description copied from interface: `XQPreparedExpression`
  Retrieves all the external variables defined in the prolog of the prepared expression.

  Specified by:
    `getAllExternalVariables` in interface `XQPreparedExpression`
  Returns:
    an array of `QName` objects for all the external variables defined in the prolog of a prepared expression. Empty array if there are no external variables present.
  Throws:
    `XQException` - if the prepared expression is in a closed state

### getAllUnboundExternalVariables

    public javax.xml.namespace.QName[] getAllUnboundExternalVariables()
                                                               throws XQException

  Description copied from interface: `XQPreparedExpression`
  Retrieves the names of all unbound external variables.

  Specified by:
    `getAllUnboundExternalVariables` in interface `XQPreparedExpression`
  Returns:
    the `QName` for all the external variables defined in the prolog of a prepared expression that are yet to be bound with a value. If there are no such variables an empty array is returned
  Throws:
    `XQException` - if the prepared expression is in a closed state

### getStaticContext

    public XQStaticContext getStaticContext()
                                     throws XQException

  Description copied from interface: `XQPreparedExpression`
  Gets an `XQStaticContext` representing the values for all expression properties. Note that these properties cannot be changed; in order to change, a new `XQPreparedExpression` needs to be created.

  Specified by:
    `getStaticContext` in interface `XQPreparedExpression`
  Returns:
    an `XQStaticContext` representing the values for all expression properties
  Throws:
    `XQException` - if the expression is in a closed state

### getStaticResultType

    public XQSequenceType getStaticResultType()
                                       throws XQException

  Description copied from interface: `XQPreparedExpression`
  Gets the static type information of the result sequence. If an implementation does not do static typing of the query, then this method must return an `XQSequenceType` object corresponding to the XQuery sequence type `item()*`.

  Specified by:
    `getStaticResultType` in interface `XQPreparedExpression`
  Returns:
    `XQSequenceType` containing the static result information.
  Throws:
    `XQException` - if the prepared expression is in a closed state

### getStaticVariableType

    public XQSequenceType getStaticVariableType(javax.xml.namespace.QName qn)
                                         throws XQException

  Description copied from interface: `XQPreparedExpression`
  Retrieves the static type of a given external variable.

  Specified by:
    `getStaticVariableType` in interface `XQPreparedExpression`
  Parameters:
    `qn` - the name of the external variable
  Returns:
    the static type information of the variable as defined in the prolog of the prepared expression
  Throws:
    `XQException` - if (1) the variable does not exist in the static context of the expression, or (2) the sequence is in a closed state, or (3) the `name` parameter is `null`

### bindAtomicValue

    public void bindAtomicValue(javax.xml.namespace.QName qn,
                                java.lang.String v,
                                XQItemType t)
                         throws XQException

  Description copied from interface: `XQDynamicContext`
  Binds a value to the given external variable or the context item. The value is converted into an instance of the specified type according to the casting from `xs:string` rules outlined in 17.1.1 Casting from xs:string and xs:untypedAtomic, XQuery 1.0 and XPath 2.0 Functions and Operators. If the cast fails, or if there is a mismatch between the static and dynamic types, an `XQException` is thrown either by this method or during query evaluation.

  Specified by:
    `bindAtomicValue` in interface `XQDynamicContext`
  Parameters:
    `qn` - the name of the external variable to bind to
    `v` - the lexical string value of the type
    `t` - the item type of the bind
  Throws:
    `XQException` - if (1) any of the arguments are `null`, (2) given type is not an atomic type, (3) the conversion of the value to an XDM instance failed, (4) in case of an `XQPreparedExpression`, the dynamic type of the bound value is not compatible with the static type of the variable, (5) in case of an `XQPreparedExpression`, the variable is not defined in the prolog of the expression, or (6) the expression is in a closed state

### bindBoolean

    public void bindBoolean(javax.xml.namespace.QName qn,
                            boolean v,
                            XQItemType it)
                     throws XQException

  Description copied from interface: `XQDynamicContext`
  Binds a value to the given external variable or the context item. The value is converted into an instance of the specified type according to the rule defined in 14.2 Mapping a Java Data Type to an XQuery Data Type, XQuery API for Java (XQJ) 1.0. If the conversion fails, or if there is a mismatch between the static and dynamic types, an `XQException` is raised either by this method, or during query evaluation.

  Specified by:
    `bindBoolean` in interface `XQDynamicContext`
  Parameters:
    `qn` - the name of the external variable to bind to, cannot be `null`
    `v` - the value to be converted
    `it` - the type of the value to be bound to the external variable. The default type of the value is used in case `null` is specified
  Throws:
    `XQException` - if (1) the `varName` argument is `null`, (2) the conversion of the value to an XDM instance failed, (3) in case of an `XQPreparedExpression`, the dynamic type of the bound value is not compatible with the static type of the variable, (4) in case of an `XQPreparedExpression`, the variable is not defined in the prolog of the expression, or (5) if the expression is in a closed state

### bindByte

    public void bindByte(javax.xml.namespace.QName qn,
                         byte v,
                         XQItemType t)
                  throws XQException

  Description copied from interface: `XQDynamicContext`
  Binds a value to the given external variable or the context item. The value is converted into an instance of the specified type according to the rule defined in 14.2 Mapping a Java Data Type to an XQuery Data Type, XQuery API for Java (XQJ) 1.0. If the conversion fails, or if there is a mismatch between the static and dynamic types, an `XQException` is raised either by this method, or during query evaluation.

  Specified by:
    `bindByte` in interface `XQDynamicContext`
  Parameters:
    `qn` - the name of the external variable to bind to, cannot be `null`
    `v` - the value to be converted
    `t` - the type of the value to be bound to the external variable. The default type of the value is used in case `null` is specified
  Throws:
    `XQException` - if (1) the `varName` argument is `null`, (2) the conversion of the value to an XDM instance failed, (3) in case of an `XQPreparedExpression`, the dynamic type of the bound value is not compatible with the static type of the variable, (4) in case of an `XQPreparedExpression`, the variable is not defined in the prolog of the expression, or (5) if the expression is in a closed state

### bindDocument

    public void bindDocument(javax.xml.namespace.QName qn,
                             java.io.InputStream is,
                             java.lang.String base,
                             XQItemType t)
                      throws XQException

  Description copied from interface: `XQDynamicContext`
  Binds a value to the given external variable or the context item.
  If the value represents a well-formed XML document, it will be parsed and results in a document node. The kind of the input type must be `null`, `XQITEMKIND_DOCUMENT_ELEMENT`, or `XQITEMKIND_DOCUMENT_SCHEMA_ELEMENT`.
  The value is converted into an instance of the specified type according to the rules defined in 14.3 Mapping a Java XML document to an XQuery document node, XQuery API for Java (XQJ) 1.0.
  If the conversion fails, or if there is a mismatch between the static and dynamic types, an `XQException` is raised either by this method, or during query evaluation. If the value is not well formed, or if a kind of the input type other than the values list above is specified, behavior is implementation defined and may raise an exception.

  Specified by:
    `bindDocument` in interface `XQDynamicContext`
  Parameters:
    `qn` - the name of the external variable to bind to, cannot be `null`
    `is` - the value to be converted, cannot be `null`
    `base` - an optional base URI, can be `null`. It can be used, for example, to resolve relative URIs and to include in error messages.
    `t` - the type of the value for the created document node. If `null` is specified, it behaves as if `XQDataFactory.createDocumentElementType( XQDataFactory.createElementType(null, XQItemType.XQBASETYPE_XS_UNTYPED))` were passed in as the type parameter. That is, the type represents the XQuery sequence type `document-node(element(*, xs:untyped))`
  Throws:
    `XQException` - if (1) the `varName` or `value` argument is `null`, (2) the conversion of the value to an XDM instance failed, (3) in case of an `XQPreparedExpression`, the dynamic type of the bound value is not compatible with the static type of the variable, (4) in case of an `XQPreparedExpression`, the variable is not defined in the prolog of the expression, or (5) if the expression is in a closed state

### bindDocument

    public void bindDocument(javax.xml.namespace.QName qn,
                             java.io.Reader r,
                             java.lang.String base,
                             XQItemType t)
                      throws XQException

  Description copied from interface: `XQDynamicContext`
  Binds a value to the given external variable or the context item.
  If the value represents a well-formed XML document, it will be parsed and results in a document node. The kind of the input type must be `null`, `XQITEMKIND_DOCUMENT_ELEMENT`, or `XQITEMKIND_DOCUMENT_SCHEMA_ELEMENT`.
  The value is converted into an instance of the specified type according to the rules defined in 14.3 Mapping a Java XML document to an XQuery document node, XQuery API for Java (XQJ) 1.0.
  If the conversion fails, or if there is a mismatch between the static and dynamic types, an `XQException` is raised either by this method, or during query evaluation. If the value is not well formed, or if a kind of the input type other than the values list above is specified, behavior is implementation defined and may raise an exception.

  Specified by:
    `bindDocument` in interface `XQDynamicContext`
  Parameters:
    `qn` - the name of the external variable to bind to, cannot be `null`
    `r` - the value to be converted, cannot be `null`
    `base` - an optional base URI, can be `null`. It can be used, for example, to resolve relative URIs and to include in error messages.
    `t` - the type of the value for the created document node. If `null` is specified, it behaves as if `XQDataFactory.createDocumentElementType( XQDataFactory.createElementType(null, XQItemType.XQBASETYPE_XS_UNTYPED))` were passed in as the type parameter. That is, the type represents the XQuery sequence type `document-node(element(*, xs:untyped))`
  Throws:
    `XQException` - if (1) the `varName` or `value` argument is `null`, (2) the conversion of the value to an XDM instance failed, (3) in case of an `XQPreparedExpression`, the dynamic type of the bound value is not compatible with the static type of the variable, (4) in case of an `XQPreparedExpression`, the variable is not defined in the prolog of the expression, or (5) if the expression is in a closed state

### bindDocument

    public void bindDocument(javax.xml.namespace.QName qn,
                             javax.xml.transform.Source s,
                             XQItemType t)
                      throws XQException

  Description copied from interface: `XQDynamicContext`
  Binds a value to the given external variable or the context item from the given `Source`. An XQJ implementation must at least support the following implementations:
  - `javax.xml.transform.dom.DOMSource`
  - `javax.xml.transform.sax.SAXSource`
  - `javax.xml.transform.stream.StreamSource`
  If the value represents a well-formed XML document, it will result in a document node. The kind of the input type must be `null`, `XQITEMKIND_DOCUMENT_ELEMENT`, or `XQITEMKIND_DOCUMENT_SCHEMA_ELEMENT`.
  The value is converted into an instance of the specified type according to the rules defined in 14.3 Mapping a Java XML document to an XQuery document node, XQuery API for Java (XQJ) 1.0.
  If the value is not well formed, or if a kind of the input type other than the values list above is specified, behavior is implementation defined and may raise an exception. If the conversion fails, or if there is a mismatch between the static and dynamic types, an `XQException` is raised either by this method, or during query evaluation.

  Specified by:
    `bindDocument` in interface `XQDynamicContext`
  Parameters:
    `qn` - the name of the external variable to bind to, cannot be `null`
    `s` - the value to be converted, cannot be `null`
    `t` - the type of the value for the created document node. If `null` is specified, it behaves as if `XQDataFactory.createDocumentElementType( XQDataFactory.createElementType(null, XQItemType.XQBASETYPE_XS_UNTYPED))` were passed in as the type parameter. That is, the type represents the XQuery sequence type `document-node(element(*, xs:untyped))`
  Throws:
    `XQException` - if (1) the `varName` or `value` argument is `null`, (2) the conversion of the value to an XDM instance failed, (3) in case of an `XQPreparedExpression`, the dynamic type of the bound value is not compatible with the static type of the variable, (4) in case of an `XQPreparedExpression`, the variable is not defined in the prolog of the expression, or (5) if the expression is in a closed state

### bindDocument

    public void bindDocument(javax.xml.namespace.QName qn,
                             java.lang.String v,
                             java.lang.String base,
                             XQItemType t)
                      throws XQException

  Description copied from interface: `XQDynamicContext`
  Binds a value to the given external variable or the context item.
  If the value represents a well-formed XML document, it will be parsed and results in a document node. The kind of the input type must be `null`, `XQITEMKIND_DOCUMENT_ELEMENT`, or `XQITEMKIND_DOCUMENT_SCHEMA_ELEMENT`.
  The value is converted into an instance of the specified type according to the rules defined in 14.3 Mapping a Java XML document to an XQuery document node, XQuery API for Java (XQJ) 1.0.
  If the conversion fails, or if there is a mismatch between the static and dynamic types, an `XQException` is raised either by this method, or during query evaluation. If the value is not well formed, or if a kind of the input type other than the values list above is specified, behavior is implementation defined and may raise an exception.

  Specified by:
    `bindDocument` in interface `XQDynamicContext`
  Parameters:
    `qn` - the name of the external variable to bind to, cannot be `null`
    `v` - the value to be converted, cannot be `null`
    `base` - an optional base URI, can be `null`. It can be used, for example, to resolve relative URIs and to include in error messages.
    `t` - the type of the value for the created document node. If `null` is specified, it behaves as if `XQDataFactory.createDocumentElementType( XQDataFactory.createElementType(null, XQItemType.XQBASETYPE_XS_UNTYPED))` were passed in as the type parameter. That is, the type represents the XQuery sequence type `document-node(element(*, xs:untyped))`
  Throws:
    `XQException` - if (1) the `varName` or `value` argument is `null`, (2) the conversion of the value to an XDM instance failed, (3) in case of an `XQPreparedExpression`, the dynamic type of the bound value is not compatible with the static type of the variable, (4) in case of an `XQPreparedExpression`, the variable is not defined in the prolog of the expression, or (5) if the expression is in a closed state

### bindDocument

    public void bindDocument(javax.xml.namespace.QName qn,
                             org.xml.sax.XMLReader r,
                             XQItemType t)
                      throws XQException

  Description copied from interface: `XQDynamicContext`
  Binds a value to the given external variable.
  If the `XMLReader` produces a well-formed XML document, it results in a document node. The kind of the input type must be `null`, `XQITEMKIND_DOCUMENT_ELEMENT` or `XQITEMKIND_DOCUMENT_SCHEMA_ELEMENT`.
  The value is converted into an instance of the specified type according to the rules defined in 14.3 Mapping a Java XML document to an XQuery document node, XQuery API for Java (XQJ) 1.0.
  If the value is not well formed, or if a kind of the input type other than the values list above is specified, behavior is implementation defined and may raise an exception. If the conversion fails, or if there is a mismatch between the static and dynamic types, an XQException is raised either by this method, or the execute method.
  The contract of this method is as follows. First a `ContentHandler` is passed to the XML `XMLReader`; and optionally an implementation can specify additional handlers like a `LexicalHandler`. Subsequently `parse(String systemId)` will be invoked; and as such the `XMLReader` will pass the SAX event representing the document to bind. The `systemId` argument identifies the external variable, a `QName` formatted into a `String` using the James Clark representation.
  Example - the application loads an XML document (foo.xml) using a SAX parser, this document is bound to an external variable. The XQuery returns all foo elements in the document, which are written to stdout. Assume there is an `XQConnection` connection...

        ...

        // Create an XMLReader, which will pass the SAX events to the XQJ
        // implementation
        XMLFilter xmlReader = new XMLFilterImpl() {

          public void parse(String systemId) throws IOException,
          SAXException {

             // foo.xml is the XML document to bind
             super.parse("foo.xml");

            }

          };

        // The parent XML Reader is a SAX parser, which will do the
        // actual work of parsing the XML document
        xmlReader.setParent(org.xml.sax.helpers.XMLReaderFactory.createXMLReader());

        // Create an XQPreparedExpression
        XQPreparedExpression e =  connection.prepareExpression("declare variable $doc as
                             document-node(element(*, xs:untyped)) external; $doc//foo));

        e.bindDocument(new QName("doc"), xmlReader);

        XQResultSequence result = preparedExpression.executeQuery();

        result.writeSequence(System.out);
        ...

  Specified by:
    `bindDocument` in interface `XQDynamicContext`
  Parameters:
    `qn` - the name of the external variable to bind to, cannot be `null`
    `r` - the `XMLReader` producing SAX events representing the document to bind
    `t` - the type of the value for the created document node. If `null` is specified, it behaves as if `XQDataFactory.createDocumentElementType( XQDataFactory.createElementType(null, XQItemType.XQBASETYPE_XS_UNTYPED))` were passed in as the type parameter. That is, the type represents the XQuery sequence type `document-node(element(*, xs:untyped))`
  Throws:
    `XQException` - if (1) the `varName` or value argument is `null`, (2) the conversion of the value to an XDM instance failed, (3) in case of an `XQPreparedExpression`, the dynamic type of the bound value is not compatible with the static type of the variable, (4) in case of an `XQPreparedExpression`, the variable is not defined in the prolog of the expression, (5) if the expression is in a closed state, or (6) the `XMLReader` reports an error during `parse()`

### bindDocument

    public void bindDocument(javax.xml.namespace.QName qn,
                             javax.xml.stream.XMLStreamReader sr,
                             XQItemType t)
                      throws XQException

  Description copied from interface: `XQDynamicContext`
  Binds a value to the given external variable or the context item.
  If the value represents a well-formed XML document, it results in a document node. The kind of the input type must be `null`, `XQITEMKIND_DOCUMENT_ELEMENT` or `XQITEMKIND_DOCUMENT_SCHEMA_ELEMENT`.
  The value is converted into an instance of the specified type according to the rules defined in 14.3 Mapping a Java XML document to an XQuery document node, XQuery API for Java (XQJ) 1.0.
  If the value is not well formed, or if a kind of the input type other than the values list above is specified, behavior is implementation defined and may raise an exception. If the conversion fails, or if there is a mismatch between the static and dynamic types, an `XQException` is raised either by this method, or during query evaluation.

  Specified by:
    `bindDocument` in interface `XQDynamicContext`
  Parameters:
    `qn` - the name of the external variable to bind to, cannot be `null`
    `sr` - the value to be converted, cannot be `null`
    `t` - the type of the value for the created document node. If `null` is specified, it behaves as if `XQDataFactory.createDocumentElementType( XQDataFactory.createElementType(null, XQItemType.XQBASETYPE_XS_UNTYPED))` were passed in as the type parameter. That is, the type represents the XQuery sequence type `document-node(element(*, xs:untyped))`
  Throws:
    `XQException` - if (1) the `varName` or `value` argument is `null`, (2) the conversion of the value to an XDM instance failed, (3) in case of an `XQPreparedExpression`, the dynamic type of the bound value is not compatible with the static type of the variable, (4) in case of an `XQPreparedExpression`, the variable is not defined in the prolog of the expression, or (5) if the expression is in a closed state

### bindDouble

    public void bindDouble(javax.xml.namespace.QName qn,
                           double v,
                           XQItemType t)
                    throws XQException

  Description copied from interface: `XQDynamicContext`
  Binds a value to the given external variable or the context item. The value is converted into an instance of the specified type according to the rule defined in 14.2 Mapping a Java Data Type to an XQuery Data Type, XQuery API for Java (XQJ) 1.0. If the conversion fails, or if there is a mismatch between the static and dynamic types, an `XQException` is raised either by this method, or during query evaluations.

  Specified by:
    `bindDouble` in interface `XQDynamicContext`
  Parameters:
    `qn` - the name of the external variable to bind to, cannot be `null`
    `v` - the value to be converted
    `t` - the type of the value to be bound to the external variable. The default type of the value is used in case `null` is specified
  Throws:
    `XQException` - if (1) the `varName` argument is `null`, (2) the conversion of the value to an XDM instance failed, (3) in case of an `XQPreparedExpression`, the dynamic type of the bound value is not compatible with the static type of the variable, (4) in case of an `XQPreparedExpression`, the variable is not defined in the prolog of the expression, or (5) if the expression is in a closed state

### bindFloat

    public void bindFloat(javax.xml.namespace.QName qn,
                          float v,
                          XQItemType t)
                   throws XQException

  Description copied from interface: `XQDynamicContext`
  Binds a value to the given external variable or the context item. The value is converted into an instance of the specified type according to the rule defined in 14.2 Mapping a Java Data Type to an XQuery Data Type, XQuery API for Java (XQJ) 1.0. If the conversion fails, or if there is a mismatch between the static and dynamic types, an `XQException` is raised either by this method, or during query evaluations.

  Specified by:
    `bindFloat` in interface `XQDynamicContext`
  Parameters:
    `qn` - the name of the external variable to bind to, cannot be `null`
    `v` - the value to be converted
    `t` - the type of the value to be bound to the external variable. The default type of the value is used in case `null` is specified
  Throws:
    `XQException` - if (1) the `varName` argument is `null`, (2) the conversion of the value to an XDM instance failed, (3) in case of an `XQPreparedExpression`, the dynamic type of the bound value is not compatible with the static type of the variable, (4) in case of an `XQPreparedExpression`, the variable is not defined in the prolog of the expression, or (5) if the expression is in a closed state

### bindInt

    public void bindInt(javax.xml.namespace.QName qn,
                        int v,
                        XQItemType t)
                 throws XQException

  Description copied from interface: `XQDynamicContext`
  Binds a value to the given external variable or the context item. The value is converted into an instance of the specified type according to the rule defined in 14.2 Mapping a Java Data Type to an XQuery Data Type, XQuery API for Java (XQJ) 1.0. If the conversion fails, or if there is a mismatch between the static and dynamic types, an `XQException` is raised either by this method, or during query evaluations.

  Specified by:
    `bindInt` in interface `XQDynamicContext`
  Parameters:
    `qn` - the name of the external variable to bind to, cannot be `null`
    `v` - the value to be converted
    `t` - the type of the value to be bound to the external variable. The default type of the value is used in case `null` is specified
  Throws:
    `XQException` - if (1) the `varName` argument is `null`, (2) the conversion of the value to an XDM instance failed, (3) in case of an `XQPreparedExpression`, the dynamic type of the bound value is not compatible with the static type of the variable, (4) in case of an `XQPreparedExpression`, the variable is not defined in the prolog of the expression, or (5) if the expression is in a closed state

### bindItem

    public void bindItem(javax.xml.namespace.QName qn,
                         XQItem t)
                  throws XQException

  Description copied from interface: `XQDynamicContext`
  Binds a value to the given external variable. The dynamic type of the value is derived from the `XQItem`. In case of a mismatch between the static and dynamic types, an `XQException` is raised either by this method, or during query evaluation.

  Specified by:
    `bindItem` in interface `XQDynamicContext`
  Parameters:
    `qn` - the name of the external variable to bind to, cannot be `null`
    `t` - the value to be bound, cannot be `null`
  Throws:
    `XQException` - if (1) any of the arguments are `null`, (2) in case of an `XQPreparedExpression`, the dynamic type of the bound value is not compatible with the static type of the variable, (3) in case of an `XQPreparedExpression`, the variable is not defined in the prolog of the expression, or (4) the expression is in a closed state

### bindLong

    public void bindLong(javax.xml.namespace.QName qn,
                         long v,
                         XQItemType t)
                  throws XQException

  Description copied from interface: `XQDynamicContext`
  Binds a value to the given external variable or the context item. The value is converted into an instance of the specified type according to the rule defined in 14.2 Mapping a Java Data Type to an XQuery Data Type, XQuery API for Java (XQJ) 1.0. If the conversion fails, or if there is a mismatch between the static and dynamic types, an `XQException` is raised either by this method, or during query evaluation.

  Specified by:
    `bindLong` in interface `XQDynamicContext`
  Parameters:
    `qn` - the name of the external variable to bind to, cannot be `null`
    `v` - the value to be converted
    `t` - the type of the value to be bound to the external variable. The default type of the value is used in case `null` is specified
  Throws:
    `XQException` - if (1) the `varName` argument is `null`, (2) the conversion of the value to an XDM instance failed, (3) in case of an `XQPreparedExpression`, the dynamic type of the bound value is not compatible with the static type of the variable, (4) in case of an `XQPreparedExpression`, the variable is not defined in the prolog of the expression, or (5) if the expression is in a closed state

### bindNode

    public void bindNode(javax.xml.namespace.QName qn,
                         org.w3c.dom.Node n,
                         XQItemType t)
                  throws XQException

  Description copied from interface: `XQDynamicContext`
  Binds a value to the given external variable or the context item. The value is converted into an instance of the specified type according to the rule defined in 14.2 Mapping a Java Data Type to an XQuery Data Type, XQuery API for Java (XQJ) 1.0. If the conversion fails, or if there is a mismatch between the static and dynamic types, an `XQException` is raised either by this method, or during query evaluation.

  Specified by:
    `bindNode` in interface `XQDynamicContext`
  Parameters:
    `qn` - the name of the external variable to bind to, cannot be `null`
    `n` - the value to be converted, cannot be `null`
    `t` - the type of the value to be bound to the external variable. The default type of the value is used in case `null` is specified
  Throws:
    `XQException` - if (1) the `varName` or `value` argument is `null`, (2) the conversion of the value to an XDM instance failed, (3) in case of an `XQPreparedExpression`, the dynamic type of the bound value is not compatible with the static type of the variable, (4) in case of an `XQPreparedExpression`, the variable is not defined in the prolog of the expression, or (5) if the expression is in a closed state

### bindObject

    public void bindObject(javax.xml.namespace.QName qn,
                           java.lang.Object v,
                           XQItemType t)
                    throws XQException

  Description copied from interface: `XQDynamicContext`
  Binds a value to the given external variable or the context item. The value is converted into an instance of the specified type according to the rule defined in 14.2 Mapping a Java Data Type to an XQuery Data Type, XQuery API for Java (XQJ) 1.0. If the conversion fails, or if there is a mismatch between the static and dynamic types, an `XQException` is raised either by this method, or during query evaluation.

  Specified by:
    `bindObject` in interface `XQDynamicContext`
  Parameters:
    `qn` - the name of the external variable to bind to, cannot be `null`
    `v` - the value to be converted, cannot be `null`
    `t` - the type of the value to be bound to the external variable. The default type of the value is used in case `null` is specified
  Throws:
    `XQException` - if (1) the `varName` or `value` argument is `null`, (2) the conversion of the value to an XDM instance failed, (3) in case of an `XQPreparedExpression`, the dynamic type of the bound value is not compatible with the static type of the variable, (4) in case of an `XQPreparedExpression`, the variable is not defined in the prolog of the expression, or (5) if the expression is in a closed state

### bindSequence

    public void bindSequence(javax.xml.namespace.QName qn,
                             XQSequence s)
                      throws XQException

  Description copied from interface: `XQDynamicContext`
  Binds a value to the given external variable or the context item. The input sequence is consumed from its current position to the end, after which the input sequence's position will be set to point after the last item. The dynamic type of the value is derived from the items in the sequence. In case of a mismatch between the static and dynamic types, an `XQException` is be raised either by this method, or during query evaluation.

  Specified by:
    `bindSequence` in interface `XQDynamicContext`
  Parameters:
    `qn` - the name of the external variable to bind to, cannot be `null`
    `s` - the value to be bound, cannot be `null`
  Throws:
    `XQException` - if (1) any of the arguments are `null`, (2) in case of an `XQPreparedExpression`, the dynamic type of the bound value is not compatible with the static type of the variable, (3) in case of an `XQPreparedExpression`, the variable is not defined in the prolog of the expression, or (4) the expression is in a closed state

### bindShort

    public void bindShort(javax.xml.namespace.QName qn,
                          short v,
                          XQItemType t)
                   throws XQException

  Description copied from interface: `XQDynamicContext`
  Binds a value to the given external variable or the context item. The value is converted into an instance of the specified type according to the rule defined in 14.2 Mapping a Java Data Type to an XQuery Data Type, XQuery API for Java (XQJ) 1.0. If the conversion fails, or if there is a mismatch between the static and dynamic types, an `XQException` is raised either by this method, or during query evaluation.

  Specified by:
    `bindShort` in interface `XQDynamicContext`
  Parameters:
    `qn` - the name of the external variable to bind to, cannot be `null`
    `v` - the value to be converted
    `t` - the type of the value to be bound to the external variable. The default type of the value is used in case `null` is specified
  Throws:
    `XQException` - if (1) the `varName` argument is `null`, (2) the conversion of the value to an XDM instance failed, (3) in case of an `XQPreparedExpression`, the dynamic type of the bound value is not compatible with the static type of the variable, (4) in case of an `XQPreparedExpression`, the variable is not defined in the prolog of the expression, or (5) if the expression is in a closed state

### bindString

    public void bindString(javax.xml.namespace.QName qn,
                           java.lang.String v,
                           XQItemType t)
                    throws XQException

  Description copied from interface: `XQDynamicContext`
  Binds a value to the given external variable or the context item. The value is converted into an instance of the specified type, which must represent an `xs:string` or a type derived by restriction from `xs:string`. If the specified type is `null`, it defaults to `xs:string`.
  Subsequently the value is converted into an instance of the specified type according to the rule defined in 14.2 Mapping a Java Data Type to an XQuery Data Type, XQuery API for Java (XQJ) 1.0,. If the conversion fails, or if there is a mismatch between the static and dynamic types, an `XQException` is raised either by this method, or during query evaluation.

  Specified by:
    `bindString` in interface `XQDynamicContext`
  Parameters:
    `qn` - the name of the external variable to bind to, cannot be `null`
    `v` - the value to be converted, cannot be `null`
    `t` - the type of the value to be bound to the external variable. The default type, `xs:string`, is used in case `null` is specified
  Throws:
    `XQException` - if (1) the `varName` or `value` argument is `null`, (2) the conversion of the value to an XDM instance failed, (3) in case of an `XQPreparedExpression`, the dynamic type of the bound value is not compatible with the static type of the variable, (4) in case of an `XQPreparedExpression`, the variable is not defined in the prolog of the expression, or (5) if the expression is in a closed state

### getImplicitTimeZone

    public java.util.TimeZone getImplicitTimeZone()
                                           throws XQException

  Description copied from interface: `XQDynamicContext`
  Gets the implicit timezone

  Specified by:
    `getImplicitTimeZone` in interface `XQDynamicContext`
  Returns:
    the implicit timezone. This may have been set by an application using the `setImplicitTimeZone` method or provided by the implementation
  Throws:
    `XQException` - if the expression is in a closed state

### setImplicitTimeZone

    public void setImplicitTimeZone(java.util.TimeZone tz)
                             throws XQException

  Description copied from interface: `XQDynamicContext`
  Sets the implicit timezone

  Specified by:
    `setImplicitTimeZone` in interface `XQDynamicContext`
  Parameters:
    `tz` - time zone to be set
  Throws:
    `XQException` - if the expression is in a closed state

### close

    public final void close()

  Closes the class.

### isClosed

    public final boolean isClosed()

  Returns the closed flag.

  Returns:
    flag

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD