oracle.xml.xquery

## Interface OXQPreparedExpression

All Superinterfaces:
  OXQDynamicContext

    public interface OXQPreparedExpression
    extends OXQDynamicContext

Extensions to `javax.xml.xquery.XQPreparedExpression`.

Use method `OXQView.getPreparedExpression(XQPreparedExpression)` to access these extensions. For example:

     OXQDataSource ds = new OXQDataSource();
     XQConnection con = ds.getConnection();
     XQPreparedExpression expr = con.prepareExpression(query);
     OXQPreparedExpression oexpr = OXQView.getPreparedExpression(expr);
     ...

Since:
  12.1

### Field Summary

Fields
`static int` `CATEGORY_SIMPLE` Indicates that the expression category is simple.
`static int` `CATEGORY_UPDATING` Indicates that the expression category is updating.

### Method Summary

All Methods Instance Methods Abstract Methods
`boolean` `createsNewNodes()` Indicates whether the expression creates new nodes using XQuery node constructors.
`javax.xml.namespace.QName[]` `getAllUnboundAndUsedExternalVariables()` Retrieves the names of all unbound external variables that are also used within the query.
`int` `getExpressionCategory()` Returns the expression category.
`XQStaticContext` `getExpressionStaticContext()` Retrieves the static context of the expression's main module.
`XQPreparedExpression` `getXQView()` Returns the `XQPreparedExpression` instance corresponding to this instance.
`boolean` `isContextItemUnbound()` Indicates whether the context item is unbound.
`boolean` `isFunction()` Returns `true` if the expression is a function.

### Methods inherited from interface oracle.xml.xquery.OXQDynamicContext

`bindBigDecimal, bindBigInteger, bindBinary, bindCalendar, bindDocument, bindDuration, bindQName, getConnection, getDebugListener, getDefaultCollection, getDefaultResourceCollection, getPageManager, getUpdateMode, getUserExtension, setDebugListener, setDefaultCollection, setDefaultResourceCollection, setPageManager, setUpdateMode, setUserExtension, unbindAllExternalVariablesAndContextItem`

### Field Detail

#### CATEGORY_SIMPLE

    static final int CATEGORY_SIMPLE

Indicates that the expression category is simple.

See Also:
  `getExpressionCategory()`, Constant Field Values

#### CATEGORY_UPDATING

    static final int CATEGORY_UPDATING

Indicates that the expression category is updating.

See Also:
  `getExpressionCategory()`, Constant Field Values

### Method Detail

#### getXQView

    XQPreparedExpression getXQView()

Returns the `XQPreparedExpression` instance corresponding to this instance.

Specified by:
  `getXQView` in interface `OXQDynamicContext`
Returns:
  the expression

#### createsNewNodes

    boolean createsNewNodes()
                     throws XQException

Indicates whether the expression creates new nodes using XQuery node constructors.

Returns:
  `true` if the expression creates new nodes, `false` otherwise
Throws:
  `XQException` - if (1) the current expression is closed, (2) the method is not supported for this particular expression

#### isFunction

    boolean isFunction()
                throws XQException

Returns `true` if the expression is a function. In other words, returns `true` if the expression will return the same result given the same input (bindings).

Returns:
  `true` if the current expression is a function, `false` otherwise
Throws:
  `XQException` - if the current expression is closed

#### isContextItemUnbound

    boolean isContextItemUnbound()
                          throws XQException

Indicates whether the context item is unbound.

Returns:
  `true` if the context item is unbound, `false` otherwise
Throws:
  `XQException` - if (1) the current expression is closed, (2) the method is not supported for this particular expression

#### getExpressionCategory

    int getExpressionCategory()
                       throws XQException

Returns the expression category.

Returns:
  The expression category. Must be either `CATEGORY_SIMPLE` or `CATEGORY_UPDATING`
Throws:
  `XQException` - if (1) the current expression is closed, or (2) the method is not supported for this particular query

#### getAllUnboundAndUsedExternalVariables

    javax.xml.namespace.QName[] getAllUnboundAndUsedExternalVariables()
                                                               throws XQException

Retrieves the names of all unbound external variables that are also used within the query. The standard XQJ `XQPreparedExpression.getAllUnboundExternalVariables()` method returns all unbound external variables, even if they are not used in the query. This method is added to be able to retrieve only the used unbound external variables.

Returns:
  the names of all the external variables defined in the prolog of a prepared expression that are yet to be bound with a value, and that are used in the query. If there are no such variables an empty array is returned
Throws:
  `XQException` - if the prepared expression is in a closed state

#### getExpressionStaticContext

    XQStaticContext getExpressionStaticContext()
                                        throws XQException

Retrieves the static context of the expression's main module. The context exposes component values as overwritten or augmented by the prolog of the main module. This method is different than `XQPreparedExpression.getStaticContext()` which returns the starting context used to create the expression. Also, unlike the context returned from `getStaticContext()`, the module context may not be used to prepare another expression.

Returns:
  the static context of the main module
Throws:
  `XQException` - if the prepared expression is in a closed state

Copyright © 2003, 2019, Oracle and/or its affiliates. All rights reserved.
Use is subject to license terms. Also see the documentation redistribution policy.
ORACLE CONFIDENTIAL
For authorized use only.
Do not distribute to third parties.