Access variable database without locking all databases
Friday, 29 March 2019 · 1 message
LC
Leah Chatkeonopadol29 Mar 2019 22:59 #
Hi,
I'm using BaseX as a database for a web application with RESTXQ API endpoints. Each endpoint has a database name specified as a path param, for example:
declare
%rest:GET
%rest:path('data/{$database}/read')
function readData($database as xs:string) {
let $doc := fn:doc($database || '/data.xml')
return $doc
};All of the queries inside the function are only run against a single database, but as described in the transaction management
<http://docs.basex.org/wiki/Transaction_Management#Limitations> documentation, using
fn:doc with a variable will lock all the databases. Is there any way around this? Any suggestions would be much appreciated.
Thanks!Written for BaseX 9.1. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery