Logo Search packages:      
Sourcecode: qdbm version File versions  Download package

qdbm::Villa::Villa ( String  name,
int  omode,
int  cmode 
) throws VillaException [inline]

Get the database handle.

Parameters:
name the name of a database file.
omode the connection mode: `Villa.OWRITER' as a writer, `Villa.OREADER' as a reader. If the mode is `Villa.OWRITER', the following may be added by bitwise or: `Villa.OCREAT', which means it creates a new database if not exist, `Villa.OTRUNC', which means it creates a new database regardless if one exists, `Villa.OZCOMP', which means leaves in the database are compressed. Both of `Villa.OREADER' and `Villa.OWRITER' can be added to by bitwise or: `Villa.ONOLCK', which means it opens a database file without file locking, or `Villa.OLCKNB', which means locking is performed without blocking.
cmode the comparing function: `Villa.CMPLEX' comparing keys in lexical order, `Villa.CMPNUM' comparing keys as numbers of big endian, `Villa.CMPDEC' comparing keys as decimal strings, `Villa.CMPOBJ' comparing keys as serialized objects implementing `java.util.Comparable'. The comparing function should be kept same in the life of a database.
Note:
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. `Villa.OZCOMP' is available only if QDBM was built with ZLIB enabled. If `Villa.ONOLCK' is used, the application is responsible for exclusion control.

Definition at line 187 of file Villa.java.

References index, name(), tran, and tranmonitor.

                                                                        {
    synchronized(ADBM.class){
      if((index = vlopen(name, omode, cmode)) == -1) throw new VillaException(vlecode());
    }
    tran = false;
    tranmonitor = new Object();
  }


Generated by  Doxygen 1.6.0   Back to index