Changes

Jump to navigation Jump to search
48 bytes removed ,  18:30, 1 December 2023
m
Text replacement - "<syntaxhighlight lang="xquery">" to "<pre lang='xquery'>"
Please note that the client module should always be used to address independent BaseX server instances. You can create deadlocks if you evaluate a query with a server instance, and if you are addressing the same server instance in your query. See the following example:
<syntaxhighlight pre lang="'xquery"'>
(: Retrieve documents from database :)
let $client-id := client:connect('localhost', 1984, 'admin', '...')
| '''Examples'''
|The following query creates a new database {{Code|TEST}} on a remote BaseX server:
<syntaxhighlight pre lang="'xquery"'>
client:connect('basex.server.org', 8080, 'admin', '...') !
client:execute(., 'create database TEST')
| '''Examples'''
|The following query sends a query on a local server instance, binds the integer {{Code|123}} to the variable {{Code|$n}} and returns {{Code|246}}:
<syntaxhighlight pre lang="'xquery"'>
let $c := client:connect('localhost', 1984, 'admin', '...')
return client:query($c, "declare variable $n external; $n * 2", map { 'n': 123 })
</syntaxhighlight>
The following query performs a query on a first server, the results of which are passed on to a second server:
<syntaxhighlight pre lang="'xquery"'>
let $c1 := client:connect('basex1.server.org', 8080, 'jack', 'C0S19tt2X')
let $c2 := client:connect('basex2.server.org', 8080, 'john', '465wFHe26')
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu