Hi Geert,

Now I changed the code like this 

return <a href="{$const:BATCH-LIST-URL}" onClick="return 
deleteScheduledBulkBatch('{$batchDocUri}','{$batchDirUri}')">Click here to 
delete</a>
                            
JS

function deleteScheduledBulkBatch(batchDirUri,batchDocUri) {
        try
        {
                
        }
        catch(err)
        {
                alert(err.message);
        }
        return true;
}

But I don't know how to  call the marklogic  functions like 
xdmp:document-delete , xdmp:directory-delete,doc-available inside the java 
script. Could you please kindly help me.


Thanks & Regards,
Siva



-----Original Message-----
From: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of 
general-requ...@developer.marklogic.com
Sent: Wednesday, June 15, 2016 8:54 AM
To: general@developer.marklogic.com
Subject: General Digest, Vol 144, Issue 12

Send General mailing list submissions to
        general@developer.marklogic.com

To subscribe or unsubscribe via the World Wide Web, visit
        http://developer.marklogic.com/mailman/listinfo/general
or, via email, send a message with subject or body 'help' to
        general-requ...@developer.marklogic.com

You can reach the person managing the list at
        general-ow...@developer.marklogic.com

When replying, please edit your Subject line so it is more specific than "Re: 
Contents of General digest..."


Today's Topics:

   1. Re: Regarding XDMP-PREVENTDEADLOCKS (Geert Josten)


----------------------------------------------------------------------

Message: 1
Date: Wed, 15 Jun 2016 07:53:52 +0000
From: Geert Josten <geert.jos...@marklogic.com>
Subject: Re: [MarkLogic Dev General] Regarding XDMP-PREVENTDEADLOCKS
To: MarkLogic Developer Discussion <general@developer.marklogic.com>
Message-ID: <d386d52c.dc911%geert.jos...@marklogic.com>
Content-Type: text/plain; charset="us-ascii"

Hi Siva,

Is this an xqy module inside MarkLogic? It will probably run the 
xdmp:spawn-function when producing the HTML, rather than on-click. I think you 
better use a href that links to the page itself with a request-param indicating 
some action is required, and handling that elsewhere in that code, or make the 
link point to a different module that will execute the task..

Re preventdeadlocks: you can disable the safeguard with the <prevent-deadlocks> 
option, see also http://docs.marklogic.com/xdmp:eval..

Cheers,
Geert

From: 
<general-boun...@developer.marklogic.com<mailto:general-boun...@developer.marklogic.com>>
 on behalf of "Mani, Sivasubramani (ELS)" 
<s.m...@elsevier.com<mailto:s.m...@elsevier.com>>
Reply-To: MarkLogic Developer Discussion 
<general@developer.marklogic.com<mailto:general@developer.marklogic.com>>
Date: Wednesday, June 15, 2016 at 9:24 AM
To: "general@developer.marklogic.com<mailto:general@developer.marklogic.com>" 
<general@developer.marklogic.com<mailto:general@developer.marklogic.com>>
Subject: [MarkLogic Dev General] Regarding XDMP-PREVENTDEADLOCKS

Hi team,

I got the XDMP-PREVENTDEADLOCKS error while I try to call a marklogic function 
inside the Html hreaf onClick event. Kindly  guide me how to achieve this.

Code:

<dt>Delete</dt>,
                      <dd>{
                            let $userId := auth:get-current-user-id()
                            let $batchId := xs:string(data($batch/@id))
                            let $batchDocUri := 
batlib:get-batch-xml-uri($userId, $batchId)
                            let $batchDirUri := concat("/repo/user/", $userId,
                            $const:PATH-SEP, $batcon:BATCHES, $const:PATH-SEP, 
$batchId, $const:PATH-SEP)

                            return <a href="{$const:BATCH-LIST-URL}" onClick="{
                            xdmp:spawn-function(function() {
                            let $deletebBatchDir := try {
                                   xdmp:directory-delete($batchDirUri)
                                    } catch($e){
                                                    ""
                                                }
                            return (if(doc-available($batchDocUri)) then
                            xdmp:document-delete($batchDocUri)
                            else(),xdmp:commit())
                            },<options xmlns="xdmp:eval">
  <transaction-mode>update</transaction-mode>
</options>)

Error Message:

<error:code>XDMP-PREVENTDEADLOCKS</error:code>
  <error:name/>
  <error:xquery-version>1.0-ml</error:xquery-version>
  <error:message>Processing an update from an update with different-transaction 
isolation could deadlock</error:message>
  <error:format-string>XDMP-PREVENTDEADLOCKS: 
xdmp:invoke("/application/views/batch/available-batches.xqy", (fn:QName("", 
"view-data"), map:map(&lt;map:map xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:map="http://marklogic.com/xdmp/map"&gt;&lt;map:entry 
key="batchType"&gt;&lt;map:value 
xsi:type="xs:string"&gt;norma...&lt;/map:map&gt;), fn:QName("", "form-data"), 
...), &lt;options 
xmlns="xdmp:eval"&gt;&lt;isolation&gt;different-transaction&lt;/isolation&gt;&lt;prevent-deadlocks&gt;t...&lt;/options&gt;)
 -- Processing an update from an update with different-transaction isolation 
could deadlock</error:format-string>
  <error:retryable>false</error:retryable>


Thanks & Regards,
Siva

-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://developer.marklogic.com/pipermail/general/attachments/20160615/0133a930/attachment.html
 

------------------------------

_______________________________________________
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general


End of General Digest, Vol 144, Issue 12
****************************************
_______________________________________________
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to