Changes

Jump to navigation Jump to search
9 bytes added ,  11:10, 25 July 2022
no edit summary
<syntaxhighlight lang="xquery">
(: Retrieve documents from database :)
let $client-id := client:connect('localhost', 1984, 'admin', 'adminpassword')
let $docs := client:query($client-id, 'db:get("conflict")')
(: Create database with same name :)
|The following query creates a new database {{Code|TEST}} on a remote BaseX server:
<syntaxhighlight lang="xquery">
client:connect('basex.server.org', 8080, 'admin', 'adminpassword') !
client:execute(., 'create database TEST')
</syntaxhighlight>
|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 lang="xquery">
let $c := client:connect('localhost', 1984, 'admin', 'adminpassword')
return client:query($c, "declare variable $n external; $n * 2", map { 'n': 123 })
</syntaxhighlight>
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu