public final class QueryProcessor extends Proc implements Closeable
Modifier and Type | Field and Description |
---|---|
QueryContext |
qc
Expression context.
|
StaticContext |
sc
Static context.
|
Constructor and Description |
---|
QueryProcessor(String query,
Context ctx)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
QueryProcessor |
bind(String name,
Object value)
Binds a value to a global variable.
|
QueryProcessor |
bind(String name,
Object value,
String type)
Binds a value with the specified type to a global variable.
|
QueryProcessor |
bind(String name,
Value value)
Binds an XQuery value to a global variable.
|
static HashMap<String,String> |
bindings(MainOptions opts)
Returns a map with variable bindings.
|
void |
close() |
void |
compile()
Compiles the query.
|
QueryProcessor |
context(Object value)
Binds the context value.
|
QueryProcessor |
context(Object value,
String type)
Binds the context value with a specified type,
using the same rules as for
binding variables . |
QueryProcessor |
context(Value value)
Binds the context value.
|
void |
databases(LockResult lr)
Adds the names of the databases that may be touched by the process.
|
String |
det()
Returns short information on this process.
|
Result |
execute()
Evaluates the specified query and returns the result.
|
Serializer |
getSerializer(OutputStream os)
Returns a serializer for the given output stream.
|
QueryProcessor |
http(Object value)
Binds the HTTP context to the query processor.
|
String |
info()
Returns query information.
|
static boolean |
isLibrary(String qu)
Checks if the specified XQuery string is a library module.
|
Iter |
iter()
Returns a result iterator.
|
void |
module(String uri,
String file)
Adds a module reference.
|
QueryProcessor |
namespace(String prefix,
String uri)
Declares a namespace.
|
void |
parse()
Parses the query.
|
FDoc |
plan()
Returns a tree representation of the query plan.
|
String |
query()
Returns the query string.
|
static String |
removeComments(String qu,
int max)
Removes comments from the specified string and returns the first characters
of a query.
|
String |
tit()
Returns short information on this process.
|
String |
toString() |
int |
updates()
Returns the number of performed updates after query execution, or
0 . |
Value |
value()
Returns a result value.
|
abort, checkStop, detail, listen, proc, prog, progress, registered, registered, startTimeout, stop, stopTimeout, title
public final StaticContext sc
public final QueryContext qc
public void parse() throws QueryException
QueryException
- query exceptionpublic void compile() throws QueryException
QueryException
- query exceptionpublic Iter iter() throws QueryException
QueryException
- query exceptionpublic Value value() throws QueryException
QueryException
- query exceptionpublic Result execute() throws QueryException
QueryException
- query exceptionpublic QueryProcessor bind(String name, Object value, String type) throws QueryException
Expr
instance, it is directly assigned.
Otherwise, it is first cast to the appropriate XQuery type. If "json"
is specified as type, the value is interpreted according to the rules
specified in JsonMapConverter
.name
- name of variablevalue
- value to be boundtype
- type (may be null
)QueryException
- query exceptionpublic QueryProcessor bind(String name, Object value) throws QueryException
name
- name of variablevalue
- value to be boundQueryException
- query exceptionpublic QueryProcessor bind(String name, Value value) throws QueryException
name
- name of variablevalue
- value to be boundQueryException
- query exceptionpublic QueryProcessor context(Object value) throws QueryException
value
- value to be boundQueryException
- query exceptionpublic QueryProcessor context(Value value)
value
- XQuery value to be boundpublic QueryProcessor http(Object value)
value
- HTTP contextpublic QueryProcessor context(Object value, String type) throws QueryException
binding variables
.value
- value to be boundtype
- type (may be null
)QueryException
- query exceptionpublic QueryProcessor namespace(String prefix, String uri) throws QueryException
uri
is an empty string.
The default element namespaces is set if the prefix
is empty.prefix
- namespace prefixuri
- namespace uriQueryException
- query exceptionpublic Serializer getSerializer(OutputStream os) throws IOException, QueryException
os
- output streamIOException
- query exceptionQueryException
- query exceptionpublic void module(String uri, String file)
uri
- module urifile
- file namepublic String query()
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public void databases(LockResult lr)
Proc
public int updates()
0
.public String info()
public static boolean isLibrary(String qu)
qu
- query stringpublic static String removeComments(String qu, int max)
qu
- query stringmax
- maximum length of string to returnpublic static HashMap<String,String> bindings(MainOptions opts)
opts
- main optionspublic FDoc plan()
public String tit()
Proc
public String det()
Proc
Copyright © 2005–2015 BaseX Team. All rights reserved.