Try this to get the database name within a query:
xdmp:database-name(xdmp:database())
For code that has to run in Security, an assert at the beginning can be useful:
if (xdmp:security-database() eq xdmp:database()) then ()
else error(
(), 'NOTSECURITY', text {
xdmp:database-name(xdmp:database()), 'is not the Security database' })
,
(: ...more expressions can follow the comma :)
-- Mike
On 26 Oct 2012, at 14:13 , "Kalinosky, Mary" <[email protected]> wrote:
> Hello All,
>
> How can I find which database my .xqy file is executing against?
>
> I typed the following into my query console and got "true" which is the
> expected result.
>
> xquery version "1.0-ml";
> import module namespace sec = "http://marklogic.com/xdmp/security" at
> "/MarkLogic/security.xqy";
>
> let $existing_user := sec:user-exists("my_user_name")
>
> return
> xdmp:quote( $existing_user )
> In my application, however, it returns false, even though I've configured the
> app server to use the Security database.
>
> Thanks in advance.
>
> Mary Kalinosky
> eProducts
> Thieme Medical Publishers
> 333 Seventh Avenue, New York, NY 10001 USA
> Ruedigerstrasse 14, 70469 Stuttgart, Germany
>
> Email: [email protected]
> Tel: +1 212 584-4684
> www.thieme.com
> Thieme eNeurosurgery:
> The world's most comprehensive neurosurgical resource online.
>
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
