public final class QueryContext extends Proc implements Closeable
Modifier and Type | Field and Description |
---|---|
TokenObjMap<Collation> |
collations
Available collations.
|
Context |
context
Database context.
|
Item |
date
Current Date.
|
Item |
dtm
Current DateTime.
|
int |
ftPos
Full-text token positions (needed for highlighting full-text results).
|
FTPosData |
ftPosData
Full-text position data (needed for highlighting full-text results).
|
FTLexer |
ftToken
Current full-text token.
|
StaticFuncs |
funcs
Functions.
|
Object |
http
HTTP context.
|
QueryInfo |
info
Query info.
|
int |
maxCalls
Maximum number of successive tail calls (will be set before compilation).
|
long |
nano
Current nanoseconds.
|
long |
pos
Current context position.
|
StringList |
readLocks
Strings to lock defined by lock:read option.
|
QueryResources |
resources
Query resources.
|
MainModule |
root
Root expression of the query.
|
boolean |
scoring
Scoring flag.
|
long |
size
Current context size.
|
QueryStack |
stack
The evaluation stack.
|
HashMap<String,IO> |
stop
Cached stop word files.
|
int |
tailCalls
Number of successive tail calls.
|
HashMap<String,IO> |
thes
Cached thesaurus files.
|
Item |
time
Current Time.
|
Value |
value
Current context value.
|
int |
varIDs
Counter for variable IDs.
|
Variables |
vars
Static variables.
|
StringList |
writeLocks
Strings to lock defined by lock:write option.
|
Item |
zone
Current timezone.
|
Constructor and Description |
---|
QueryContext(Context context)
Constructor.
|
QueryContext(QueryContext qcParent)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
bind(String name,
Object val,
String type,
StaticContext sc)
Binds a value to a global variable.
|
void |
bind(String name,
Value val,
StaticContext sc)
Binds a value to a global variable.
|
void |
close() |
void |
compile()
Compiles and optimizes the expression.
|
void |
compInfo(String string,
Object... ext)
Adds some compilation info.
|
void |
context(Object val,
String type,
StaticContext sc)
Binds the context value, using the same rules as for
binding variables . |
void |
context(Value val,
StaticContext sc)
Binds the context value.
|
Data |
data()
Returns the current data reference of the context value or
null . |
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.
|
void |
evalInfo(String string)
Adds some evaluation info.
|
FTOpt |
ftOpt()
Returns the current full-text options.
|
void |
ftOpt(FTOpt opt)
Sets full-text options.
|
Value |
get(Var var)
Gets the value currently bound to the given variable.
|
void |
http(Object val)
Binds the HTTP context.
|
String |
info()
Returns info on query compilation and evaluation.
|
QueryContext |
initDateTime()
Initializes the static date and time context of a query if not done yet.
|
Iter |
iter()
Returns a result iterator.
|
Iter |
iter(Expr expr)
Evaluates the specified expression and returns an iterator.
|
void |
mainModule(MainModule rt)
Sets the main module (root expression).
|
StaticScope |
parse(String query,
boolean library,
String path,
StaticContext sc)
Parses the specified query.
|
StaticScope |
parse(String query,
String path,
StaticContext sc)
Parses the specified query.
|
LibraryModule |
parseLibrary(String query,
String path,
StaticContext sc)
Parses the specified module.
|
MainModule |
parseMain(String query,
String path,
StaticContext sc)
Parses the specified query.
|
FElem |
plan()
Recursively builds a query plan.
|
Value[] |
pollTailArgs()
Returns and clears registered arguments of a tail-called function.
|
XQFunction |
pollTailCall()
Returns and clears the currently registered tail-call function.
|
double |
prog()
Returns a progress value (0 - 1).
|
void |
registerTailCall(XQFunction fn,
Value[] arg)
Registers a tail-called function and its arguments to this query context.
|
SerializerOptions |
serParams()
Returns the query-specific or global serialization parameters.
|
void |
set(Var vr,
Value vl,
InputInfo ii)
Binds an expression to a local variable.
|
String |
tit()
Returns short information on this process.
|
void |
updating()
Indicates that the query contains any updating expressions.
|
Value |
value(Expr expr)
Evaluates the specified expression and returns a value.
|
abort, checkStop, detail, listen, proc, progress, registered, registered, startTimeout, stop, stopTimeout, title
public final QueryStack stack
public final Variables vars
public final StaticFuncs funcs
public final QueryInfo info
public final Context context
public QueryResources resources
public Object http
public Value value
public long pos
public long size
public FTPosData ftPosData
public TokenObjMap<Collation> collations
public FTLexer ftToken
public int ftPos
public boolean scoring
public Item date
public Item dtm
public Item time
public Item zone
public long nano
public final StringList readLocks
public final StringList writeLocks
public int tailCalls
public int maxCalls
public int varIDs
public MainModule root
public QueryContext(QueryContext qcParent)
qcParent
- parent contextpublic QueryContext(Context context)
context
- database contextpublic StaticScope parse(String query, String path, StaticContext sc) throws QueryException
query
- query stringpath
- file path (may be null
)sc
- static contextQueryException
- query exceptionpublic StaticScope parse(String query, boolean library, String path, StaticContext sc) throws QueryException
query
- query stringlibrary
- library/main modulepath
- file path (may be null
)sc
- static contextQueryException
- query exceptionpublic MainModule parseMain(String query, String path, StaticContext sc) throws QueryException
query
- query stringpath
- file path (may be null
)sc
- static contextQueryException
- query exceptionpublic LibraryModule parseLibrary(String query, String path, StaticContext sc) throws QueryException
query
- query stringpath
- file path (may be null
)sc
- static contextQueryException
- query exceptionpublic void mainModule(MainModule rt)
rt
- main modulepublic void compile() throws QueryException
QueryException
- query exceptionpublic Iter iter() throws QueryException
QueryException
- query exceptionpublic Iter iter(Expr expr) throws QueryException
expr
- expression to be evaluatedQueryException
- query exceptionpublic Value value(Expr expr) throws QueryException
expr
- expression to be evaluatedQueryException
- query exceptionpublic Data data()
null
.public void databases(LockResult lr)
Proc
public void http(Object val)
val
- HTTP contextpublic void context(Object val, String type, StaticContext sc) throws QueryException
binding variables
.val
- value to be boundtype
- type (may be null
)sc
- static contextQueryException
- query exceptionpublic void context(Value val, StaticContext sc)
val
- value to be boundsc
- static contextpublic void bind(String name, Object val, String type, StaticContext sc) throws QueryException
"json"
is specified, the value is converted according to the rules
specified in JsonMapConverter
.Value
, it is directly assigned.
Otherwise, it is cast to the XQuery data model, using a Java/XQuery mapping.name
- name of variableval
- value to be boundtype
- type (may be null
)sc
- static contextQueryException
- query exceptionpublic void bind(String name, Value val, StaticContext sc) throws QueryException
name
- name of variableval
- value to be boundsc
- static contextQueryException
- query exceptionpublic void compInfo(String string, Object... ext)
string
- evaluation infoext
- text text extensionspublic void evalInfo(String string)
string
- evaluation infopublic String info()
public SerializerOptions serParams()
public FTOpt ftOpt()
public void ftOpt(FTOpt opt)
opt
- full-text optionspublic void updating()
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public String tit()
Proc
public String det()
Proc
public double prog()
Proc
public FElem plan()
public Value get(Var var)
var
- variablepublic void set(Var vr, Value vl, InputInfo ii) throws QueryException
vr
- variablevl
- expression to be boundii
- input infoQueryException
- exceptionpublic void registerTailCall(XQFunction fn, Value[] arg)
fn
- function to callarg
- arguments to pass to fn
public XQFunction pollTailCall()
null
otherwisepublic Value[] pollTailArgs()
null
otherwisepublic QueryContext initDateTime() throws QueryException
QueryException
- query exceptionCopyright © 2005–2015 BaseX Team. All rights reserved.