Hello,
Before doing some updates, I want to check many things. If those checks fail, I want to throw an error, to allow the calling program be notified of the error.
I do not want to avoid the updates, but really want to throw an error.
Is there such a function ?
Christophe
Hi Christophe,
I do not want to avoid the updates, but really want to throw an error.
I'm not sure how to interpret your statement.. Do you want to execute the updates AND throw an error?
If you throw an error, your updates won't be executed, so this may already be what you need. See the following example..
let $data := <my-data/> return if($data/*) then ( insert node $data into db:open('db')/xml ) else ( error((), 'Root has no child elements!') )
Best, Christian
That's exactly what I want !
Thanks a lot !
Christophe
Le 2015-06-09 10:58, Christian Grün a écrit :
Hi Christophe,
I do not want to avoid the updates, but really want to throw an error.
I'm not sure how to interpret your statement.. Do you want to execute the updates AND throw an error?
If you throw an error, your updates won't be executed, so this may already be what you need. See the following example..
let $data := <my-data/> return if($data/*) then ( insert node $data into db:open('db')/xml ) else ( error((), 'Root has no child elements!') )
Best, Christian
basex-talk@mailman.uni-konstanz.de