Changes

Jump to navigation Jump to search
32 bytes added ,  17:48, 29 June 2016
no edit summary
Asynchronous query execution is recommendable if a client does not, or cannot, wait until a request is fully processed. This is e. g. the case with web browsers, which will usually cancel a request after a specific timeout. In such cases, you can use asynchronous execution to trigger another server-side process, which will start the time-consuming process, and fetch the result later on as soon as it is available.
==jobs:evalschedule==
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|jobs:evalschedule|$query as xs:string|xs:string}}<br />{{Func|jobs:evalschedule|$query as xs:string, $bindings as map(*)|xs:string}}<br />{{Func|jobs:evalschedule|$query as xs:string, $bindings as map(*), $options as map(xs:string, xs:string)|xs:string}}<br />
|-
| '''Summary'''
| '''Examples'''
|
* {{Code|jobs:evalschedule("1+3", map{}, map{ 'cache': true() })}} returns a query id, e.g. {{Code|Job-123}}. The result can be retrieved via a second query in the same BaseX context: {{Code|jobs:result("Job-123")}}<br />
* The following [[RESTXQ]] function will return the id of the query thread, which evaluates the query that has been specified in the body of a POST request:
<pre class='brush:xquery'>
declare %rest:POST("{$query}") %rest:path('/eval') function local:evalschedule($query) { jobs:evalschedule($query)
};
</pre>
* The following query demonstrates how the results of an asynchronously executed query can be returned in a single query. Please remember that this is not the common way how these functions are used in practice:
<pre class='brush:xquery'>
let $query := jobs:evalschedule('(1 to 10000000)[. = 1]')
return (
hof:until(
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu