Hi All,

Please find the below code snippet in which i have created an invoke and
module xquery with same fn:current-dateTime() logging and returning result.

As a result I can able to see the timestamp is different :
       1. when an other xquery is called using invoke
       2. when an other xquery is called using spawn
       3. when using spawn function for both local and other module xquery
function

*Sample :*
import module namespace check = "http://marklogic.com/check"; at
"/a/common/check_now.xqy";

declare function local:dateTime(){
(
fn:current-dateTime(),
xdmp:log(("local fun",fn:current-dateTime()))
)
};

*let $check := fn:current-dateTime()*
let $time := cts:uri-match("*")
let $time := cts:search(doc(),())
let $check1 := xdmp:invoke("/a/common/now.xqy")
let $check11 := xdmp:spawn("/a/common/now.xqy")
*let $check2 := fn:current-dateTime()*
let $check3 := local:dateTime()
let $check4 := check:dateTime()
let $check5 := xdmp:spawn-function(function(){local:dateTime()})
let $check6 := xdmp:spawn-function(function(){check:dateTime()})
return
("Result",$check,"aaa",$check1,"aaa11",$check11,"bbb",$check2,"ccc",$check3,"ddd",$check4,"spawn
eee",$check5, "fff",$check6)

Verify the result and marklogic logs..

Regards,
N. Sumathi.


On Thu, Nov 17, 2016 at 6:53 AM, Florent Georges <[email protected]> wrote:

> Hi,
>
> The current date and time is the same through the evaluation of the
> entire query.  So if "submodule.xay" is a library module, imported in
> the main module, that will give you the exact same value.
>
> If it is not a library module, and you invoke, spawn, schedule a task,
> eval or anything else, it depends on that "anything else"...
>
> Regards,
>
> --
> Florent Georges
> http://fgeorges.org/
> http://h2o.consulting/ - New website!
>
>
> On 17 November 2016 at 12:46, sweet frd wrote:
> > Hi All,
> >
> > I have a module somemodule.xqy which has the following line for logic
> >
> > fn:current-dateTime()
> >
> >
> > Will there be a difference in output for the below scenarios
> >
> > (a) Invoke the above xquery (somemodule.xqy) in main module
> >
> > (b) Directly invoke the function fn:current-dateTime() in the main module
> >
> >
> > Regards,
> > N. Sumathi.
> >
> > _______________________________________________
> > General mailing list
> > [email protected]
> > Manage your subscription at:
> > http://developer.marklogic.com/mailman/listinfo/general
> >
> _______________________________________________
> General mailing list
> [email protected]
> Manage your subscription at:
> http://developer.marklogic.com/mailman/listinfo/general
>
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to