Get DBPATH variable
Wednesday, 5 October 2016 · 2 messages
BV
Bram Vanroy5 Oct 2016 09:45 #
Hi all, it's me again
Another day, another question! I'm still working in Perl on BaseX 7.9. This time I am trying to check if a database is already build. I thought a good way would be to check if the path to the database already exists on the file system. However, not wanting to hard-code each single path for each different basex instance, I was wondering if there is a way to get the
DBPATH variable that is set in the .basex file. Note that I need to retrieve this information before opening the database itself: when running a Session, I need to check if a database exists on the DBPATH as specified in that Session's variables.
I've been looking in the methods of the BaseX client for Perl, and in the available commands on the wiki but I cannot find a way to retrieve these 'Session Globals'. Is there a way? Or any other way to check if the database already exists?
Thank you in advance
BramCG
Christian Grün5 Oct 2016 09:55 #
Hi Bram,
Quoted text · Bram Vanroy · 1 line
> I am trying to check if a database is already build.
Maybe
db:exists does what you need [1]? If you always want to create a database that does not exist, the CHECK command [2] could be another option.
Cheers,
Christian
[1] http://docs.basex.org/wiki/Database_Module#db:exists
[2] http://docs.basex.org/wiki/Commands#CHECKQuoted text · Bram Vanroy · 25 lines
I thought a good > way would be to check if the path to the database already exists on the file > system. However, not wanting to hard-code each single path for each > different basex instance, I was wondering if there is a way to get the > DBPATH variable that is set in the .basex file. Note that I need to retrieve > this information before opening the database itself: when running a Session, > I need to check if a database exists on the DBPATH as specified in that > Session’s variables. > > > > I’ve been looking in the methods of the BaseX client for Perl, and in the > available commands on the wiki but I cannot find a way to retrieve these > ‘Session Globals’. Is there a way? Or any other way to check if the database > already exists? > > > > > > Thank you in advance > > > > Bram
Written for BaseX 8.5. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery