public final class QueryProcessor extends Progress
| Modifier and Type | Field and Description |
|---|---|
QueryContext |
ctx
Expression context.
|
| Constructor and Description |
|---|
QueryProcessor(java.lang.String qu,
Context cx)
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
QueryProcessor |
bind(java.lang.String name,
java.lang.Object value)
Binds a value to a global variable.
|
QueryProcessor |
bind(java.lang.String name,
java.lang.Object value,
java.lang.String type)
Binds a value with the specified data type to a global variable.
|
void |
close()
Closes the processor.
|
void |
compile()
Compiles the query.
|
QueryProcessor |
context(Nodes nodes)
Binds an initial nodeset to the context item.
|
QueryProcessor |
context(java.lang.Object value)
Binds a value to the context item.
|
QueryProcessor |
context(java.lang.Object value,
java.lang.String type)
Binds a value with the specified data type to the context item,
using the same rules as for
binding variables. |
java.lang.String |
det()
Returns short information on this process.
|
Result |
execute()
Evaluates the specified query and returns the result.
|
Serializer |
getSerializer(java.io.OutputStream os)
Returns a serializer for the given output stream.
|
java.lang.String |
info()
Returns query background information.
|
Iter |
iter()
Returns a result iterator.
|
void |
module(java.lang.String uri,
java.lang.String file)
Adds a module reference.
|
QueryProcessor |
namespace(java.lang.String prefix,
java.lang.String uri)
Declares a namespace.
|
void |
parse()
Parses the query.
|
void |
plan(Serializer ser)
Returns the query plan in the dot notation.
|
java.lang.String |
query()
Returns the query string.
|
void |
query(java.lang.String qu)
Sets a new query.
|
Nodes |
queryNodes()
Evaluates the specified query and returns the result nodes.
|
static java.lang.String |
removeComments(java.lang.String qu,
int max)
Removes comments from the specified string.
|
java.lang.String |
tit()
Returns short information on this process.
|
int |
updates()
Returns the number of performed updates after query execution, or
0. |
Value |
value()
Returns a result value.
|
public final QueryContext ctx
public QueryProcessor(java.lang.String qu,
Context cx)
qu - query to processcx - database contextpublic 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(java.lang.String name, java.lang.Object value, java.lang.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 data type, the value is interpreted according to the rules
specified in JsonMapConverter.name - name of variablevalue - value to be boundtype - data type (may be null)QueryException - query exceptionpublic QueryProcessor bind(java.lang.String name, java.lang.Object value) throws QueryException
name - name of variablevalue - value to be boundQueryException - query exceptionpublic QueryProcessor context(java.lang.Object value) throws QueryException
value - value to be boundQueryException - query exceptionpublic QueryProcessor context(java.lang.Object value, java.lang.String type) throws QueryException
binding variables.value - value to be boundtype - data type (may be null)QueryException - query exceptionpublic QueryProcessor context(Nodes nodes)
nodes - node setpublic QueryProcessor namespace(java.lang.String prefix, java.lang.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(java.io.OutputStream os) throws java.io.IOException, QueryException
os - output streamjava.io.IOException - query exceptionQueryException - query exceptionpublic Nodes queryNodes() throws QueryException
QueryException - query exceptionpublic void module(java.lang.String uri,
java.lang.String file)
uri - module urifile - file namepublic void query(java.lang.String qu)
qu - querypublic java.lang.String query()
public void close()
throws QueryException
QueryException - query exceptionpublic int updates()
0.public java.lang.String info()
public static java.lang.String removeComments(java.lang.String qu,
int max)
qu - query stringmax - maximum string lengthpublic void plan(Serializer ser) throws java.io.IOException
ser - serializerjava.io.IOException - I/O exceptionpublic java.lang.String tit()
Progress