Examples of openCursor()


Examples of com.sleepycat.je.Database.openCursor()

        DatabaseConfig dbConfig = new DatabaseConfig();
        dbConfig.setAllowCreate(true);
        Database myDb = exampleEnv.openDatabase(null, "fooDb", dbConfig);

        /* Open uninitialized cursor. */
        Cursor c1 = myDb.openCursor(null, null);
        try {
            c1.getCurrent(new DatabaseEntry(), new DatabaseEntry(), null);
            fail();
        } catch (DatabaseException expected) {}

View Full Code Here

Examples of com.sleepycat.je.Database.openCursor()

        DatabaseConfig dbConfig = new DatabaseConfig();
        dbConfig.setAllowCreate(false);
        dbConfig.setReadOnly(true);
        dbConfig.setSortedDuplicates(true);
        Database db = env.openDatabase(null, "db1", dbConfig);
        Cursor cursor = db.openCursor(null, null);
        DatabaseEntry key = new DatabaseEntry();
        DatabaseEntry data = new DatabaseEntry();
        OperationStatus status = cursor.getFirst(key, data, null);
        assertEquals(OperationStatus.SUCCESS, status);
        assertEquals(3, value(key));
View Full Code Here

Examples of com.sleepycat.je.Database.openCursor()

    private static void preload(Environment env, String dbName)
        throws DatabaseException {
        System.out.println("Preload starting");
        Database db = env.openDatabase(null, dbName, null);
        Cursor cursor = db.openCursor(null, null);
        try {
            DatabaseEntry key = new DatabaseEntry();
            DatabaseEntry data = new DatabaseEntry();
            int count = 0;
            while (cursor.getNext(key, data, LockMode.DEFAULT) ==
View Full Code Here

Examples of com.sleepycat.je.Database.openCursor()

        Database db = env.openDatabase(null, dbName, dbConfig);
  dupSort = db.getConfig().getSortedDuplicates();

  printHeader(outputFile, dupSort, formatUsingPrintable);

  Cursor cursor = db.openCursor(null, null);
  while (cursor.getNext(foundKey, foundData, LockMode.DEFAULT) ==
               OperationStatus.SUCCESS) {
      dumpOne(outputFile, foundKey.getData(), formatUsingPrintable);
      dumpOne(outputFile, foundData.getData(), formatUsingPrintable);
  }
View Full Code Here

Examples of com.sleepycat.je.Database.openCursor()

            txn.abort();

            /*
             * The database should be empty
             */
            Cursor cursor = dbSpoiler.openCursor(txnSpoiler, null);
           
            assertTrue(cursor.getFirst(keyDbt, dataDbt, LockMode.DEFAULT) !=
                       OperationStatus.SUCCESS);
            cursor.close();
            txnSpoiler.abort();
View Full Code Here

Examples of com.sleepycat.je.Database.openCursor()

        env = new Environment(envHome, envConfig);
        Database db = env.openDatabase(null, dbName, dbConfig);
        found = new HashSet();

        Cursor cursor = db.openCursor(null, null);
        DatabaseEntry key = new DatabaseEntry();
        DatabaseEntry data = new DatabaseEntry();

        int i = 0;
        try {
View Full Code Here

Examples of com.sleepycat.je.Database.openCursor()

      assertEquals(OperationStatus.SUCCESS, db.put(null, key, data));
  }

  data.setData("d1".getBytes());

  Cursor c = db.openCursor(null, null);
  assertEquals(OperationStatus.SUCCESS,
         c.getFirst(key, data, LockMode.DEFAULT));

  c.close();
  db.close();
View Full Code Here

Examples of com.sleepycat.je.Database.openCursor()

       
        /* Force an abrupt close so there is no checkpoint at the end. */
        closeEnv();
        env = new Environment(envHome, envConfig);
  db = env.openDatabase(null, "testSR8984db", dbConfig);
  c = db.openCursor(null, null);
  assertEquals(OperationStatus.SUCCESS,
         c.getFirst(key, data, LockMode.DEFAULT));
  assertEquals(NUM_EXTRA_DUPS - 2, c.count());
  c.close();
  db.close();
View Full Code Here

Examples of com.sleepycat.je.Database.openCursor()

        env = new Environment(envHome, recoveryConfig);
  dbConfig.setAllowCreate(false);
  dbConfig.setTransactional(false);
  Database db2 = env.openDatabase(null, "foo", dbConfig);
  Cursor c = db2.openCursor(null, null);
  DatabaseEntry key = new DatabaseEntry();
  DatabaseEntry data = new DatabaseEntry();
  assertEquals(OperationStatus.SUCCESS,
         c.getNext(key, data, LockMode.DEFAULT));
  assertEquals((key.getData())[0], 1);
View Full Code Here

Examples of com.sleepycat.je.Database.openCursor()

            DbInternal.setUseExistingConfig(dbConfig, true);
            Database db = envHandle.openDatabase(null, dbName, dbConfig);

            DatabaseEntry foundData = new DatabaseEntry();
            if (dumpAll) {
                Cursor cursor = db.openCursor(null, null);
                DatabaseEntry foundKey = new DatabaseEntry();
                int i = 0;
                while (cursor.getNext(foundKey, foundData,
                                      LockMode.DEFAULT) == OperationStatus.SUCCESS) {
                    System.out.println(i + ":key=" +
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.