public abstract class Query extends Object implements Closeable
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)
.
Modifier and Type | Field and Description |
---|---|
protected TokenList |
cache
Cached results.
|
protected OutputStream |
out
Client output stream.
|
Constructor and Description |
---|
Query() |
Modifier and Type | Method and Description |
---|---|
void |
bind(String name,
Object value)
Binds a value to an external variable.
|
abstract void |
bind(String name,
Object value,
String type)
Binds a value with an optional type to an external variable.
|
protected abstract void |
cache()
Caches the query result.
|
void |
context(Object value)
Binds a value to the context value.
|
abstract void |
context(Object value,
String type)
Binds a value with an optional type to an external variable.
|
abstract String |
execute()
Returns the complete result of the query.
|
abstract String |
info()
Returns query info.
|
boolean |
more()
Returns
true if more items are available. |
String |
next()
Returns the next item of the query.
|
abstract String |
options()
Returns the serialization options.
|
Type |
type()
Returns the XQuery type of the current item (must be called after
next() . |
abstract boolean |
updating()
Returns
true if the query may perform updates. |
protected OutputStream out
protected TokenList cache
public final void bind(String name, Object value) throws IOException
name
- name of variablevalue
- value to be boundIOException
- I/O exceptionpublic abstract void bind(String name, Object value, String type) throws IOException
name
- name of variablevalue
- value to be boundtype
- value type (may be null
)IOException
- I/O exceptionpublic final void context(Object value) throws IOException
value
- value to be boundIOException
- I/O exceptionpublic abstract void context(Object value, String type) throws IOException
value
- value to be boundtype
- value type (may be null
)IOException
- I/O exceptionpublic boolean more() throws IOException
true
if more items are available.IOException
- I/O exceptionprotected abstract void cache() throws IOException
IOException
- I/O exceptionpublic final String next() throws IOException
null
IOException
- I/O exceptionpublic final Type type()
next()
.public abstract String execute() throws IOException
null
IOException
- I/O exceptionpublic abstract String options() throws IOException
IOException
- I/O exceptionpublic abstract boolean updating() throws IOException
true
if the query may perform updates.IOException
- I/O exceptionpublic abstract String info() throws IOException
IOException
- I/O exceptionCopyright © 2005–2015 BaseX Team. All rights reserved.