Package org.basex.api.client
Class Query
java.lang.Object
org.basex.api.client.Query
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
ClientQuery,LocalQuery
This class defines methods for evaluating queries.
It is implemented by ClientQuery and LocalQuery.
Results are either returned as string or serialized to the output
stream that has been specified via the constructor or via
Session.setOutputStream(OutputStream).
- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected TokenListCached results.protected OutputStreamClient output stream. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidBinds a value to an external variable.abstract voidBinds a value with an optional type to an external variable.abstract voidcache(boolean full) Caches the query result.final voidBinds a value to the context value.abstract voidBinds a value with an optional type to an external variable.abstract Stringexecute()Returns the complete result of the query.abstract Stringinfo()Returns query info.booleanmore()Returnstrueif more items are available.final Stringnext()Returns the next item of the query as string.abstract Stringoptions()Returns the serialization options.final Typetype()Returns the XQuery type of the current item (must be called afternext().abstract booleanupdating()Returnstrueif the query may perform updates.
-
Field Details
-
out
Client output stream. -
cache
Cached results.
-
-
Constructor Details
-
Query
public Query()
-
-
Method Details
-
bind
Binds a value to an external variable.- Parameters:
name- name of variablevalue- value to be bound- Throws:
IOException- I/O exception
-
bind
Binds a value with an optional type to an external variable.- Parameters:
name- name of variablevalue- value to be boundtype- value type (may benull)- Throws:
IOException- I/O exception
-
context
Binds a value to the context value.- Parameters:
value- value to be bound- Throws:
IOException- I/O exception
-
context
Binds a value with an optional type to an external variable.- Parameters:
value- value to be boundtype- value type (may benull)- Throws:
IOException- I/O exception
-
more
Returnstrueif more items are available.- Returns:
- result of check
- Throws:
IOException- I/O exception
-
cache
Caches the query result.- Parameters:
full- retrieve full type information- Throws:
IOException- I/O exception
-
next
Returns the next item of the query as string.- Returns:
- string or
null - Throws:
IOException- I/O exception
-
type
Returns the XQuery type of the current item (must be called afternext().- Returns:
- item type
-
execute
Returns the complete result of the query.- Returns:
- item string or
null - Throws:
IOException- I/O exception
-
options
Returns the serialization options.- Returns:
- serialization options
- Throws:
IOException- I/O exception
-
updating
Returnstrueif the query may perform updates.- Returns:
- updating flag
- Throws:
IOException- I/O exception
-
info
Returns query info.- Returns:
- query info
- Throws:
IOException- I/O exception
-