XQUF Transactions

Transactional Semantics in XQUF

Updates join a pending update list, applied in one step when the query ends. So a query reads a snapshot without its own changes; it returns updates or values, never both (XUST0001; BaseX 693,830 's update:output() reports back); and conflicting requests cancel the whole list (XUDY0017):

A committed update, then a conflicting one
bx() { basex -c "OPEN booknest" "$1"; }
bx 'let $p := //book[@id = "b3"]//price
    return (replace value of node $p with "26.00", update:output("during: " || $p))'
bx 'for $i in 1 to 2 return replace value of node (//price)[3] with $i'
bx '//book[@id = "b3"]//price/string()'
Output
during: 24.00
Stopped at /home/dev/v7-l1/ch02/s2-17/, 1/67:
[XUDY0017] Node can only be replaced once: <price.../>.
26.00

Each BaseX query is an ACID transaction under two-phase locking: readers run in parallel, writers alone.