|
Oracle® Database XML Java API Reference 12c Release 1 (12.1) E15981-09 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface OXQStaticContext
Extensions to javax.xml.xquery.XQStaticContext.
Use method OXQView.getStaticContext(XQStaticContext) to access these extensions. For example:
OXQDataSource ds = new OXQDataSource(); XQConnection con = ds.getConnection(); XQStaticContext ctx = con.getStaticContext(); OXQStaticContext octx = OXQView.getStaticContext(ctx); ...
XQStaticContext| Method Summary | |
|---|---|
void |
declareFunction(javax.xml.namespace.QName name, XQSequenceType[] parameterTypes, XQSequenceType returnType, OXQOptions options)Declares an external function. |
void |
declareImport(OXQEntityKind entityKind, java.lang.String namespace, java.lang.String... locations)Declares that a schema or module should be imported. |
void |
declareVariable(javax.xml.namespace.QName name, XQSequenceType type)Declares an external variable. |
int |
getBindingTypeCheckMode()Gets the type checking mode for external variable bindings. |
OXQEntityResolver |
getEntityResolver()Gets the OXQEntityResolver instance to be used during query processing. |
OXQFunctionMetaData[] |
getFunctions()Gets the definitions of all external functions declared in this context. |
java.lang.String[] |
getImportLocations(OXQEntityKind entityKind, java.lang.String namespace)Gets the locations of a schema or module import. |
java.lang.String[] |
getImportNamespaces(OXQEntityKind entityKind)Gets the target namespaces of all schema or module imports currently declared. |
java.lang.String |
getModuleURI()Gets the module URI, if set in the static context, else the empty string. |
int |
getProcessingMode()Gets the processing mode. |
javax.xml.namespace.QName[] |
getVariableNames()Gets the names of all external variables declared in this context. |
XQSequenceType |
getVariableType(javax.xml.namespace.QName name)Gets the type of an external variable declared in this context. |
XQStaticContext |
getXQView()Returns the XQStaticContext instance corresponding to this instance. |
void |
setBindingTypeCheckMode(int mode)Sets the type checking mode for external variable bindings. |
void |
setEntityResolver(OXQEntityResolver resolver)Sets an OXQEntityResolver instance to be used during query processing. |
void |
setModuleURI(java.lang.String moduleUri)Sets the module URI in the static context. |
void |
setProcessingMode(int mode)Sets the processing mode. |
void |
undeclareFunction(javax.xml.namespace.QName name, int parameterCount)Undeclares a previously declared external function. |
void |
undeclareVariable(javax.xml.namespace.QName name)Undeclares a previously declared external variable. |
| Method Detail |
|---|
XQStaticContext getXQView()
XQStaticContext instance corresponding to this instance.int getBindingTypeCheckMode()
OXQConstants.BINDING_TYPE_CHECK_MODE_PRIME or OXQConstants.BINDING_TYPE_CHECK_MODE_FULL
void setBindingTypeCheckMode(int mode)
throws XQException
OXQConstants.BINDING_TYPE_CHECK_MODE_PRIME, the XQuery processor assumes that the number of items bound to an external variable matches the type quantifier specified in the variable declaration and does not attempt to verify this assumption. By default, the processor will verify the type quantifier which can block streaming evaluation in some cases. declare variable $arg as element();
$arg[1]
Consider what happens if we bind (<a/>, <b/>) to this variable (a sequence of two elements). The binding mode is BINDING_TYPE_CHECK_MODE_FULL, this will result in a runtime error because "as element()" indicates there should be exactly 1 element bound to the variable. On the other hand, the binding mode is BINDING_TYPE_CHECK_MODE_PRIME, the XQuery processor will only ensure that the binding is an element but will not attempt to verify that there is exactly one element. The default value is OXQConstants.BINDING_TYPE_CHECK_MODE_FULL.
Note, the relaxed type checking behavior used in mode BINDING_TYPE_CHECK_MODE_PRIME does not conform to the XQuery 1.0 standard.
mode - the type checking mode. Must be either OXQConstants.BINDING_TYPE_CHECK_MODE_PRIME or OXQConstants.BINDING_TYPE_CHECK_MODE_FULLXQException - the specified mode is different from OXQConstants.BINDING_TYPE_CHECK_MODE_PRIME or OXQConstants.BINDING_TYPE_CHECK_MODE_FULLgetBindingTypeCheckMode()int getProcessingMode()
OXQConstants.PROCESSING_STATIC_ANALYSIS_ONLY to disable query optimization and plan generation. When in this mode, queries may not be executed. When the processing mode is OXQConstants.PROCESSING_FULL, queries may be prepared and executed. The default value is OXQConstants.PROCESSING_FULL.OXQConstants.PROCESSING_STATIC_ANALYSIS_ONLY or OXQConstants.PROCESSING_FULL
void setProcessingMode(int mode)
throws XQException
mode - the processing mode. Must be either OXQConstants.PROCESSING_STATIC_ANALYSIS_ONLY or OXQConstants.PROCESSING_FULLXQException - the specified mode is different from OXQConstants.PROCESSING_STATIC_ANALYSIS_ONLY or OXQConstants.PROCESSING_FULLgetProcessingMode()java.lang.String getModuleURI()
nullsetModuleURI(String)
void setModuleURI(java.lang.String moduleUri)
throws XQException
moduleUri is the empty string then the module URI setting will be cleared. The module URI will be used in error messages related to the main module. For example, by default a type error message in the main module might look something like the following:
line 10, column 11: XPTY0004: Invalid static type ...
"file:/myquery.xq", the error message would instead look something like:
file:/myquery.xq, line 10, column 11: XPTY0004: Invalid static type ...
moduleUri - the new moduleUri, or the empty string to make it undefined. Cannot be nullXQException - if a null module uri is specified, or given uri is not absoluteOXQEntityResolver getEntityResolver()
OXQEntityResolver instance to be used during query processing.void setEntityResolver(OXQEntityResolver resolver)
OXQEntityResolver instance to be used during query processing.resolver - the entity resolver to useOXQConnection.createEntityResolverFactory(Class), OXQEntityResolverFactory
void declareImport(OXQEntityKind entityKind,
java.lang.String namespace,
java.lang.String... locations)
throws XQException
entityKind - must be either OXQEntityKind.MODULE or OXQEntityKind.SCHEMAnamespace - the target namespace of the schema or modulelocations - the location hintsXQException - if namespace is null, or if any element of locations is null, or if entityKind is not OXQEntityKind.MODULE or OXQEntityKind.SCHEMAgetImportLocations(OXQEntityKind, String), getImportNamespaces(OXQEntityKind), XQuery Schema Import Feature, XQuery Module Import
java.lang.String[] getImportNamespaces(OXQEntityKind entityKind)
throws XQException
entityKind - must be either OXQEntityKind.MODULE or OXQEntityKind.SCHEMAnullXQException - if entityKind is not OXQEntityKind.MODULE or OXQEntityKind.SCHEMAdeclareImport(OXQEntityKind,String,String...), getImportLocations(OXQEntityKind,String)
java.lang.String[] getImportLocations(OXQEntityKind entityKind,
java.lang.String namespace)
throws XQException
entityKind - must be either OXQEntityKind.MODULE or OXQEntityKind.SCHEMAnamespace - the target namespace of the schema to get the location hints fornullXQException - if namespace is null or unknown or if entityKind is not OXQEntityKind.MODULE or OXQEntityKind.SCHEMAdeclareImport(OXQEntityKind,String,String...), getImportNamespaces(OXQEntityKind)
void declareVariable(javax.xml.namespace.QName name,
XQSequenceType type)
throws XQException
name - variable name. Cannot be nulltype - variable type. If null is specified then defaults to item()*XQException - if name is nulljavax.xml.namespace.QName[] getVariableNames()
null
XQSequenceType getVariableType(javax.xml.namespace.QName name)
throws XQException
name - The name of the variable. Cannot be nullnullXQException - if variable name is null or unknown
void undeclareVariable(javax.xml.namespace.QName name)
throws XQException
name - variable name. Cannot be nullXQException - if name is null, or the variable is unknown
void declareFunction(javax.xml.namespace.QName name,
XQSequenceType[] parameterTypes,
XQSequenceType returnType,
OXQOptions options)
throws XQException
name - function name. Cannot be nullparameterTypes - types of parameters. Cannot be nullreturnType - output type. If null is specified then defaults to item()*options - additional options. May be nullXQException - if function name is null or any of parameter types is nullOXQConnection.createOptions()OXQFunctionMetaData[] getFunctions()
null
void undeclareFunction(javax.xml.namespace.QName name,
int parameterCount)
throws XQException
name - function name. Cannot be nullparameterCount - number of parametersXQException - if name is null, or the function is unknown
|
Oracle® Database XML Java API Reference 12c Release 1 (12.1) E15981-09 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright © 2003, 2014, Oracle and/or its affiliates. All rights reserved.