Invoking database update from RESTXQ

Tuesday, 3 March 2015 · 3 messages
LJ
Lars Johnsen3 Mar 2015 10:36 #
Hello all I was wondering how to perform database updating, like db:add, in RESTXQ, since the adding and updating functions throw errors when invoked inside functions defined in RESTXQ-modules. Have been trying to use the forward mechanism, transferring the data to a script without functions, with no success. Best, Lars G Johnsen
LK
Lukas Kircher3 Mar 2015 11:18 #
Hi Lars, are you annotating your RESTXQ endpoints with %updating? F.i.: declare %rest:path('/somepath') *%updating* function _:update() { updates ... }; Cheers, Lukas
Quoted text · Lars Johnsen · 14 lines
On Tue, Mar 3, 2015 at 10:36 AM, Lars Johnsen <yoonsen at gmail.com> wrote: > Hello all > > I was wondering how to perform database updating, like db:add, in RESTXQ, > since the adding and updating functions throw errors when invoked inside > functions defined in RESTXQ-modules. > > Have been trying to use the forward mechanism, transferring the data to a > script without functions, with no success. > > Best, > Lars G Johnsen > >
MG
Maximilian Gärberin reply to Lars Johnsen, 3 Mar 2015, 10:363 Mar 2015 11:54 #
Hi, it works for me when the XQuery module resides in the "repo" folder, and the RESTXQ function only calls it ---- inside restxq module import module namespace coll = "http://foo.org/collections";
coll:new("some-db")
---- inside repo module
declare updating function _:new($name as xs:string)
{
   let $foo := "bar/"
   return db:create($name,
        concat("/Some/Path/", $foo, $name, ".xml")
 )
}; 2015-03-03 10:36 GMT+01:00 Lars Johnsen <yoonsen at gmail.com>:
Quoted text · Lars Johnsen · 12 lines
> Hello all > > I was wondering how to perform database updating, like db:add, in RESTXQ, > since the adding and updating functions throw errors when invoked inside > functions defined in RESTXQ-modules. > > Have been trying to use the forward mechanism, transferring the data to a > script without functions, with no success. > > Best, > Lars G Johnsen >

⚡Generated with XQuery