On 05.11.2012, at 17:40, Colin McEnearney wrote:
Hi,
Using restxq, do all queries have to begin with db:open('web_app_db')//myquery/here , or can the database be declared? Or set as default somewhere?
Thanks, Colin
Hi Colin,
we use db:open all over the place.
(: ----------------------------------------------------- :) module namespace _ = 'com.gmail.colinmcenearney.db';
declare namespace restxq = "http://exquery.org/ns/restxq";
(: Database name used throughout the application. :) declare variable $_:MY-DB := '_catalog';
(:~ Show users page. :) declare %restxq:path("/show-users") %output:method("html") function _:show-users() { <div> { serialize(db:open($_:MY-DB)//user/@id) } </div> }; (: ----------------------------------------------------- :)
Database name declarations often go to a constants.xqm.
Cheers, Alex