You'll be safe: Updates with db:put-value will be managed via the Pending Update List [1], and future queries that operate on the same database will be queued until the update is finished.

[1] https://docs.basex.org/wiki/XQuery_Update#Pending_Update_List



Tim Thompson <timathom@gmail.com> schrieb am Di., 15. Nov. 2022, 18:50:
That's perfect--I knew I was missing something :)

Are db:get-value and db:put-value side-effecting as well?

Thanks,
Tim


--
Tim A. Thompson (he, him)
Librarian for Applied Metadata Research
www.linkedin.com/in/timathompson


El mar, 15 nov 2022 a la(s) 12:28, Christian Grün (christian.gruen@gmail.com) escribió:
Hi Tim,

> Using the store module, is it possible to read and merge multiple custom stores into main memory

We could add an argument (or options) to file:read to allow entries to
be added to an existing main-memory store.

> set a particular store as context for a query?

The recommended approach is to invoke store:read before any other
operation in the query. Please note, however, that the store will be
globally available. If a second query runs on the same server and
opens another store, it will change the behavior of the first query.
For such use cases, it’s better to use databases.

> Or, do I need to serialize the stores, e.g., as JSON and then create databases for them?

You could have a look at the new db:get-value and db:put-value
functions [1]: These functions have particularly been designed to
organize XQuery items in databases, making casts to JSON or XML
obsolete.

Hope this helps,
Christian

[1] https://docs.basex.org/wiki/Database_Module#db:get-value