[MarkLogic Dev General] About hash map function
Ian Small
ian at marklogic.com
Mon May 14 14:21:19 PDT 2007
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: general-bounces at developer.marklogic.com
[mailto:general-bounces at developer.marklogic.com] 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: general-bounces at developer.marklogic.com
[mailto:general-bounces at developer.marklogic.com] 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
> General at developer.marklogic.com
> http://xqzone.com/mailman/listinfo/general
_______________________________________________
General mailing list
General at developer.marklogic.com
http://xqzone.com/mailman/listinfo/general
_______________________________________________
General mailing list
General at developer.marklogic.com
http://xqzone.com/mailman/listinfo/general
More information about the General
mailing list