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