Not sure, but you might want to perform the update as a separate transaction ... Using xdmp:eval-in.
-----Original Message----- From: [EMAIL PROTECTED] <[EMAIL PROTECTED]> To: 'General Mark Logic Developer Discussion' <[email protected]> Sent: Mon May 14 17:28:01 2007 Subject: RE: [MarkLogic Dev General] About hash map function Would this be the appropriate time to ask what the *best* implementation for a sequence (numeric id generator) is in Mark Logic Xquery? Should have the usual characteristics: monotonically increasing, thread safe. The best we've come up with is to store a value in a global document somewhere and update it; not sure if this any reason to try and improve on that - any opinions? -Mike > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Ian Small > Sent: Monday, May 14, 2007 5:21 PM > To: General Mark Logic Developer Discussion > Subject: RE: [MarkLogic Dev General] About hash map function > > Alternatively, xdmp:query-meters() will return the actual > wallclock time as part of its output. Two potential issues with this: > - resolution of timer of your operating system may still be "too fast" > - arguably, using a sledgehammer for a fly, considering the > size of the structure that query-meters() returns, when all > you want is the wallclock time > > I prefer pure random()-based or hybrid (ie. stable clock + > random etc.) approaches myself. > > ian > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Gerety, Colin > Sent: Monday, May 14, 2007 2:17 PM > To: General Mark Logic Developer Discussion > Subject: RE: [MarkLogic Dev General] About hash map function > > Thanks for pointing out that current-dateTime() is "stable". > I had missed that. > > Colin Gerety > Flatirons Solutions Corporation > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Ryan Grimm > Sent: Monday, May 14, 2007 3:05 PM > To: General Mark Logic Developer Discussion > Subject: Re: [MarkLogic Dev General] About hash map function > > Hi Rashid, > > In XQuery, the current-dateTime() will always return the same > value during the execution of the query. To see this try > executing this > query: > > current-dateTime(), > xdmp:sleep(5000), > current-dateTime() > > You'll see that result of current-dateTime() is the same for > both calls even though there was a sleep in there for 5 seconds. > > If you're looking for a unique value for some id's you could > probably use xdmp:random() to generate an unsigned 64bit > integer. While there is > > a small possibility of xdmp:random() returning the same value > twice, the > > same potential problem exists for xdmp:hash64(). > > Hope that helps. > > --Ryan > > > Nizamuddin, Rashid wrote: > > Could anybody please tell me why I am not getting a unique > value when > I > > execute this loop > > > > *let $cnt := 1 to 5* > > > > *for $c in $cnt* > > > > *return * > > > > * let $str := xdmp:hash64(string(current-dateTime()))* > > > > * return $str* > > > > * * > > > > *for each iteration I get the same value. I need to get a > unique value > > > to insert in some ids elements.* > > > > * * > > > > *Any help will be appreciated* > > > > * * > > > > *Rashid* > > > > * * > > > > > > > -------------------------------------------------------------- > ---------- > > > > _______________________________________________ > > General mailing list > > [email protected] > > http://xqzone.com/mailman/listinfo/general > _______________________________________________ > General mailing list > [email protected] > http://xqzone.com/mailman/listinfo/general > _______________________________________________ > General mailing list > [email protected] > http://xqzone.com/mailman/listinfo/general > _______________________________________________ > General mailing list > [email protected] > http://xqzone.com/mailman/listinfo/general > _______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
_______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
