[Xapian-discuss] Closing a DB

David Morris dmorris at sirca.org.au
Thu Aug 9 02:53:10 BST 2007


Hi, 

As part of my whole indexing thing, I want to move the databases 
around, from within the code. So, I figured that the safest bet 
would be to close the DB before attempting to move it. 

But there's no Xapian::Database::close() or even 
Xapian::WritableDatabase::close().

I have a global variable that holds the database, and I open it
in the main():

// globals
Xapian::WritableDatabase g_Xap;

int main( int argc, char ** argv )
{
    g_Xap = Xapian::WritableDatabase( ... );
}

So, I was thinking, in order to close it successfully, i 
could do this:

g_Xap = Xapian::WritableDatabase();

But that doesn't force a close, it just does the whole refcount 
thing, which could potentially leave it open if someone still 
has it laying around.

Why is there no close() method? What's the "official" way to 
close a DB?

Cheers.




More information about the Xapian-discuss mailing list