Hi Florent,

On 22 March 2010 17:30, Florent Georges <[email protected]> wrote:
>  Hi,
>
>  I have a database configured as:
>
>    Name:        db-xxx
>    Security db: Security
>    Schema db:   Schemas
>    Triggers db: (none)
>
>  I create a new trigger by using the following code:
>
>    xquery version "1.0";
>    import module namespace tr = "http://marklogic.com/xdmp/triggers";
>      at "/MarkLogic/triggers.xqy";
>    declare namespace xdmp = "http://marklogic.com/xdmp";;
>
>    tr:create-trigger(
>      'xxx',
>      'no description',
>      tr:trigger-data-event(
>        tr:collection-scope('tmp'),
>        tr:document-content('create'),
>        tr:pre-commit()
>      ),
>      tr:trigger-module(xdmp:database('db-xxx'), 'tmp/', 'test.xqy'),
>      true(),
>      xdmp:default-permissions(),
>      false()
>    )
>
>  It runs correctly and returns an integer (the ID of the trigger
> if I am right).  So I expected to see the trigger in the console,
> in the tab "Databases/db-xxx/Triggers", but this one is empty.

It's probably a case of either executing it against the wrong triggers
database, or your 'db-xxx' database is pointing to a different
triggers database.

One thing I do to help avoid executing it against the wrong db is to
put the trigger creation query into a variable, and then use xdmp:eval
which allows you to specific the database to execute it against as
part of the the query:

let $query := 'your trigger creation code'

return (xdmp:eval($query, (), <options xmlns="xdmp:eval">
    <database>{xdmp:database('the-triggers-db')}</database>
  </options>), 'Done')



-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to