Changes

Jump to navigation Jump to search
33 bytes added ,  15:01, 27 February 2020
no edit summary
BaseX stores all XML nodes in a flat table. The node table of a database can be displayed via the [[Commands#INFO STORAGE|INFO STORAGE]] command:
<presyntaxhighlight>
$ basex -c"create db db <xml>HiThere</xml>" -c"info storage"
1 1 2 1 1 0 ELEM xml
2 1 1 1 2 0 TEXT HiThere
</presyntaxhighlight>
{{Code|===PRE}}: The ''pre'' value of a node represents the order in which the XML nodes are visited by a SAX parser. It is actually not stored in the database; instead, it is implicitly given by the table position. As a result, it will change whenever a node with a smaller ''pre'' values is added to or deleted from a database.Value===
{{Code|ID}}: Each database node has a persistent The ''idpre'' value, of a node represents the order in which remains valid after update operationsthe XML nodes are visited by a SAX parser. It is actually not stored in the database; instead, and which it is referenced implicitly given by the [[Indexes#Value Indexes|value indexes]]table position. As long as no updates are performed on a databaseresult, the it will change whenever a node with a smaller ''pre'' and ''id'' values are identical. The values will remain to be identical if new nodes are exclusively is added to the end of the or deleted from a database. If nodes are deleted or inserted somewhere else, the values will diverge, as shown in the next example:
===ID Value=== Each database node has a persistent ''id'' value, which remains valid after update operations, and which is referenced by the [[Indexes#Value Indexes|value indexes]]. As long as no updates are performed on a database, the ''pre'' and ''id'' values are identical. The values will remain to be identical if new nodes are exclusively added to the end of the database. If nodes are deleted or inserted somewhere else, the values will diverge, as shown in the next example: <presyntaxhighlight>
$ basex -c"create db db <xml>HiThere</xml>" -q"insert node <b/> before /xml" -c"info storage"
2 2 2 1 1 0 ELEM xml
3 1 1 1 2 0 TEXT HiThere
</presyntaxhighlight>
The [[Database Module#db:node-pre|db:node-pre]] and [[Database Module#db:node-id|db:node-id]] functions can be called to retrieve the ''pre'' and ''id'' values of a node, and [[Database Module#db:open-pre|db:open-pre]] and [[Database Module#db:open-id|db:open-id]] can be used to go back and retrieve the original node. By default, ''id'' lookups are expensive. If the [[Options#UPDINDEX{{Option|UPDINDEX]] option }} is turned on, an additional index will be maintained to speed up the process.
==Block Storage==
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu