db creation mini tool

Monday, 8 October 2012 · 2 messages
HR
Hans-Juergen Rennau8 Oct 2012 12:42 #
Hello, a little question. I would like to write a mini "tool" which loads an XML file into a database, creating the db if it does not yet exist and overwriting the current content if it does already exist. This script achieves the goal:
<commands>
   <drop-db name="mydb"/>
   <create-db name="mydb">myxmlfile.xml</create-db>
   <list/>
</commands>
But as the script interface does not (yet?) support input parameters, I have to edit the script for each use. Using an XQuery script, on the other hand, is not possible as there is no function for creating a database, if I have not overlooked it in the documentation. My question: is there an alternative which allows to specifiy db name and file name as command line parameters, or is that presently not possible? Many thanks for any information, Hans-Juergen Rennau PS: I would not mind the editing myself, but a tool with call parameters is helpful when spreading the word "BaseX" among the colleagues: providing some useful tools to them using BaseX, one has to instruct them first how to load their data into BaseX, and of course it would be nice to give them a simple call, rather than an instruction how to edit a sample and then call it.
CG
Christian Grün8 Oct 2012 15:10 #
Dear Hans-Jürgen, the necessity for db:create() and db:drop() is getting more and more obvious, which is why we will definitely introduce those two functions with BaseX 7.5. We also thought about adding variable support to command scripts, but this would result in additional challenges (e.g, how to properly encode characters that are not supposed to be evaluated as variables). Hope this helps, Christian
Quoted text · Hans-Juergen Rennau · 37 lines
On Mon, Oct 8, 2012 at 12:42 PM, Hans-Juergen Rennau <hrennau at yahoo.de> wrote: > Hello, > > a little question. I would like to write a mini "tool" which loads an XML > file into a database, creating the db if it does not yet exist and > overwriting the current content if it does already exist. This script > achieves the goal: > > <commands> > <drop-db name="mydb"/> > <create-db name="mydb">myxmlfile.xml</create-db> > <list/> > </commands> > > But as the script interface does not (yet?) support input parameters, I have > to edit the script for each use. Using an XQuery script, on the other hand, > is not possible as there is no function for creating a database, if I have > not overlooked it in the documentation. > > My question: is there an alternative which allows to specifiy db name and > file name as command line parameters, or is that presently not possible? > > Many thanks for any information, > > Hans-Juergen Rennau > > PS: I would not mind the editing myself, but a tool with call parameters is > helpful when spreading the word "BaseX" among the colleagues: providing some > useful tools to them using BaseX, one has to instruct them first how to load > their data into BaseX, and of course it would be nice to give them a simple > call, rather than an instruction how to edit a sample and then call it. > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >

⚡Generated with XQuery