I'm trying to pass a parameter to an xquery file whose first line reads: define variable $db as xs:string external
How may I invoke the BaseX client so that the param will be passed to the query?
Just saw in the 6.5 change log "[ADD] JAX-RX: bind external variables to query and run parameter". Does that mean that passing param is currently only available in the JAX-RX interface?
Maybe you can parse the command line client invocation such that everything after the options and after a xquery file name is considered as param=value pairs?
-Gerrit
Dear Gerrit,
currently, external variables are supported by our various language bindings (listed at http://docs.basex.org/wiki/Languages) and JAX-RX, but not on the command line. Your feature request looks quite reasonable, though, so I'll probably add a -b option, similar to the option -s for defining serialization parameters. A command line call will look sth. like that:
basex -bvar1=hello -bvar2=world query.xq
Hope this helps, Christian
On Sun, Jan 23, 2011 at 5:36 PM, Imsieke, Gerrit, le-tex gerrit.imsieke@le-tex.de wrote:
I'm trying to pass a parameter to an xquery file whose first line reads: define variable $db as xs:string external
How may I invoke the BaseX client so that the param will be passed to the query?
Just saw in the 6.5 change log "[ADD] JAX-RX: bind external variables to query and run parameter". Does that mean that passing param is currently only available in the JAX-RX interface?
Maybe you can parse the command line client invocation such that everything after the options and after a xquery file name is considered as param=value pairs?
-Gerrit _______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Gerrit,
I've now added a -b flag to the command-line options of BaseX Client and Standalone. This way, external variables can be bound to queries, which are either referenced as file, or specified via the -c or -q flags. Two examples:
basex -b a=1 query.xq basexclient -b a=1 -q "declare variable $a external; $a"
By defauls, the passed on values will be treated as strings. If the query specifies a data type, the passed on value will be cast to that type. Note that the value to be bound may not contain equality signs, commas, semi-colons or (depending on the OS) other characters that may be interpreted the wrong way. In other words, the integrated solution doesn't support all values that could be bound to variables. Similar restrictions apply to the GET method of JAX-RX, though.
Christian
On Sun, Jan 23, 2011 at 7:22 PM, Christian Grün christian.gruen@gmail.com wrote:
Dear Gerrit,
currently, external variables are supported by our various language bindings (listed at http://docs.basex.org/wiki/Languages) and JAX-RX, but not on the command line. Your feature request looks quite reasonable, though, so I'll probably add a -b option, similar to the option -s for defining serialization parameters. A command line call will look sth. like that:
basex -bvar1=hello -bvar2=world query.xq
Hope this helps, Christian
On Sun, Jan 23, 2011 at 5:36 PM, Imsieke, Gerrit, le-tex gerrit.imsieke@le-tex.de wrote:
I'm trying to pass a parameter to an xquery file whose first line reads: define variable $db as xs:string external
How may I invoke the BaseX client so that the param will be passed to the query?
Just saw in the 6.5 change log "[ADD] JAX-RX: bind external variables to query and run parameter". Does that mean that passing param is currently only available in the JAX-RX interface?
Maybe you can parse the command line client invocation such that everything after the options and after a xquery file name is considered as param=value pairs?
-Gerrit _______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
basex-talk@mailman.uni-konstanz.de