From: Michael W. <wes...@ja...> - 2021-08-09 02:19:24
|
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/ |