basex RUN local script when talking to Remote server

Friday, 9 November 2012 · 5 messages · last reply 12 Nov 2012
BR
bryan rasmussen9 Nov 2012 13:46 #

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

CG
Christian Grün10 Nov 2012 21:44 #

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
BR
bryan rasmussenin reply to bryan rasmussen, 9 Nov 2012, 13:4612 Nov 2012 12:49 #
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

CG
Christian Grün12 Nov 2012 12:57 #

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
CG
Christian Grün12 Nov 2012 14:23 #

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


⚡Generated with XQuery