Package com.sleepycat.je

Examples of com.sleepycat.je.DatabaseConfig


    private Database openDatabase(boolean allowDuplicates, String name,
                                  boolean readOnly)
        throws DatabaseException {

        DatabaseConfig dbConfig = new DatabaseConfig();
        dbConfig.setTransactional(isTransactional);
        dbConfig.setAllowCreate(true);
        dbConfig.setSortedDuplicates(allowDuplicates);
        dbConfig.setReadOnly(readOnly);
        Transaction txn = txnBegin();
        Database priDb;
        try {
            priDb = env.openDatabase(txn, name, dbConfig);
        } finally {
View Full Code Here


        }
        db = database;
        try {
            currentTxn =
                CurrentTransaction.getInstanceInternal(db.getEnvironment());
            DatabaseConfig dbConfig;
            if (db instanceof SecondaryDatabase) {
                secDb = (SecondaryDatabase) database;
                SecondaryConfig secConfig = secDb.getSecondaryConfig();
                secKeyCreator = secConfig.getKeyCreator();
                dbConfig = secConfig;
            } else {
                dbConfig = db.getConfig();
            }
            ordered = !DbCompat.isTypeHash(dbConfig);
            recNumAllowed = DbCompat.isTypeQueue(dbConfig) ||
                            DbCompat.isTypeRecno(dbConfig) ||
                            DbCompat.getBtreeRecordNumbers(dbConfig);
            recNumRenumber = DbCompat.getRenumbering(dbConfig);
            dupsAllowed = DbCompat.getSortedDuplicates(dbConfig) ||
                          DbCompat.getUnsortedDuplicates(dbConfig);
            dupsOrdered = DbCompat.getSortedDuplicates(dbConfig);
            transactional = currentTxn.isTxnMode() &&
                            dbConfig.getTransactional();
            readUncommittedAllowed = DbCompat.getReadUncommitted(dbConfig);
            btreeRecNumDb = recNumAllowed && DbCompat.isTypeBtree(dbConfig);
            range = new KeyRange(dbConfig.getBtreeComparator());
        } catch (DatabaseException e) {
            throw new RuntimeExceptionWrapper(e);
        }
        this.writeAllowed = writeAllowed;
        this.keyBinding = keyBinding;
View Full Code Here

    }

    private Database openDb(String file)
        throws Exception {

        DatabaseConfig config = new DatabaseConfig();
        config.setTransactional(testEnv.isTxnMode());
        config.setAllowCreate(true);

        return DbCompat.openDatabase(env, null, file, null, config);
    }
View Full Code Here

        throws DatabaseException {

        /* Make a db and open it. */
        dbs = new Database[numDbs];

        DatabaseConfig dbConfig = new DatabaseConfig();
  if (btreeComparisonFunction != null) {
      dbConfig.setBtreeComparator(btreeComparisonFunction.getClass());
  }
        dbConfig.setTransactional(true);
        dbConfig.setAllowCreate(true);
        dbConfig.setSortedDuplicates(true);
        for (int i = 0; i < numDbs; i++) {
            dbs[i] = env.openDatabase(txn, DB_NAME + i, dbConfig);
        }
    }
View Full Code Here

        /* Generate an expected count map. */
        Map countMap = generateCountMap(expectedData);

        /* Check each db in turn. */
        DatabaseConfig dbConfig = new DatabaseConfig();
  if (btreeComparisonFunction != null) {
      dbConfig.setBtreeComparator(btreeComparisonFunction.getClass());
  }
        dbConfig.setTransactional(env.getConfig().getTransactional());
        dbConfig.setSortedDuplicates(true);
        dbConfig.setReadOnly(true);
        for (int d = startDb; d < endDb; d++) {
            Database checkDb = env.openDatabase(null, DB_NAME + d,
            dbConfig);
            Cursor myCursor = checkDb.openCursor(null, null);
            DatabaseEntry key = new DatabaseEntry();
View Full Code Here

     * Print the contents of the databases out for debugging
     */
    protected void dumpData(int numDbs)
        throws DatabaseException {

        DatabaseConfig dbConfig = new DatabaseConfig();
  if (btreeComparisonFunction != null) {
      dbConfig.setBtreeComparator(btreeComparisonFunction.getClass());
  }
        dbConfig.setSortedDuplicates(true);
  dbConfig.setTransactional(true);
        for (int d = 0; d < numDbs; d++) {
            Database checkDb = env.openDatabase(null, DB_NAME + d, dbConfig);
            Cursor myCursor = checkDb.openCursor(null, null);
            DatabaseEntry key = new DatabaseEntry();
            DatabaseEntry data = new DatabaseEntry();
View Full Code Here

    }

    private Database openDb(String file, boolean create)
        throws Exception {

        DatabaseConfig config = new DatabaseConfig();
        DbCompat.setTypeBtree(config);
        config.setTransactional(testEnv.isTxnMode());
        config.setAllowCreate(create);

        return DbCompat.openDatabase(env, null, file, null, config);
    }
View Full Code Here

    }

    private Database openDb(String file)
        throws Exception {

        DatabaseConfig config = new DatabaseConfig();
        DbCompat.setTypeBtree(config);
        config.setTransactional(testEnv.isTxnMode());
        config.setAllowCreate(true);

        return DbCompat.openDatabase(env, null, file, null, config);
    }
View Full Code Here

        this.envImpl = env;
        idDatabase = new DatabaseImpl(ID_DB_NAME,
              new DatabaseId(0),
              env,
              new DatabaseConfig());
                                 
        nameDatabase = new DatabaseImpl(NAME_DB_NAME,
          new DatabaseId(1),
          env,
          new DatabaseConfig());
                                 
        lastAllocatedDbId = 1;
    }
View Full Code Here

    }

    public void testCursorDupAndCloseDb()
  throws DatabaseException {
        initEnv(false);
        DatabaseConfig dbConfig = new DatabaseConfig();
        dbConfig.setAllowCreate(true);
        Database myDb = exampleEnv.openDatabase(null, "fooDb", dbConfig);

  myDb.put(null, new StringDbt("blah"), new StringDbt("blort"));
  Cursor cursor = myDb.openCursor(null, null);
  OperationStatus status = cursor.getNext(new DatabaseEntry(),
View Full Code Here

TOP

Related Classes of com.sleepycat.je.DatabaseConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.