public final class QueryContext extends Job implements Closeable
Modifier and Type | Field and Description |
---|---|
TokenObjMap<Collation> |
collations
Available collations.
|
Context |
context
Database context.
|
MainModule |
ctxItem
Initial context value.
|
QueryDateTime |
dateTime
Current date/time values.
|
QueryFocus |
focus
Current context value.
|
FTLexer |
ftLexer
Current full-text lexer.
|
int |
ftPos
Full-text token positions (needed for highlighting full-text results).
|
FTPosData |
ftPosData
Full-text position data (needed for highlighting full-text results).
|
StaticFuncs |
funcs
Functions.
|
QueryInfo |
info
Query info.
|
LockList |
locks
User-defined locks.
|
int |
maxCalls
Maximum number of successive tail calls (will be set before compilation).
|
TokenMap |
modParsed
Parsed modules, containing the file path and module uri.
|
QueryContext |
parent
Parent query context.
|
QueryResources |
resources
Query resources.
|
MainModule |
root
Root expression of the query.
|
boolean |
scoring
Scoring flag.
|
QueryStack |
stack
The evaluation stack.
|
int |
tailCalls
Number of successive tail calls.
|
QueryThreads |
threads
Query threads.
|
Updates |
updates
Update container; will be created if the first update is evaluated.
|
int |
varIDs
Counter for variable IDs.
|
Variables |
vars
Static variables.
|
Constructor and Description |
---|
QueryContext(Context context)
Constructor.
|
QueryContext(QueryContext parent)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addLocks()
Adds the strings (databases, special identifiers) for which locks need to be acquired.
|
void |
bind(QNm name,
Value value)
Binds a value to a global variable.
|
void |
bind(String name,
Object value,
String type,
StaticContext sc)
Binds a value to a global variable.
|
void |
bind(String name,
Value value,
StaticContext sc)
Binds a value to a global variable.
|
void |
close() |
void |
compile()
Compiles and optimizes the expression.
|
void |
context(Object value,
String type,
StaticContext sc)
Binds the context value, using the same rules as for
binding variables . |
void |
context(Value value,
StaticContext sc)
Binds the context value.
|
QueryDateTime |
dateTime()
Initializes the static date and time context of a query if not done yet.
|
void |
evalInfo(String string)
Adds some evaluation info.
|
FTOpt |
ftOpt()
Returns the current full-text options.
|
void |
ftOpt(FTOpt opt)
Assigns full-text options.
|
Value |
get(Var var)
Gets the value currently bound to the given variable.
|
String |
info()
Returns info on query compilation and evaluation.
|
Iter |
iter()
Returns a result iterator.
|
void |
mainModule(MainModule rt)
Sets the main module (root expression).
|
Item |
next(Iter iter)
Checks if evaluation has been stopped and returns the next item of an iterator.
|
AModule |
parse(String query,
boolean library,
String uri)
Parses the specified query.
|
AModule |
parse(String query,
String uri)
Parses the specified query.
|
LibraryModule |
parseLibrary(String query,
String uri)
Parses the specified module.
|
MainModule |
parseMain(String query,
String uri)
Parses the specified query.
|
MainModule |
parseMain(String query,
String uri,
StaticContext sc)
Parses the specified query.
|
FElem |
plan(boolean full)
Creates and returns an XML query plan (expression tree) for this query.
|
Value[] |
pollTailArgs()
Returns and clears registered arguments of a tail-called function.
|
XQFunction |
pollTailCall()
Returns and clears the currently registered tail-call function.
|
void |
registerTailCall(XQFunction fn,
Value[] arg)
Registers a tail-called function and its arguments to this query context.
|
SerializerOptions |
serParams()
Returns query-specific or default serialization parameters.
|
void |
set(Var var,
Value value)
Binds an expression to a local variable.
|
String |
shortInfo()
Returns short progress information.
|
String |
toString() |
Updates |
updates()
Returns a reference to the updates container.
|
void |
updating()
Indicates that the query contains updating expressions.
|
Value |
value()
Returns the result.
|
active, checkStop, detailedInfo, jc, memory, popJob, progressInfo, pushJob, register, state, stop, stopped, timeout, unregister
public final QueryStack stack
public final Variables vars
public final StaticFuncs funcs
public final QueryContext parent
public final QueryInfo info
public final Context context
public QueryResources resources
public Updates updates
public final QueryThreads threads
public QueryFocus focus
public QueryDateTime dateTime
public FTPosData ftPosData
public FTLexer ftLexer
public int ftPos
public boolean scoring
public TokenObjMap<Collation> collations
public final LockList locks
public int tailCalls
public int maxCalls
public int varIDs
public final TokenMap modParsed
public MainModule ctxItem
public MainModule root
public QueryContext(QueryContext parent)
parent
- parent contextpublic QueryContext(Context context)
context
- database contextpublic AModule parse(String query, String uri) throws QueryException
query
- query stringuri
- base URI (may be null
)QueryException
- query exceptionpublic AModule parse(String query, boolean library, String uri) throws QueryException
query
- query stringlibrary
- library/main moduleuri
- base URI (may be null
)QueryException
- query exceptionpublic MainModule parseMain(String query, String uri) throws QueryException
query
- query stringuri
- base URI (may be null
)QueryException
- query exceptionpublic MainModule parseMain(String query, String uri, StaticContext sc) throws QueryException
query
- query stringuri
- base URI (may be null
)sc
- static context (may be null
)QueryException
- query exceptionpublic LibraryModule parseLibrary(String query, String uri) throws QueryException
query
- query stringuri
- base URI (may be null
)QueryException
- query exceptionpublic void mainModule(MainModule rt)
rt
- main modulepublic void compile() throws QueryException
QueryException
- query exceptionpublic Iter iter() throws QueryException
QueryException
- query exceptionpublic Value value() throws QueryException
QueryException
- query exceptionpublic Item next(Iter iter) throws QueryException
iter
- iteratornull
QueryException
- query exceptionpublic Updates updates()
public void addLocks()
Job
public void context(Object value, String type, StaticContext sc) throws QueryException
binding variables
.value
- value to be boundtype
- type (may be null
)sc
- static contextQueryException
- query exceptionpublic void context(Value value, StaticContext sc)
value
- value to be boundsc
- static contextpublic void bind(String name, Object value, String type, StaticContext sc) throws QueryException
"json"
is specified, the value is converted according to the rules
specified in JsonXQueryConverter
.Value
, it is directly assigned.
Otherwise, it is cast to the XQuery data model, using a Java/XQuery mapping.name
- name of variablevalue
- value to be boundtype
- type (may be null
)sc
- static contextQueryException
- query exceptionpublic void bind(String name, Value value, StaticContext sc) throws QueryException
name
- name of variablevalue
- value to be boundsc
- static contextQueryException
- query exceptionpublic void bind(QNm name, Value value)
name
- name of variablevalue
- value to be boundpublic void evalInfo(String string)
string
- evaluation infopublic String info()
public SerializerOptions serParams()
public FTOpt ftOpt()
public void ftOpt(FTOpt opt)
opt
- full-text optionspublic FElem plan(boolean full)
full
- include comprehensive informationpublic void updating()
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public String shortInfo()
Job
public Value get(Var var)
var
- variablepublic void set(Var var, Value value) throws QueryException
var
- variablevalue
- expression to be boundQueryException
- 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 QueryDateTime dateTime() throws QueryException
QueryException
- query exceptionCopyright © 2005–2023 BaseX Team. All rights reserved.