fn:apply with an updating function

Thursday, 28 July 2022 · 3 messages
HR
Hans-Juergen Rennau28 Jul 2022 11:40 #

Dear BaseX people,

I encounter a problem with standard function fn:apply(), applied to an updating function.

declare %updating function f:apply-dbPut($db as xs:string, $input as item(), $path as xs:string) {
     let $fn := function-lookup(QName('http://basex.org/modules/db', 'put'), 3)
     let $args := [$db, $input, $path]
     return apply($fn, $args)
};

Message: [XUST0002] Function body must be updating.

Therer seems to be a checking looking for an updating function, and apply() cannot, of course, be classified as such.

Do I make a mistake, or is it a limitation, or a bug?

Thank you for checking, kind regards - Hans-Jürgen

CG
Christian Grün28 Jul 2022 12:16 #

Hi Hans-Jürgen,

Quoted text · Hans-Juergen Rennau · 2 lines
> Therer seems to be a checking looking for an updating function, and apply() cannot, of course, be classified as such. > Do I make a mistake, or is it a limitation, or a bug?

That’s a limitation of the official function. You can use our custom update:apply function as a resort [1].

Hope this helps, Christian

[1] https://docs.basex.org/wiki/Update_Module#update:apply

HR
Hans-Juergen Rennau28 Jul 2022 12:43 #

Phantastic - it could not be easier, just insert "update:" before "apply("! That'sBaseX. Cordial thanks! Hans-Jürgen Am Donnerstag, 28. Juli 2022 um 12:17:23 MESZ hat Christian Grün <christian.gruen at gmail.com> Folgendes geschrieben:

Hi Hans-Jürgen,

Quoted text · Christian Grün · 2 lines
> Therer seems to be a checking looking for an updating function, and apply() cannot, of course, be classified as such. > Do I make a mistake, or is it a limitation, or a bug?

That’s a limitation of the official function. You can use our custom update:apply function as a resort [1].

Hope this helps, Christian

[1] https://docs.basex.org/wiki/Update_Module#update:apply


⚡Generated with XQuery