From: Gary <ga...@ra...> - 2021-08-09 17:50:33
|
thanks Michael! This looks brilliant and I found the documentation here too: http://exist-db.org/exist/apps/fundocs/view.html?uri=http://exist-db.org/xquery/counter&location=java:org.exist.xquery.modules.counter.CounterModule I had written my own sequence generator but it has problems with persisting values, concurrency, with limit on counter to limit of java long, adjusting for customer counters and it creates so many additional requests outside exist... It is great to find something in eXist! -----Original Message----- From: Michael <wes...@ja...> To: Gary <ga...@co...> Cc: exist-open <exi...@li...>; Gary <ga...@ra...> Date: Monday, 9 August 2021 3:19 AM BST Subject: Re: [Exist-open] eXistDB sequence generator? Oh, and one more thing about the counter module. You'll need to copy the counters file in your EXIST_DATA directory to any new instances you create. This is because it is NOT managed within the database itself, so not backed up or restored. But it should be fairly straightforward to create such a library module that is managed within the database. Take care. 2021年8月9日(月) 10:40 Michael Westbay <wes...@ja...>: Hi Gary, See the "counter" module built into eXist. let $dummy := counter:create('file-ids') let $new-file-path := xmldb:store("/db/docs", concat(counter:next-value('file-ids'), '.xml'), $doc) let $dummy := counter:destroy('file-ids') Hope this helps. Take care. 2021年8月9日(月) 2:44 Gary via Exist-open <exi...@li...>: Hi Guys, Is there an eXistDB sequence generator function I can use inside an XQuery? I would like to create documents from an XQuery along these lines. let $new-file-path := xmldb:store("/db/docs", concat(xmldb:sequence-generator(), '.xml'), $doc) I am looking for a way to safely set, reset and persist counters and create a series of unique document names from each time the query is run e.g. 1.xml, 2.xml 3.xml etc. Kind Regards Gary Solution Architect https://www.rapport.net https://assistive.care https://q.rip Rapport Network CIC Registered in Scotland: SC458540 _______________________________________________ Exist-open mailing list Exi...@li... https://lists.sourceforge.net/lists/listinfo/exist-open -- Michael Westbay Writer/System Administrator http://www.japanesebaseball.com/ -- Michael Westbay Writer/System Administrator http://www.japanesebaseball.com/ |