basex RUN local script when talking to Remote server
Hi,
I have started the basexclient with a -n and -parameter to point to my server, what I would like to do is to execute scripts that I have laying around locally by doing something like
RUN name_of_local_script.bsx and not get back a response that it cannot find name_of_local_script.bsx in the folder /home/account that has basex installation...
Thanks, Bryan Rasmussen
Hi Bryan,
it's true that scripts that are addressed via RUN will always be opened on the server. If you use basexclient from command line, you can specify your input file with the -c flag. As an alternative, if your commands are available as string (either on the text or the XML format), you may as well use the EXECUTE command [2].
Christian
[1] http://docs.basex.org/wiki/Startup_Options#BaseX_Client [2] http://docs.basex.org/wiki/Commands#EXECUTE
Quoted text · bryan rasmussen · 14 lines
> I have started the basexclient with a -n and -parameter to point to my > server, what I would like to do is to execute scripts that I have > laying around locally by doing something like > > RUN name_of_local_script.bsx and not get back a response that it > cannot find name_of_local_script.bsx in the folder /home/account that > has basex installation... > > Thanks, > Bryan Rasmussen > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Quoted text · bryan rasmussen · 11 lines
On Fri, Nov 9, 2012 at 1:46 PM, bryan rasmussen <rasmussen.bryan at gmail.com> wrote: > Hi, > > I have started the basexclient with a -n and -parameter to point to my > server, what I would like to do is to execute scripts that I have > laying around locally by doing something like > > RUN name_of_local_script.bsx and not get back a response that it > cannot find name_of_local_script.bsx in the folder /home/account that > has basex installation...
Ok, I did as Christian suggested I ran with the -c parameter to load a script
I also used the -o parameter to save the output but it did not save the output. It created an empty file?
Thanks, Bryan Rasmussen
It's difficult to give more information without having more details.. Do you have a reproducible example?
Quoted text · bryan rasmussen · 16 lines
Am 12.11.2012 12:49 schrieb "bryan rasmussen" <rasmussen.bryan at gmail.com>: > > On Fri, Nov 9, 2012 at 1:46 PM, bryan rasmussen > <rasmussen.bryan at gmail.com> wrote: > > Hi, > > > > I have started the basexclient with a -n and -parameter to point to my > > server, what I would like to do is to execute scripts that I have > > laying around locally by doing something like > > > > RUN name_of_local_script.bsx and not get back a response that it > > cannot find name_of_local_script.bsx in the folder /home/account that > > has basex installation... > > > Ok, I did as Christian suggested I ran with the -c parameter to load a
script
Quoted text · bryan rasmussen · 10 lines
> > I also used the -o parameter to save the output but it did not save > the output. It created an empty file? > > Thanks, > Bryan Rasmussen > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Hi Bryan (cc @ basex-talk),
thanks for the confirmation. Yes, certain combinations of command-line arguments along with "-o" caused a buggy behavior. As usual, I've updated the latest snapshot containing the fix [1].
By the way, please note that all arguments will be evaluated from left to right in BaseX. This way, you can use a single BaseX call to write your results to several files, as e.g. shown here:
basex -ofile1.txt -q1 -ofile2.txt -c"xquery 1 to 10"
While this behavior may seem surprising at first glance, it has proven to be very helpful in our everyday's use. I tried to make this a little bit more explicit in our documentation [2].
Hope this helps, Christian
[1] http://files.basex.org/releases/latest/ [2] http://docs.basex.org/wiki/Startup_Options
Written for BaseX 7.3. BaseX may have changed since: please check the current documentation.