public class XmlQueryExpression
extends java.lang.Object
XmlManager.prepare(java.lang.String, com.sleepycat.dbxml.XmlQueryContext). Parsed XQuery
expressions are useful because they allow the cost of query parsing and
optimization to be amortized over many evaluations.
If indices of a container that may be referenced by a parsed XQuery expression
are modified (e.g. add/drop an index) the XmlQueryExpression object
should be regenerated by the application.
The copy constructor is provided for this class. The class is implemented using a handle-body idiom. When a handle is copied both handles maintain a reference to the same body.
There are two basic forms of the execute method: one that takes an XmlValue object, and another that does not. For methods that do
not take an XmlValue, the XQuery must restrict the scope of the query
using either the collection() or the doc() XQuery navigation functions, or an exception is thrown.
For those forms of the execute method that take an XmlValue, the query is applied against that object.
This object is free-threaded, and can be safely shared among threads, once
created. Each thread should use an unshared XmlQueryContext object for
calls to execute(com.sleepycat.dbxml.XmlQueryContext).
| Constructor and Description |
|---|
XmlQueryExpression(XmlQueryExpression queryExpression)
Copy constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
delete()
Free the native resources associated with this object.
|
XmlResults |
execute(XmlQueryContext queryContext)
Evaluates the XQuery expression against the containers and documents
identified by the query.
|
XmlResults |
execute(XmlQueryContext queryContext,
XmlDocumentConfig config)
Evaluates the XQuery expression against the containers and documents
identified by the query, with configuration.
|
XmlResults |
execute(XmlTransaction txn,
XmlQueryContext queryContext)
Evaluates the XQuery expression against the containers and documents
identified by the query, from within the scope of the provided
XmlTransaction object. |
XmlResults |
execute(XmlTransaction txn,
XmlQueryContext queryContext,
XmlDocumentConfig config)
Evaluates the XQuery expression against the containers and documents
identified by the query, from within the scope of the provided
XmlTransaction object, with configuration. |
XmlResults |
execute(XmlTransaction txn,
XmlValue contextItem,
XmlQueryContext queryContext)
Evaluates the XQuery expression against the provided context item in the given query context, from within the scope of the provided
XmlTransaction object. |
XmlResults |
execute(XmlTransaction txn,
XmlValue contextItem,
XmlQueryContext queryContext,
XmlDocumentConfig config)
Evaluates the XQuery expression against the provided context item, from within the scope of the provided
XmlTransaction object. |
XmlResults |
execute(XmlValue contextItem,
XmlQueryContext queryContext)
Evaluates the XQuery expression against the provided context item in the given query context.
|
XmlResults |
execute(XmlValue contextItem,
XmlQueryContext queryContext,
XmlDocumentConfig config)
Evaluates the XQuery expression against the provided context item in the given query context with configuration.
|
java.lang.String |
getQuery()
Returns the query as a string.
|
java.lang.String |
getQueryPlan()
Returns the query plan as a string.
|
boolean |
isUpdateExpression()
Returns true if the query is an updating expression.
|
public XmlQueryExpression(XmlQueryExpression queryExpression) throws XmlException
XmlExceptionpublic void delete()
public XmlResults execute(XmlQueryContext queryContext) throws XmlException
queryContext - The XmlQueryContext to use for this evaluation.XmlExceptionpublic XmlResults execute(XmlQueryContext queryContext, XmlDocumentConfig config) throws XmlException
queryContext - The XmlQueryContext to use for this evaluation.config - The configuration settings for the execution.XmlExceptionpublic XmlResults execute(XmlTransaction txn, XmlQueryContext queryContext) throws XmlException
XmlTransaction object.txn - If the operation is to be transaction-protected, the txn parameter is an XmlTransaction handle returned from
XmlManager.createTransaction().queryContext - The XmlQueryContext to use for this evaluation.XmlExceptionpublic XmlResults execute(XmlTransaction txn, XmlQueryContext queryContext, XmlDocumentConfig config) throws XmlException
XmlTransaction object, with configuration.txn - If the operation is to be transaction-protected, the txn parameter is an XmlTransaction handle returned from
XmlManager.createTransaction().queryContext - The XmlQueryContext to use for this evaluation.config - The configuration settings for the execution.XmlExceptionpublic XmlResults execute(XmlValue contextItem, XmlQueryContext queryContext) throws XmlException
contextItem - The XmlValue object to perform the query against.queryContext - The XmlQueryContext to use for this evaluation.XmlExceptionpublic XmlResults execute(XmlValue contextItem, XmlQueryContext queryContext, XmlDocumentConfig config) throws XmlException
contextItem - The XmlValue object to perform the query against.queryContext - The XmlQueryContext to use for this evaluation.config - The configuration settings for the execution.XmlExceptionpublic XmlResults execute(XmlTransaction txn, XmlValue contextItem, XmlQueryContext queryContext) throws XmlException
XmlTransaction object.txn - If the operation is to be transaction-protected, the txn parameter is an XmlTransaction handle returned from
XmlManager.createTransaction().contextItem - The XmlValue object to perform the query against.queryContext - The XmlQueryContext to use for this evaluation.XmlExceptionpublic XmlResults execute(XmlTransaction txn, XmlValue contextItem, XmlQueryContext queryContext, XmlDocumentConfig config) throws XmlException
XmlTransaction object.txn - If the operation is to be transaction-protected, the txn parameter is an XmlTransaction handle returned from
XmlManager.createTransaction().contextItem - The XmlValue object to perform the query against.queryContext - The XmlQueryContext to use for this evaluation.config - The configuration settings for the execution.XmlExceptionpublic java.lang.String getQuery()
throws XmlException
XmlExceptionpublic java.lang.String getQueryPlan()
throws XmlException
XmlExceptionpublic boolean isUpdateExpression()
throws XmlException
XmlExceptionCopyright (c) 2004,2014 Oracle. All rights reserved.