Hi Eliot,
Two years ago, two members of our team gave a little demo on RESTXQ [1,2]. Maybe this gives you an idea how we db:output can be used in web applications.
Just recently, we added a function that allows you to access the current entries of the output cache [3]. Please note, however, that this is more like a helper function that was mainly integrated for XQUnit tests.
Best, Christian
[1] http://files.basex.org/publications/xmlprague/2013.html [2] http://files.basex.org/publications/xmlprague/2013.html [3] http://docs.basex.org/wiki/Database_Module#db:output-cache
On Sun, Jul 5, 2015 at 6:42 PM, Eliot Kimber ekimber@contrext.com wrote:
I'm trying to understand how to use db:output() in the context of a REST function that does a bunch of stuff that updates and then wants to return a result.
I have my updating functions using db:output() to return XML elements that are log entries, which I have up to now then formatted as HTML for return by the Web app.
However, there doesn't appear to be a way to get the stuff returned by db:output before it gets returned to the ultimate caller. Have I missed something?
My REST-handling function is declared as %updating:
declare %updating %rest:path("/repo/{$repo}/{$branch}/updateLinkManagementIndexes")
Which I understand to be a requirement if the function itself calls any updating functions.
I tried e.g.:
let $result := f:myUpdatingFunction() return db:output(f:formatLogItems($result))
But that results in the "no updating functions" message on the variable assignment.
Is there a way to do what I want?
Thanks,
Eliot
Eliot Kimber, Owner Contrext, LLC http://contrext.com