Hi Florent,

I think my starting point would be to explore whether I could change the 
trigger setup such that disabling wasn't necessary (maybe don't add the docs to 
some collection or directory until you've called my:do-it()). If that's not an 
option, perhaps you could do your three steps in separate transactions.

Dave.

--
Dave Cassel
Developer Community Manager
MarkLogic Corporation<http://www.marklogic.com/>


From: Florent Georges <[email protected]<mailto:[email protected]>>
Reply-To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Date: Wednesday, November 12, 2014 at 3:17 AM
To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Subject: [MarkLogic Dev General] Disabling triggers, transactions and order of 
evaluation

  Hi,

  I need to disable triggers during some ingestion phase.  I had a
look at trgr:trigger-enable[1] and trgr:trigger-disable[2], but I am
not sure to understand their relationship with transactions.  I mean,
can I use something like the following:

    xdmp:eval("trgr:trigger-disable('...')", (), $opt),
    my:do-it(),
    xdmp:eval("trgr:trigger-enable('...')", (), $opt)

  I guess it is not guaranteed to do what I would like to do (disable
triggers while my:do-it() is executed), at least because there is no
order of evaluation guarantee.  Is introducing functional dependency
enough?

    (: functional dependency to guarantee order of execution :)
    let $dis := xdmp:eval("trgr:trigger-disable('...')", (), $opt)
    let $res := my:do-it($dis)
    return
       xdmp:eval("trgr:trigger-enable('...')", (xs:QName('my:foo'), $res), $opt)

  Or should each call to xdmp:eval commit the transaction for the
triggers to be enabled/disabled as well?

  Regards,

--
Florent Georges
http://fgeorges.org/
http://h2oconsulting.be/

[1] http://docs.marklogic.com/trgr:trigger-enable
[2] http://docs.marklogic.com/trgr:trigger-disable


_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to