basex.query
bind
(bind query name value)
(bind query name value type)
Bind a particular value (and optionally a type) to a named variable in the
context of the query
close
(close query)
Closes and unregisters the query
context
(context query value)
(context query value type)
Bind a value (and optionally type) to the global context of the query
create-query
(create-query session query)
execute
(execute query)
Execute the query as a single batch and return the result as a
single string. Similar to the `session/execute` function.
info
(info query)
Returns info/status about the query
more?
(more? query)
Returns an indication if there are any more items left in the queries
result set
next
(next query)
Returns the next result in the result set. If we are past the end of
the results nil will simply be returned. This is a stepped alternative
to the execute method.
options
(options query)
Returns a string with all query serialization parameters.
results
(results query)
A more Clojure-y way to walk the result set of the executed query.
Lazily executes the `next` function on the query until the query
returns nil. This does not rely on the `more?` method.
with-query
macro
(with-query bindings & body)
Simple macro that allows clean handling of queries. Wraps statements in a
try block that will attempt to close the query in the finally block.
Bindings should start with the query declaration but contain as many
declarations as you need
(with-query [query (create-query session query-str)]
(println (basex.query/execute query)))
In the case above the query binding will be available for use in the body
of the form. The query will be closed when the form completes