admin:write-log in updating query

Thursday, 4 July 2019 · 3 messages
MW
Markus Wittenberg4 Jul 2019 16:39 #
Hi BaseX team, I wonder why I can't use admin:write-log as output of an updating function Using ...
   return if(file:is-file($path))
     then (
       try {
         file:delete($path)
       } catch * {
         admin:write-log('Could not delete image file ' || $path)  (:
works with update:output('...'):)
       }
       ,
       delete node $img
     )
     else (
       delete node $img
     )
I get the error *Expressions must all be updating or return an empty sequence.* Kind regards
-- Markus Wittenberg Tel +49 (0)341 248 475 36 Mail wittenberg at axxepta.de ---- axxepta solutions GmbH Lehmgrubenweg 17, 88131 Lindau Amtsgericht Berlin HRB 97544B Geschäftsführer: Karsten Becke, Maximilian Gärber
CG
Christian Grün4 Jul 2019 16:51 #
Hi Markus, The reason is that the XQuery Update Facility was finalized before try/catch was introduced with XQuery 3 (this is why the specification provides no rules for handling this case). We’ll look at this soon, though [1]. Thanks for the hint, Christian [1] https://github.com/BaseXdb/basex/issues/1693
Quoted text · Markus Wittenberg · 43 lines
On Thu, Jul 4, 2019 at 4:39 PM Markus Wittenberg <Wittenberg at axxepta.de> wrote: > > Hi BaseX team, > > I wonder why I can't use admin:write-log as output of an updating function > > Using > > ... > > return if(file:is-file($path)) > then ( > try { > file:delete($path) > } catch * { > admin:write-log('Could not delete image file ' || $path) (: works with update:output('...'):) > } > , > delete node $img > ) > else ( > delete node $img > ) > > I get the error > > Expressions must all be updating or return an empty sequence. > > Kind regards > > -- > Markus Wittenberg > > Tel +49 (0)341 248 475 36 > Mail wittenberg at axxepta.de > > ---- > > axxepta solutions GmbH > Lehmgrubenweg 17, 88131 Lindau > > Amtsgericht Berlin HRB 97544B > Geschäftsführer: Karsten Becke, Maximilian Gärber
CG
Christian Grün4 Jul 2019 17:16 #
A new snapshot is available [1]. BaseX 9.2.3 will be released this or next week. Cheers, Christian [1] http://files.basex.org/releases/latest/
Quoted text · Christian Grün · 59 lines
On Thu, Jul 4, 2019 at 4:51 PM Christian Grün <christian.gruen at gmail.com> wrote: > > Hi Markus, > > The reason is that the XQuery Update Facility was finalized before > try/catch was introduced with XQuery 3 (this is why the specification > provides no rules for handling this case). We’ll look at this soon, > though [1]. > > Thanks for the hint, > Christian > > [1] https://github.com/BaseXdb/basex/issues/1693 > > > > On Thu, Jul 4, 2019 at 4:39 PM Markus Wittenberg <Wittenberg at axxepta.de> wrote: > > > > Hi BaseX team, > > > > I wonder why I can't use admin:write-log as output of an updating function > > > > Using > > > > ... > > > > return if(file:is-file($path)) > > then ( > > try { > > file:delete($path) > > } catch * { > > admin:write-log('Could not delete image file ' || $path) (: works with update:output('...'):) > > } > > , > > delete node $img > > ) > > else ( > > delete node $img > > ) > > > > I get the error > > > > Expressions must all be updating or return an empty sequence. > > > > Kind regards > > > > -- > > Markus Wittenberg > > > > Tel +49 (0)341 248 475 36 > > Mail wittenberg at axxepta.de > > > > ---- > > > > axxepta solutions GmbH > > Lehmgrubenweg 17, 88131 Lindau > > > > Amtsgericht Berlin HRB 97544B > > Geschäftsführer: Karsten Becke, Maximilian Gärber

⚡Generated with XQuery