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
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?
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
Hi Christian,
Best wishes and thanks for your answer.
Ben
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.
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?
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
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.
Ben Engbers Ben.Engbers@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
basex-talk@mailman.uni-konstanz.de