Changes

Jump to navigation Jump to search
473 bytes added ,  13:17, 17 June 2022
==OPEN==
{{MarkAnnounce|Updated with Version 10:}} {{Code|path}} argument dropped.
{| width='100%'
| '''Errors'''
|The command fails if the database files could not be closed for some reason.
|}
 
==LIST==
 
{| width='100%'
|-
|width='130'|'''Syntax'''
|{{Code|LIST ([name] ([path]))}}
|-
| '''XML Syntax'''   
|<code><list (name='...' (path='...'))/></code><br/>
|-
| '''Permission'''
|''NONE''
|-
| '''Summary'''
|Lists all available databases. If {{Code|name}} is specified, the resources of a database are listed. The output can be further restricted to the resources matching the specified {{Code|path}}.<br/>If database resources are listed, the size is either the number of nodes (for XML resources) or the number of bytes (for binary resources).
 
|-
| '''Errors'''
|The command fails if the optional database cannot be opened, or if the existing databases cannot be listed for some other reason.
|}
==CREATE INDEX==
 
{{Mark|Updated with Version 8.4:}} Token index added.
{| width='100%'
==ALTER DB==
 
{{Mark|Updated with BaseX 9.7:}} Overwrite existing databases.
{| width='100%'
==COPY==
 
{{Mark|Updated with BaseX 9.7:}} Overwrite existing databases.
{| width='100%'
|}
=Administration=INSPECT== {| width='100%'|-|width='130'|'''Syntax'''|{{Code|INSPECT}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><inspect/></code>|-| '''Permission'''|''READ''|-| '''Summary'''|Performs some integrity checks on the opened database and returns a brief summary.|} =Backups= {{Announce|Introduced with Version 10:}} Support for general data ([[User Management|registered users]], [[Jobs Module#Services|scheduled services]] and [[Store Module|key-value stores]]).
==CREATE BACKUP==
{{MarkAnnounce|Updated with Version 10:}} Support for comments.
{| width='100%'
|-
|width='130'|'''Syntax'''
|{{Code|CREATE BACKUP ([name] ([comment]))}}
|-
| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;
|<code><create-backup (name='...' ) (comment='...')/></code><br/>
|-
| '''Permission'''
|-
| '''Summary'''
|Creates a zipped backup of the database specified by {{Code|name}} and , with an optional {{Code|comment}}. If no name is supplied, general data will be backed up. The backup file will be suffixed with the current timestamp and stored in the database directory. The [[#Glob Syntax|Glob Syntax]] can be used to address more than one database.
|-
| '''Errors'''
|-
|width='130'|'''Syntax'''
|{{Code|DROP BACKUP ([name])}}
|-
| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;
|<code><drop-backup (name='...')/></code><br/>
|-
| '''Permission'''
|-
| '''Summary'''
|Drops all backups of the database with the specified {{Code|name}}, or a specific backup file if the name ends with a dateits timestamp. If no name is supplied, backups with general data are addressed. The [[#Glob Syntax|Glob Syntax]] can be used to address more than one database.
|-
| '''Examples'''
|-
| '''Summary'''
|Renames all backups of the database with the specified {{Code|name}} to {{Code|new-namenewname}}. If the name ends with a datetimestamp, only the specified backup file will be renamed. The [[#Glob Syntax|Glob Syntax]] can be used to address more than one database.
|-
| '''Examples'''
|
* {{Code|ALTER BACKUP logs logs-backup}}<br/>renames the backups of the {{Code|logs}} database to {{Code|logs-backup}}.
|}
 
==SHOW BACKUPS==
 
{| width='100%'
|-
|width='130'|'''Syntax'''
|{{Code|SHOW BACKUPS}}
|-
| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;
|<code><show-backups/></code><br/>
|-
| '''Permission'''
|''CREATE''
|-
| '''Summary'''
|Shows all database backups.
|}
|-
|width='130'|'''Syntax'''
|{{Code|RESTORE ([name])}}
|-
| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;
|<code><restore (name='...')/></code><br/>
|-
| '''Permission'''
|-
| '''Summary'''
|Restores a database with the specified {{Code|name}}. The name may include the timestamp of the backup file. If no name is supplied, general data will be restored. If general data is restored, it will only be available after BaseX has been restarted.
|-
| '''Errors'''
|}
==INSPECTSHOW BACKUPS==
{| width='100%'
|-
|width='130'|'''Syntax'''
|{{Code|INSPECTSHOW BACKUPS}}
|-
| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;
|<code><inspectshow-backups/></code><br/>
|-
| '''Permission'''
|''READCREATE''
|-
| '''Summary'''
|Performs some integrity checks on the opened database and returns a brief summary.|} ==INFO DB== {| width='100%'|-|width='130'|'''Syntax'''|{{Code|INFO DB}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><info-db/></code><br/>|-| '''Permission'''|''READ''|-| '''Summary'''|Shows general information and meta data on the currently opened database.|-| '''Errors'''|The command fails if no database is opened.|} ==INFO INDEX== {| width='100%'|-|width='130'|'''Syntax'''|{{Code|INFO INDEX ([ELEMNAME&#x7c;ATTRNAME&#x7c;PATH&#x7c;TEXT&#x7c;ATTRIBUTE&#x7c;TOKEN&#x7c;FULLTEXT])}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><info-index type='elemname&#x7c;attrname&#x7c;path&#x7c;text&#x7c;attribute&#x7c;token&#x7c;fulltext'/></code><br/>|-| '''Permission'''|''READ''|-| '''Summary'''|Shows information on the existing [[Indexes|index]] structures. The output can be optionally limited to the specified index.|-| '''Errors'''|The command fails if no database is opened, or if the specified index is unknown.|} ==INFO STORAGE== {| width='100%'|-|width='130'|'''Syntax'''|{{Code|INFO STORAGE [start end]}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><info-storage (start='...') (end='...')/></code><br/>|-| '''Permission'''|''READ''|-| '''Summary'''|Shows the internal main table of the currently opened database. An integer range may be specified as argument.|-| '''Errors'''|The command fails if no all database is opened, or if one of the specified arguments is invalidbackups.
|}
= Querying =
 
==LIST==
 
{| width='100%'
|-
|width='130'|'''Syntax'''
|{{Code|LIST ([name] ([path]))}}
|-
| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;
|<code><list (name='...' (path='...'))/></code><br/>
|-
| '''Permission'''
|''NONE''
|-
| '''Summary'''
|Lists all available databases. If {{Code|name}} is specified, the resources of a database are listed. The output can be further restricted to the resources matching the specified {{Code|path}}.<br/>If database resources are listed, the size is either the number of nodes (for XML resources) or the number of bytes (for binary resources).
 
|-
| '''Errors'''
|The command fails if the optional database cannot be opened, or if the existing databases cannot be listed for some other reason.
|}
==XQUERY==
|}
=MonitoringUser Management=
==SHOW SESSIONSCREATE USER==
{| width='100%'
|-
|width='130'|'''Syntax'''
|{{Code|SHOW SESSIONSCREATE USER [name] ([password])}}
|-
| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;
|<code><showcreate-sessionsuser name='...'>([password])</create-user></code><br/>
|-
| '''Permission'''
|-
| '''Summary'''
|Shows all sessions that are connected to Creates a user with the current server instancespecified {{Code|name}} and {{Code|password}}. If no password is specified, it is requested via the chosen frontend (GUI or bash).|-| '''Errors'''|The command fails if the specified user already exists.
|}
==SHOW USERSALTER USER==
{| width='100%'
|-
|width='130'|'''Syntax'''
|{{Code|SHOW USERS ALTER USER [name] (ON [databasenewname])}}
|-
| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;
|<code><showalter-users (databaseuser name='...' newname='...')/></code><br/>
|-
| '''Permission'''
|-
| '''Summary'''
|Shows all users that are visible to Renames the current user. If a with the specified {{Code|databasename}} to {{Code|newname}} is specified, only those users will be shown for which a pattern was specified that matches the database name.
|-
| '''Errors'''
|The command fails if the optional database could specified user does not be openedexist, or if the new user already exists.
|}
==KILLALTER PASSWORD==
{| width='100%'
|-
|width='130'|'''Syntax'''
|{{Code|KILL ALTER PASSWORD [targetname]([password])}}
|-
| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;
|<code><kill targetalter-password name='...'>([password])</alter-password></code><br/>
|-
| '''Permission'''
|-
| '''Summary'''
|Kills sessions Alters the {{Code|password}} of a the user or an IP:port combination, with the specified by {{Code|targetname}}. The [[#Glob Syntax|Glob Syntax]] can be used to address more than one userIf no password is specified, it is requested via the chosen frontend (GUI or bash).
|-
| '''Errors'''
|The command fails if a the specified user tried to kill his/her own sessiondoes not exist.
|}
==JOBS LISTDROP USER==
{| width='100%'
|-
|width='130'|'''Syntax'''
|{{Code|JOBS LISTDROP USER [name] (ON [pattern])}}:
|-
| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;
|<code><jobsdrop-listuser name='...' (pattern='...')/></code><br/>
|-
| '''Permission'''
|-
| '''Summary'''
|Returns information on all jobs that are currently queued Drops the user with the specified {{Code|name}}. The [[#Glob Syntax|Glob Syntax]] can be used to address more than one database or executeduser. See If a glob {{FunctionCode|Jobspattern}} is specified, only the assigned database pattern will be removed.|jobs:list-details| '''Errors'''|The command fails if {{Code|admin}} for more details on is specified as user name, or if the returned table entriesspecified user does not exist or is currently logged in.
|}
==JOBS RESULTGRANT==
{| width='100%'
|-
|width='130'|'''Syntax'''
|{{Code|JOBS RESULT GRANT [idNONE&#x7c;READ&#x7c;WRITE&#x7c;CREATE&#x7c;ADMIN] (ON [pattern]) TO [user]}}
|-
| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;
|<code><jobs-result idgrant name='...'permission='none&#x7c;read&#x7c;write&#x7c;create&#x7c;admin' (pattern='...')/></code><br/>
|-
| '''Permission'''
|-
| '''Summary'''
|Returns Grants the cached result of a query with specified [[User_Management|permission]] to the specified job id:* Results {{Code|user}}. The [[#Glob Syntax|Glob Syntax]] can only be retrieved onceused to address more than one user. After retrieval, the cached result will be dropped.* If the original query has raised an errora glob {{Code|pattern}} is specified, the cached error permission will be raised insteadapplied to all databases that match this pattern.
|-
| '''Errors'''
|The command fails if the addressed job {{Code|admin}} is still running specified as user name or if the result has already been retrievedspecified user does not exist.|-| '''Examples'''|* {{Code|GRANT READ TO JoeWinson}}<br/>grants {{Code|READ}} permission to the user {{Code|JoeWinson}}.* {{Code|GRANT WRITE ON Wiki TO editor*}}<br/>grants {{Code|WRITE}} permissions on the {{Code|Wiki}} database to all users starting with the characters {{Code|editor*}}.|} ==PASSWORD== {| width='100%'|-|width='130'|'''Syntax'''|{{Code|PASSWORD ([password])}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><password>([password])</password></code><br/>|-| '''Permission'''|''NONE''|-| '''Summary'''|Changes the {{Code|password}} of the current user. If no password is specified, it is requested via the chosen frontend (GUI or bash).
|}
=Administration=JOBS STOP ==SHOW SESSIONS==
{| width='100%'
|-
|width='130'|'''Syntax'''
|{{Code|JOBS STOP [id]SHOW SESSIONS}}
|-
| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;
|<code><jobsshow-stop id='...'sessions/></code><br/>
|-
| '''Permission'''
|-
| '''Summary'''
|Cancels the execution of a job with the specified id, or drops the cached result of a query. Unknown ids are ignored. All jobs Shows all sessions that are gracefully stopped; it is up connected to the process to decide when it is safe to shut downcurrent server instance.
|}
=User Management=SHOW USERS== {| width='100%'|-|width='130'|'''Syntax'''|{{Code|SHOW USERS (ON [database])}}|-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><show-users (database='...')/></code><br/>|-| '''Permission'''|''ADMIN''|-| '''Summary'''|Shows all users that are visible to the current user. If a {{Code|database}} is specified, only those users will be shown for which a pattern was specified that matches the database name.|-| '''Errors'''|The command fails if the optional database could not be opened.|}
==CREATE USERKILL==
{| width='100%'
|-
|width='130'|'''Syntax'''
|{{Code|CREATE USER KILL [nametarget] ([password])}}
|-
| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;
|<code><create-user namekill target='...'>([password])</create-user></code><br/>
|-
| '''Permission'''
|-
| '''Summary'''
|Creates Kills sessions of a user with the or an IP:port combination, specified by {{Code|nametarget}} and {{Code. The [[#Glob Syntax|password}}. If no password is specified, it is requested via the chosen frontend (GUI or bash)Glob Syntax]] can be used to address more than one user.
|-
| '''Errors'''
|The command fails if the specified a user already existstried to kill his/her own session.
|}
==ALTER USERINFO DB==
{| width='100%'
|-
|width='130'|'''Syntax'''
|{{Code|ALTER USER [name] ([newname])INFO DB}}
|-
| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;
|<code><alterinfo-user name='...' newname='...'db/></code><br/>
|-
| '''Permission'''
|''ADMINREAD''
|-
| '''Summary'''
|Renames Shows general information and meta data on the user with the specified {{Code|name}} to {{Code|newname}}currently opened database.
|-
| '''Errors'''
|The command fails if the specified user does not exist, or if the new user already existsno database is opened.
|}
==ALTER PASSWORDINFO INDEX==
{| width='100%'
|-
|width='130'|'''Syntax'''
|{{Code|ALTER PASSWORD [name] INFO INDEX ([passwordELEMNAME&#x7c;ATTRNAME&#x7c;PATH&#x7c;TEXT&#x7c;ATTRIBUTE&#x7c;TOKEN&#x7c;FULLTEXT])}}
|-
| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;
|<code><alterinfo-password nameindex type='...elemname&#x7c;attrname&#x7c;path&#x7c;text&#x7c;attribute&#x7c;token&#x7c;fulltext'>([password])</alter-password></code><br/>
|-
| '''Permission'''
|''ADMINREAD''
|-
| '''Summary'''
|Alters Shows information on the {{Codeexisting [[Indexes|password}} of index]] structures. The output can be optionally limited to the user with the specified {{Code|name}}. If no password is specified, it is requested via the chosen frontend (GUI or bash)index.
|-
| '''Errors'''
|The command fails if no database is opened, or if the specified user does not existindex is unknown.
|}
==DROP USERINFO STORAGE==
{| width='100%'
|-
|width='130'|'''Syntax'''
|{{Code|DROP USER INFO STORAGE [namestart end] (ON [pattern])}}:
|-
| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;
|<code><dropinfo-user namestorage (start='...' ) (patternend='...')/></code><br/>
|-
| '''Permission'''
|''ADMINREAD''
|-
| '''Summary'''
|Drops Shows the user with internal main table of the specified {{Code|name}}currently opened database. The [[#Glob Syntax|Glob Syntax]] can An integer range may be used to address more than one database or user. If a glob {{Code|pattern}} is specified, only the assigned database pattern will be removedas argument.
|-
| '''Errors'''
|The command fails if no database is opened, or if one of the specified arguments is invalid.|} ==JOBS LIST== {| width='100%'|-|width='130'|'''Syntax'''|{{Code|adminJOBS LIST}} is specified as user name, |-| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;|<code><jobs-list/></code><br/>|-| '''Permission'''|''ADMIN''|-| '''Summary'''|Returns information on all jobs that are currently queued or if executed. See {{Function|Jobs|jobs:list-details}} for more details on the specified user does not exist or is currently logged inreturned table entries.
|}
==GRANTJOBS RESULT==
{| width='100%'
|-
|width='130'|'''Syntax'''
|{{Code|GRANT JOBS RESULT [NONE&#x7c;READ&#x7c;WRITE&#x7c;CREATE&#x7c;ADMIN] (ON [pattern]) TO [userid]}}
|-
| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;
|<code><grant namejobs-result id='...' permission='none&#x7c;read&#x7c;write&#x7c;create&#x7c;admin' (pattern='...')/></code><br/>
|-
| '''Permission'''
|-
| '''Summary'''
|Grants Returns the specified [[User_Management|permission]] to cached result of a query with the specified {{Code|user}}job id:* Results can only be retrieved once. The [[#Glob Syntax|Glob Syntax]] can After retrieval, the cached result will be used to address more than one userdropped. * If a glob {{Code|pattern}} is specifiedthe original query has raised an error, the permission cached error will be applied to all databases that match this patternraised instead.
|-
| '''Errors'''
|The command fails if {{Code|admin}} the addressed job is specified as user name still running or if the specified user does not exist.|-| '''Examples'''|* {{Code|GRANT READ TO JoeWinson}}<br/>grants {{Code|READ}} permission to the user {{Code|JoeWinson}}.* {{Code|GRANT WRITE ON Wiki TO editor*}}<br/>grants {{Code|WRITE}} permissions on the {{Code|Wiki}} database to all users starting with the characters {{Code|editor*}}result has already been retrieved.
|}
==PASSWORDJOBS STOP==
{| width='100%'
|-
|width='130'|'''Syntax'''
|{{Code|PASSWORD (JOBS STOP [passwordid])}}
|-
| '''XML&nbsp;Syntax'''&nbsp;&nbsp;&nbsp;
|<code><password>([password])<jobs-stop id='...'/password></code><br/>
|-
| '''Permission'''
|''NONEADMIN''
|-
| '''Summary'''
|Changes Cancels the {{Code|password}} execution of a job with the current user. If no password is specifiedid, or drops the cached result of a query. Unknown ids are ignored. All jobs are gracefully stopped; it is requested via up to the chosen frontend (GUI or bash)process to decide when it is safe to shut down.
|}
==EXIT==
 
{| width='100%'
|-
;Version 10
* Added: [[#Backups|Backups]]: Support for general data ([[User Management|registered users]], [[Jobs Module#Services|scheduled services]] and [[Store Module|key-value stores]]).
* Updated: {{Command|CREATE BACKUP}}: Support for comments.
* Updated: {{Command|OPEN}}: {{Code|path}} argument dropped.
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu