I have accidentally found that this query works different on Windows and Linux
platforms -
declare function local:unix-timestamp() as xs:unsignedLong {
(fn:current-dateTime() - xs:dateTime("1970-01-01T00:00:00-00:00")) div
xs:dayTimeDuration('PT0.001S')
};
The expression (fn:current-dateTime() -
xs:dateTime("1970-01-01T00:00:00-00:00")) div xs:dayTimeDuration('PT0.001S')
returns an xs:decimal which is correct. However it seems with MarkLogic on
Windows platforms this will always return a natural number, and so the implicit
cast demanded by the function signature to an xs:unsignedLong will always work.
However on Linux, the same expression always returns a decimal number, as such
the implicit cast fails (as should be expected).
Now obviously I can fix this by using fn:floor around my expression to ensure I
get a natural number which can then implicitly be cast to an xs:unsignedLong.
However, I do not understand why XQuery here in MarkLogic behaves differently
on Windows and Linux platforms?!? Are there other cases that I need to watch
out for?
Thanks Adam.
DISCLAIMER
This message is intended only for the use of the person(s) ("Intended
Recipient") to whom it is addressed. It may contain information, which is
privileged and confidential. Accordingly any dissemination, distribution,
copying or other use of this message or any of its content by any person other
than the Intended Recipient may constitute a breach of civil or criminal law
and is strictly prohibited. If you are not the Intended Recipient, please
contact the sender as soon as possible.
Reed Business Information Limited. Registered Office: Quadrant House, The
Quadrant, Sutton, Surrey, SM2 5AS, UK.
Registered in England under Company No. 151537
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general