io::zorba::api::xqj::ZorbaXQExpression

This interface describes the execute immediate functionality for expressions. This object can be created from the ZorbaXQConnection and the execution can be done using the executeQuery() or executeCommand() method, passing in the XQuery expression.All external variables defined in the prolog of the expression to be executed must be set in the dynamic context of this expression using the bind methods. Also, variables bound in this expression but not defined as external in the prolog of the expression to be executed, are simply ignored. For example, if variables $var1 and $var2 are bound, but the query only defines $var1 as external, no error will be reported for the binding of $var2. It will simply be ignored. When the expression is executed using the executeQuery method, if the execution is successful, then an ZorbaXQResultSequence object is returned. The ZorbaXQResultSequence object is tied to the ZorbaXQExpression from which it was prepared and is closed implicitly if that ZorbaXQExpression is either closed or re-executed.The ZorbaXQExpression object is dependent on the ZorbaXQConnection object from which it was created and is only valid for the duration of that object. Thus, if the ZorbaXQConnection object is closed then this ZorbaXQExpression object will be implicitly closed and it can no longer be used.An XQJ driver is not required to provide finalizer methods for the connection and other objects. Hence it is strongly recommended that users call close method explicitly to free any resources. It is also recommended that they do so under a final block to ensure that the object is closed even when there are exceptions. Not closing this object implicitly or explicitly might result in serious memory leaks.When the ZorbaXQExpression is closed any ZorbaXQResultSequence object obtained from it is also implicitly closed.Example -
 {.java}
   ZorbaXQConnection conn = XQDatasource.getConnection();
   ZorbaXQExpression expr = conn.createExpression();
 
   expr.bindInt(new QName("x"), 21, null);
  
   XQSequence result = expr.executeQuery(
      "declare variable $x as xs:integer external;
      for $i in $x return $i");
    
   while (result.next())
   {
      // process results ...
   }
  
   // Execute some other expression on the same object
   XQSequence result = expr.executeQuery("for $i in doc('foo.xml') return $i");
   ... 
 
   result.close(); // close the result
   expr.close(); 
   conn.close(); 

Private Attributes

boolean

cancel

boolean

closed

XQConnection

connection

TimeZone

implicitTimeZone

Map< String, Item >

itemsToBind

Collection< XQResultSequence >

resultSequences

XQStaticContext

staticContext

Public Functions

void

bindAtomicValue(QName varName, String value, XQItemType type)

Binds a value to the given external variable or the context item.

void

bindBoolean(QName varName, boolean value, XQItemType type)

Binds a value to the given external variable or the context item.

void

bindByte(QName varName, byte value, XQItemType type)

Binds a value to the given external variable or the context item.

void

bindDocument(QName varName, String value, String baseURI, XQItemType type)

Binds a value to the given external variable or the context item.

void

bindDocument(QName varName, Reader value, String baseURI, XQItemType type)

Binds a value to the given external variable or the context item.

void

bindDocument(QName varName, InputStream value, String baseURI, XQItemType type)

Binds a value to the given external variable or the context item.

void

bindDocument(QName varName, XMLStreamReader value, XQItemType type)

Binds a value to the given external variable or the context item.

void

bindDocument(QName varName, Source value, XQItemType type)

Binds a value to the given external variable or the context item.

void

bindDouble(QName varName, double value, XQItemType type)

Binds a value to the given external variable or the context item.

void

bindFloat(QName varName, float value, XQItemType type)

Binds a value to the given external variable or the context item.

void

bindInt(QName varName, int value, XQItemType type)

Binds a value to the given external variable or the context item.

void

bindItem(QName varName, XQItem value)

Binds a value to the given external variable.

void

bindLong(QName varName, long value, XQItemType type)

Binds a value to the given external variable or the context item.

void

bindNode(QName varName, Node value, XQItemType type)

Binds a value to the given external variable or the context item.

void

bindObject(QName varName, Object value, XQItemType type)

Binds a value to the given external variable or the context item.

void

bindSequence(QName varName, XQSequence value)

Binds a value to the given external variable.

void

bindShort(QName varName, short value, XQItemType type)

Binds a value to the given external variable or the context item.

void

bindString(QName varName, String value, XQItemType type)

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 ZorbaXQExpression.

void

close()

Closes the expression object and release associated resources.

void

executeCommand(String string)

Executes an implementation-defined command.

void

executeCommand(Reader reader)

Executes an implementation-defined command.

XQResultSequence

executeQuery(String value)

Executes a query expression.

XQResultSequence

executeQuery(Reader value)

Executes a query expression.

XQResultSequence

executeQuery(InputStream value)

Executes a query expression.

TimeZone

getImplicitTimeZone()

Gets the implicit timezone.

XQStaticContext

getStaticContext()

Gets an ZorbaXQStaticContext representing the values for all expression properties.

boolean

isClosed()

Checks if the expression is in a closed state.

void

setImplicitTimeZone(TimeZone value)

Sets the implicit timezone.

ZorbaXQExpression(XQConnection conn)

ZorbaXQExpression(XQConnection conn, XQStaticContext sc)

Private Functions

void

isClosedXQException()

void

isNullXQException(Object value)

Private Attributes

cancel

boolean cancel

closed

boolean closed

connection

XQConnection connection

implicitTimeZone

TimeZone implicitTimeZone

itemsToBind

Map< String, Item > itemsToBind

resultSequences

Collection< XQResultSequence > resultSequences

staticContext

XQStaticContext staticContext

Public Functions

bindAtomicValue

void bindAtomicValue(QName varName, String value, XQItemType type)

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.

Parameters

varName - the name of the external variable to bind to
value - the lexical string value of the type
type - the item type of the bind

Parameters

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

void bindBoolean(QName varName, boolean value, XQItemType type)

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.

Parameters

varName - the name of the external variable to bind to, cannot be null
value - the value to be bound, cannot be null
type - 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

Parameters

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

bindByte

void bindByte(QName varName, byte value, XQItemType type)

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.

Parameters

varName - the name of the external variable to bind to, cannot be null
value - the value to be bound, cannot be null
type - 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

Parameters

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

void bindDocument(QName varName, String value, String baseURI, XQItemType type)

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.

Parameters

varName - the name of the external variable to bind to, cannot be null
value - the value to be converted, cannot be null
baseURI - an optional base URI, can be null. It can be used, for example, to resolve relative URIs and to include in error messages.
type - 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))

Parameters

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

void bindDocument(QName varName, Reader value, String baseURI, XQItemType type)

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.

Parameters

varName - the name of the external variable to bind to, cannot be null
value - the value to be converted, cannot be null
baseURI - an optional base URI, can be null. It can be used, for example, to resolve relative URIs and to include in error messages.
type - 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))

Parameters

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

void bindDocument(QName varName, InputStream value, String baseURI, XQItemType type)

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.

Parameters

varName - the name of the external variable to bind to, cannot be null
value - the value to be converted, cannot be null
baseURI - an optional base URI, can be null. It can be used, for example, to resolve relative URIs and to include in error messages.
type - 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))

Parameters

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

void bindDocument(QName varName, XMLStreamReader value, XQItemType type)

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.

Parameters

varName - the name of the external variable to bind to, cannot be null
value - the value to be converted, cannot be null
type - 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))

Parameters

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

void bindDocument(QName varName, Source value, XQItemType type)

Binds a value to the given external variable or the context item.

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

Parameters

varName - the name of the external variable to bind to, cannot be null
value - the value to be converted, cannot be null
type - 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))

Parameters

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

void bindDouble(QName varName, double value, XQItemType type)

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.

Parameters

varName - the name of the external variable to bind to, cannot be null
value - the value to be bound, cannot be null
type - 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

Parameters

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

bindFloat

void bindFloat(QName varName, float value, XQItemType type)

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.

Parameters

varName - the name of the external variable to bind to, cannot be null
value - the value to be bound, cannot be null
type - 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

Parameters

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

bindInt

void bindInt(QName varName, int value, XQItemType type)

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.

Parameters

varName - the name of the external variable to bind to, cannot be null
value - the value to be bound, cannot be null
type - 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

Parameters

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

bindItem

void bindItem(QName varName, XQItem value)

Binds a value to the given external variable.

The dynamic type of the value is derived from the ZorbaXQItem. In case of a mismatch between the static and dynamic types, an XQException is raised either by this method, or during query evaluation.

Parameters

varName - the name of the external variable to bind to, cannot be null
value - the value to be bound, cannot be null

Parameters

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, (4) the expression is in a closed state, or (5) the specified item is closed

bindLong

void bindLong(QName varName, long value, XQItemType type)

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.

Parameters

varName - the name of the external variable to bind to, cannot be null
value - the value to be bound, cannot be null
type - 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

Parameters

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

bindNode

void bindNode(QName varName, Node value, XQItemType type)

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.

Parameters

varName - the name of the external variable to bind to, cannot be null
value - the value to be bound, cannot be null
type - 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

Parameters

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

void bindObject(QName varName, Object value, XQItemType type)

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.

Parameters

varName - the name of the external variable to bind to, cannot be null
value - the value to be bound, cannot be null
type - 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

Parameters

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

void bindSequence(QName varName, XQSequence value)

Binds a value to the given external variable.

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.

Parameters

varName - the name of the external variable to bind to, cannot be null
value - the value to be bound, cannot be null

Parameters

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, (4) the expression is in a closed state, or (5) the specified item is closed

bindShort

void bindShort(QName varName, short value, XQItemType type)

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.

Parameters

varName - the name of the external variable to bind to, cannot be null
value - the value to be bound, cannot be null
type - 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

Parameters

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

bindString

void bindString(QName varName, String value, XQItemType type)

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.

Parameters

varName - the name of the external variable to bind to, cannot be null
value - the value to be converted, cannot be null
type - the type of the value to be bound to the external variable. The default type, xs:string, is used in case null is specified

Parameters

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

cancel

void cancel()

Attempts to cancel the execution if both the XQuery engine and XQJ driver support aborting the execution of an ZorbaXQExpression.

This method can be used by one thread to cancel an ZorbaXQExpression, 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 ZorbaXQResultSequence returned by executeQuery. If applicable, any open ZorbaXQResultSequence and XQResultItem objects will also be implicitly closed in this case.

Parameters

XQException - if the expression is in a closed state

close

void close()

Closes the expression object and release associated resources.

Once the expression is closed, all methods on this object other than the close or isClosed will raise exceptions. This also closes any result sequences obtained from this expression. Calling close on an ZorbaXQExpression object that is already closed has no effect.

Parameters

XQException - if there are errors when closing the expression

executeCommand

void executeCommand(String string)

Executes an implementation-defined command.

Calling this method implicitly closes any previous result sequence obtained from this expression.

Parameters

string - the input command as a string

Parameters

XQException - if (1) there are errors when executing the command, or (2) the expression is in a closed state

executeCommand

void executeCommand(Reader reader)

Executes an implementation-defined command.

Calling this method implicitly closes any previous result sequence obtained from this expression.

Parameters

reader - the input command as a reader

Parameters

XQException - if (1) there are errors when executing the command, or (2) the expression is in a closed state

executeQuery

XQResultSequence executeQuery(String value)

Executes a query expression.

This implicitly closes any previous result sequences obtained from this expression.

Parameters

value - the input query expression string. Cannot be null

Returns

an ZorbaXQResultSequence object containing the result of the query execution

Parameters

XQException - if (1) there are errors when executing the query, (2) the expression is in a closed state, (3) the execution is cancelled, (4) the query parameter is null

executeQuery

XQResultSequence executeQuery(Reader value)

Executes a query expression.

This implicitly closes any previous result sequences obtained from this expression.

Parameters

value - the input query expression reader object. Cannot be null

Returns

an ZorbaXQResultSequence object containing the result of the query execution

Parameters

XQException - if (1) there are errors when executing the query, (2) the expression is in a closed state, (3) the execution is cancelled, (4) the query parameter is null

executeQuery

XQResultSequence executeQuery(InputStream value)

Executes a query expression.

This implicitly closes any previous result sequences obtained from this expression.

Parameters

value - the input query expression inputstream object. Cannot be null

Returns

an ZorbaXQResultSequence object containing the result of the query execution

Parameters

XQException - if (1) there are errors when executing the query, (2) the expression is in a closed state, (3) the execution is cancelled, (4) the query parameter is null

getImplicitTimeZone

TimeZone getImplicitTimeZone()

Gets the implicit timezone.

Returns

the implicit timezone. This may have been set by an application using the setImplicitTimeZone method or provided by the implementation

Parameters

XQException - if the expression is in a closed state

getStaticContext

XQStaticContext getStaticContext()

Gets an ZorbaXQStaticContext representing the values for all expression properties.

Note that these properties cannot be changed; in order to change, a new ZorbaXQExpression needs to be created.

Returns

an ZorbaXQStaticContext representing the values for all expression properties

Parameters

XQException - if the expression is in a closed state

isClosed

boolean isClosed()

Checks if the expression is in a closed state.

Returns

true if the expression is in a closed state, false otherwise

setImplicitTimeZone

void setImplicitTimeZone(TimeZone value)

Sets the implicit timezone.

Parameters

value - time zone to be set

Parameters

XQException - if the expression is in a closed state

ZorbaXQExpression

 ZorbaXQExpression(XQConnection conn)

ZorbaXQExpression

 ZorbaXQExpression(XQConnection conn, XQStaticContext sc)

Private Functions

isClosedXQException

void isClosedXQException()

isNullXQException

void isNullXQException(Object value)