Changes

Jump to navigation Jump to search
110 bytes removed ,  13:33, 20 July 2022
m
Text replacement - "db:pre(" to "db:get("
<syntaxhighlight lang="xquery">
copy $c := (db:openget('example')//entry)[1]
...
</syntaxhighlight>
<syntaxhighlight lang="xquery">
for $item in db:openget('data')//item
return $item update {
delete node text()
<syntaxhighlight lang="xquery">
db:openget('data')//item update {
delete node text()
}
* '''Backups, Binary resources''': {{Function|Database|db:alter-backup}}, {{Function|Database|db:create-backup}}, {{Function|Database|db:put}}, {{Function|Database|db:put-binary}}
* '''XQuery Update''': {{Code|insert before}}, {{Code|delete}}, {{Code|replace}}, {{Code|rename}}, {{Code|replace value}}, {{Code|insert attribute}}, {{Code|insert into first}}, {{Code|insert into}}, {{Code|insert into last}}, {{Code|insert}}, {{Code|insert after}}, {{Code|fn:put}}
* '''Documents''': {{Function|Database|db:add}}, {{Function|Database|db:updateput}}, {{Function|Database|db:rename}}, {{Function|Database|db:delete}}, {{Function|Database|db:optimize}}, {{Function|Database|db:flush}},
* '''Users''': {{Function|User|user:grant}}, {{Function|User|user:password}}, {{Function|User|user:drop}}, {{Function|User|user:alter}}, {{Function|User|user:create}}
* '''Databases''': {{Function|Database|db:copy}}, {{Function|Database|db:drop}}, {{Function|Database|db:alter}}, {{Function|Database|db:create}}
By default, it is not possible to mix different types of expressions in a query result. The root expression of a query must be a sequence of updating expressions. But there are two ways out:
* The BaseX-specific <code>[[{{Function|Update Module#update:output|update:output()]]</code> }} function bridges this gap: it caches the results of its arguments at runtime and returns them after all updates have been processed. The following example performs an update and returns a success message:
<syntaxhighlight lang="xquery">
* Updates on main-memory instances of files that have been retrieved via {{Code|fn:doc}} or {{Code|fn:collection}} will be propagated back to disk if {{Option|WRITEBACK}} is turned on. This option can also be activated on [[Command-Line Options#BaseX Standalone|command line]] via <code>-u</code>. Make sure you back up the original documents before running your queries.
* Functions like <code>{{Function|Code|fn:put}}</code> or <code>[[{{Function|File Module#file:write|file:write]]</code> }} can be used to write single XML documents to disk. With <code>[[{{Function|File Module#file:write-binary|file:write-binary]]</code>}}, you can write binary resources.* The [[Commands#EXPORT{{Command|EXPORT]] }} command can be used write all resources of a databases to disk.
==Indexes==
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu