Client software and command scripts

Friday, 3 January 2020 · 6 messages · last reply 6 Jan 2020
BE
Ben Engbers3 Jan 2020 13:52 #
Hi Christian, I read in the documentation that a client should not only be able to execute commands but should also be able to execute command scripts. My question is if a command script (a file with extension '.bxs') is passed as a 'path' to the execute-command or is the client supposed to read the file, line by line, and then executing each line separately? Cheers, Ben
CG
Christian Grün3 Jan 2020 16:27 #
Hi Ben,
Quoted text · Ben Engbers · 2 lines
> I read in the documentation that a client should not only be able to > execute commands but should also be able to execute command scripts.
Could you give me a link to the part of the documentation you refer to?
Quoted text · Ben Engbers · 3 lines
> My question is if a command script (a file with extension '.bxs') is > passed as a 'path' to the execute-command or is the client supposed to > read the file, line by line, and then executing each line separately?
If you refer to the execute function in the API client bindings [1], the argument must be a BaseX command string. If you refer to the BaseX command EXECUTE, the input must be the command script itself (see the example in [2]). The RUN command allows you to specify the path to a file or command script, but if you send this command to a server, the addressed file must be located on the filesystem of the server. Hope this helps, Christian [1] http://docs.basex.org/wiki/Standard_Mode [2] http://docs.basex.org/wiki/Commands#EXECUTE
BE
Ben Engbers6 Jan 2020 11:02 #
Hi Christian, Best wishes and thanks for your answer. Ben
Quoted text · Christian Grün · 7 lines
Op 03-01-2020 om 16:27 schreef Christian Grün: > Hi Ben, > >> I read in the documentation that a client should not only be able to >> execute commands but should also be able to execute command scripts. > > Could you give me a link to the part of the documentation you refer to?
I could not find it anymore, I guess that somewhere I mixed up information the API client bindings and the commandline interface.
Quoted text · Christian Grün · 5 lines
>> My question is if a command script (a file with extension '.bxs') is >> passed as a 'path' to the execute-command or is the client supposed to >> read the file, line by line, and then executing each line separately? > If you refer to the execute function in the API client bindings [1], > the argument must be a BaseX command string.
That is the way I have implemented it already. I used my client to load a csv-file into a db-file. In order to get the same result as with the GUI, I had to set some options. And at that moment, I thought that it might be handy to save all the commands in a script so that at a later moment, the script could be reused again. A condition for the usability of this option is that there is a possibility to pass arguments to the script. Is that already possible in BaseX?
CG
Christian Grün6 Jan 2020 11:39 #
Quoted text · Ben Engbers · 5 lines
> > A condition for the usability of this option is that there is a > possibility to pass arguments to the script. > Is that already possible in BaseX? >
What kind of arguments would you like to set? The easiest option may be to prefix your script string with some additional SET commands.
BE
Ben Engbers6 Jan 2020 14:18 #
Quoted text · Christian Grün · 6 lines
Op 06-01-2020 om 11:39 schreef Christian Grün: > What kind of arguments would you like to set? > > The easiest option may be to prefix your script string with some > additional SET commands. >
My suggestion/question on aassing arguments to a command script was not restricted to passing 'set' options with the client API, but was more general. Suppose I have a script with commands that add the content from a csv-file to a basex-db. It would be nice if I could pass the name/path of the file as argument to the script. That would make it easier to automate the update-process. Ben
CG
Christian Grün6 Jan 2020 14:23 #
That’s not possible, sorry. We wanted to avoid writing yet another script language: Once you start extending the syntax, you might need to add simple conditions, loops, error handling, etc. In addition, you would need to start encoding input that might be interpreted as arguments.
Quoted text · Ben Engbers · 18 lines
Ben Engbers <Ben.Engbers at be-logical.nl> schrieb am Mo., 6. Jan. 2020, 14:18: > Op 06-01-2020 om 11:39 schreef Christian Grün: > > What kind of arguments would you like to set? > > > > The easiest option may be to prefix your script string with some > > additional SET commands. > > > My suggestion/question on aassing arguments to a command script was not > restricted to passing 'set' options with the client API, but was more > general. > Suppose I have a script with commands that add the content from a > csv-file to a basex-db. It would be nice if I could pass the name/path > of the file as argument to the script. That would make it easier to > automate the update-process. > > Ben > >

⚡Generated with XQuery