Changes

Jump to navigation Jump to search
No change in size ,  13:32, 20 July 2022
m
Text replacement - "db:pre(" to "db:get("
|-
|{{Function|Database|db:pre}}
|{{Code|db:preget("db", "path/to/docs")}}
|Returns all documents that are found in the database {{Code|db}} at the (optional) path {{Code|path/to/docs}}.
|-
<syntaxhighlight lang="xquery">
for $i in 1 to 100
return db:preget('books' || $i)//book/title
</syntaxhighlight>
* In the standalone context, a main-memory database can be created (using <code>CREATE DB</code>), which can then be accessed by subsequent commands.
* If a BaseX server instance is started, and if a database is created in its context (using <code>CREATE DB</code>), other BaseX client instances can access (and update) this database (using OPEN, db:pre, etc.) as long as no other database is opened/created by the server.
* You can force an ordinary database to being copied to memory by using <code>db:preget('some-db') update {}</code>
'''Note:''' If you address a URI with <code>fn:doc</code> or <code>fn:collection</code> for which no database exists, the resulting internal representation is identical to those of main-memory database instances (no matter which value is set for {{Option|MAINMEM}}).
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu