Get the database handle.
|name ||the name of a database file. |
|omode ||the connection mode: `VillaOWRITER' as a writer, `VillaOREADER' as a reader. If the mode is `VillaOWRITER', the following may be added by bitwise or: `VillaOCREAT', which means it creates a new database if not exist, `VillaOTRUNC', which means it creates a new database regardless if one exists, `VillaOZCOMP', which means leaves in the database are compressed. Both of `VillaOREADER' and `VillaOWRITER' can be added to by bitwise or: `VillaONOLCK', which means it opens a database file without file locking, or `VillaOLCKNB', which means locking is performed without blocking. |
|cmp ||the comparing function: `Villacmplex' comparing keys in lexical order, `Villacmpint' comparing keys as objects of `int' in native byte order, `Villacmpnum' comparing keys as numbers of big endian, `Villacmpdec' comparing keys as decimal strings. Any function compatible with them can be assigned to the comparing function. The comparing function should be kept same in the life of a database. |
- While connecting as a writer, an exclusive lock is invoked to the database file. While connecting as a reader, a shared lock is invoked to the database file. The thread blocks until the lock is achieved. `VillaOZCOMP' is available only if QDBM was built with ZLIB enabled. If `VillaONOLCK' is used, the application is responsible for exclusion control.
Definition at line 186 of file xvilla.cc.
References qdbm::mutex, name(), tranmutex, and villa.