public final class Updates extends Object
Implementation of the W3C XQUERY UPDATE FACILITY 1.0.
Holds all update operations and primitives a snapshot contains, checks constraints and finally executes the updates.
Fragment updates are treated like database updates. An artificial data instance is created for each fragment. Ultimately the updating process for a fragment is the same as for a database node.
The complete updating process is custom-tailored to the sequential table encoding of BaseX. As a general rule, all updates are collected and applied for each database from bottom to top, regarding the PRE values of the corresponding target nodes. Updates on the highest PRE values are applied first.
Updates work like the following:
NodeUpdate
.DataUpdates
NodeUpdates
TransformModifier
. All the other updates are executed by
a DatabaseModifier
.NodeUpdateComparator
helps to order
NodeUpdate
for execution. Each primitive then creates a sequence of
BasicUpdate
which are passed to the Data
layer via an
AtomicUpdateCache
. This list takes care of optimization and also text node
merging.Modifier and Type | Field and Description |
---|---|
ContextModifier |
mod
Current context modifier.
|
TokenSet |
putPaths
All file paths that are targeted during a snapshot by an fn:put expression.
|
Constructor and Description |
---|
Updates() |
Modifier and Type | Method and Description |
---|---|
void |
add(Update up,
QueryContext qc)
Adds an update primitive to the current context modifier.
|
void |
apply(QueryContext qc)
Executes all updates.
|
StringList |
databases()
Returns the names of all databases that will be updated.
|
DBNode |
determineDataRef(ANode target,
QueryContext qc)
Determines the data reference and pre value for an update primitive
which has a fragment as a target node.
|
HashSet<Data> |
prepare(QueryContext qc)
Prepares update operations.
|
int |
size()
Number of updates on the pending update list.
|
public ContextModifier mod
public final TokenSet putPaths
public void add(Update up, QueryContext qc) throws QueryException
up
- update primitiveqc
- query contextQueryException
- query exceptionpublic DBNode determineDataRef(ANode target, QueryContext qc)
target
- target fragmentqc
- query contextpublic HashSet<Data> prepare(QueryContext qc) throws QueryException
qc
- query contextQueryException
- query exceptionpublic void apply(QueryContext qc) throws QueryException
qc
- query contextQueryException
- query exceptionpublic StringList databases()
public int size()
Copyright © 2005–2015 BaseX Team. All rights reserved.