Changes

Jump to navigation Jump to search
No change in size ,  21:18, 19 July 2022
no edit summary
* <code>db:add("DB", <a/>, "doc.xml")</code> adds a document node to the database {{Code|DB}} under the name {{Code|doc.xml}}.
* <code>db:add("DB", "/home/dir", "docs/dir", map { 'addcache': true() })</code> adds all documents in {{Code|/home/dir}} to the database {{Code|DB}} under the path {{Code|docs/dir}}. In order to reduce memory consumption, the files will be cached before being added to the database.
|}
 
==db:delete==
 
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|db:delete|$db as xs:string, $path as xs:string|empty-sequence()}}
|-
| '''Summary'''
|Deletes resource(s), specified by {{Code|$path}}, from the database {{Code|$db}}.
|-
| '''Errors'''
|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.<br/>{{Error|path|#Errors}} the specified path is invalid.
|-
| '''Examples'''
|
* {{Code|db:delete("DB", "docs/dir/doc.xml")}} deletes the resource {{Code|docs/dir/doc.xml}} from {{Code|DB}}.
* {{Code|db:delete("DB", "docs/dir")}} deletes all resources from {{Code|DB}} in the specified path {{Code|docs/dir}}.
|}
 
==db:copy==
 
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|db:copy|$db as xs:string, $name as xs:string|empty-sequence()}}
|-
| '''Summary'''
|Creates a copy of the database {{Code|$db}}, which will be called {{Code|$name}}.
|-
| '''Errors'''
|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.<br/>{{Error|lock|#Errors}} a database is opened by another process.<br/>{{Error|name|#Errors}} invalid database name.<br/>{{Error|conflict|#Errors}} the same database was addressed more than once.
|}
 
==db:alter==
 
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|db:alter|$db as xs:string, $name as xs:string|empty-sequence()}}
|-
| '''Summary'''
|Renames the database {{Code|$db}} to {{Code|$name}}.
|-
| '''Errors'''
|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.<br/>{{Error|lock|#Errors}} a database is opened by another process.<br/>{{Error|name|#Errors}} invalid database name.<br/>{{Error|conflict|#Errors}} the same database was addressed more than once.
|}
 
==db:optimize==
 
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|db:optimize|$db as xs:string|empty-sequence()}}<br/>{{Func|db:optimize|$db as xs:string, $all as xs:boolean|empty-sequence()}}<br/>{{Func|db:optimize|$db as xs:string, $all as xs:boolean, $options as map(*)?|empty-sequence()}}
|-
| '''Summary'''
|Optimizes the meta data and indexes of the database {{Code|$db}}.<br/>If {{Code|$all}} is {{Code|true}}, the complete database will be rebuilt.<br/>The {{Code|$options}} argument can be used to control indexing. The syntax is identical to the {{Function||db:create}} function: Allowed options are all [[Options#Indexing|indexing]] and [[Options#Full-Text|full-text]] options. {{Option|UPDINDEX}} is only supported if {{Code|$all}} is {{Code|true}}.
|-
| '''Errors'''
|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.
|-
| '''Examples'''
|
* {{Code|db:optimize("DB")}} optimizes the database structures of the database {{Code|DB}}.
* <code>db:optimize("DB", true(), map { 'ftindex': true() })</code> optimizes all database structures of the database {{Code|DB}} and creates a full-text index.
|}
 
==db:rename==
 
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|db:rename|$db as xs:string, $source as xs:string, $target as xs:string|empty-sequence()}}
|-
| '''Summary'''
|Moves all resources(s) of database {{Code|$db}}, which are found in the supplied {{Code|$source}} path, to the supplied {{Code|$target}} path. The paths may point to single resources or directories. No updates will take place if a non-existing source path is supplied.
|-
| '''Errors'''
|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.<br/>{{Error|path|#Errors}} the specified source or target path, or one of its descendants, is invalid.
|-
| '''Examples'''
|
* {{Code|db:rename("DB", "docs/dir/doc.xml", "docs/dir/newdoc.xml")}} renames the resource {{Code|docs/dir/doc.xml}} to {{Code|docs/dir/newdoc.xml}} in the database {{Code|DB}}.
* {{Code|db:rename("DB", "docs/dir", "docs/newdir")}} moves all resources in the database {{Code|DB}} from {{Code|docs/dir}} to {Code|docs/newdir}}.
|}
'cities'
)</syntaxhighlight>
|}
 
==db:delete==
 
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|db:delete|$db as xs:string, $path as xs:string|empty-sequence()}}
|-
| '''Summary'''
|Deletes resource(s), specified by {{Code|$path}}, from the database {{Code|$db}}.
|-
| '''Errors'''
|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.<br/>{{Error|path|#Errors}} the specified path is invalid.
|-
| '''Examples'''
|
* {{Code|db:delete("DB", "docs/dir/doc.xml")}} deletes the resource {{Code|docs/dir/doc.xml}} from {{Code|DB}}.
* {{Code|db:delete("DB", "docs/dir")}} deletes all resources from {{Code|DB}} in the specified path {{Code|docs/dir}}.
|}
 
==db:copy==
 
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|db:copy|$db as xs:string, $name as xs:string|empty-sequence()}}
|-
| '''Summary'''
|Creates a copy of the database {{Code|$db}}, which will be called {{Code|$name}}.
|-
| '''Errors'''
|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.<br/>{{Error|lock|#Errors}} a database is opened by another process.<br/>{{Error|name|#Errors}} invalid database name.<br/>{{Error|conflict|#Errors}} the same database was addressed more than once.
|}
 
==db:alter==
 
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|db:alter|$db as xs:string, $name as xs:string|empty-sequence()}}
|-
| '''Summary'''
|Renames the database {{Code|$db}} to {{Code|$name}}.
|-
| '''Errors'''
|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.<br/>{{Error|lock|#Errors}} a database is opened by another process.<br/>{{Error|name|#Errors}} invalid database name.<br/>{{Error|conflict|#Errors}} the same database was addressed more than once.
|}
 
==db:optimize==
 
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|db:optimize|$db as xs:string|empty-sequence()}}<br/>{{Func|db:optimize|$db as xs:string, $all as xs:boolean|empty-sequence()}}<br/>{{Func|db:optimize|$db as xs:string, $all as xs:boolean, $options as map(*)?|empty-sequence()}}
|-
| '''Summary'''
|Optimizes the meta data and indexes of the database {{Code|$db}}.<br/>If {{Code|$all}} is {{Code|true}}, the complete database will be rebuilt.<br/>The {{Code|$options}} argument can be used to control indexing. The syntax is identical to the {{Function||db:create}} function: Allowed options are all [[Options#Indexing|indexing]] and [[Options#Full-Text|full-text]] options. {{Option|UPDINDEX}} is only supported if {{Code|$all}} is {{Code|true}}.
|-
| '''Errors'''
|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.
|-
| '''Examples'''
|
* {{Code|db:optimize("DB")}} optimizes the database structures of the database {{Code|DB}}.
* <code>db:optimize("DB", true(), map { 'ftindex': true() })</code> optimizes all database structures of the database {{Code|DB}} and creates a full-text index.
|}
 
==db:rename==
 
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|db:rename|$db as xs:string, $source as xs:string, $target as xs:string|empty-sequence()}}
|-
| '''Summary'''
|Moves all resources(s) of database {{Code|$db}}, which are found in the supplied {{Code|$source}} path, to the supplied {{Code|$target}} path. The paths may point to single resources or directories. No updates will take place if a non-existing source path is supplied.
|-
| '''Errors'''
|{{Error|open|#Errors}} the addressed database does not exist or could not be opened.<br/>{{Error|path|#Errors}} the specified source or target path, or one of its descendants, is invalid.
|-
| '''Examples'''
|
* {{Code|db:rename("DB", "docs/dir/doc.xml", "docs/dir/newdoc.xml")}} renames the resource {{Code|docs/dir/doc.xml}} to {{Code|docs/dir/newdoc.xml}} in the database {{Code|DB}}.
* {{Code|db:rename("DB", "docs/dir", "docs/newdir")}} moves all resources in the database {{Code|DB}} from {{Code|docs/dir}} to {Code|docs/newdir}}.
|}
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu