Hi Christian, Thank you very much for your time, Just to clarify on point #2 regarding close. What I understood from you if I have an application that is managing multiple embedded database ( let say 3 ) at the same time and needs to constantly run query / updates on these db's , then I just need to Open it once on startup and the close it whenever I'm done with database.
How about OPTIMIZE , I see you suggested to run it after all kinds of database updates, is it true ?
Thank you,
Regards,
--Aleks
-----Original Message----- From: Christian GrĂ¼n [mailto:christian.gruen@gmail.com] Sent: Sunday, January 24, 2010 6:56 AM To: Alexander Sheynkman Cc: basex-talk@mailman.uni-konstanz.de Subject: Re: [basex-talk] BaseX db questions
Dear Aleks,
thanks for your questions:
- What is the concept of the Context ? Do I need to create a new context for every database operation or same context should be used within open database ?
One Context instance should be used for all database operations. It contains a reference to the currently opened database. I would only recommend to create multiple Context instances if you need to open several databases at the same time.
- Is it true that I have to open and close database every time I run query or I can keep database open.
The database will be kept open until you send a Close command, or open another database. The following code snippet might give you some more hints:
http://www.inf.uni-konstanz.de/dbis/basex/code.php?code=DatabaseExample
- How does commit occur, with basex6 it seems like data being committed to disk with some delay?
All modified data is flushed to disk as soon as an XQuery Update expression has been completely processed, so no delays should occur.
Hope this helps, Christian