Package com.sleepycat.je

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


            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

        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

      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

       
        /* 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

        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

            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

                    i++;
                }
    cursor.close();
            } else if (searchKeyRange) {
                /* Range Search for the key. */
    Cursor cursor = db.openCursor(null, null);
    OperationStatus status = cursor.getSearchKeyRange(searchKey,
                  foundData,
                  LockMode.DEFAULT);
    cursor.close();
                System.out.println("Range Search for key " + keyVal +
View Full Code Here

        DatabaseConfig dbConfig = new DatabaseConfig();
        dbConfig.setAllowCreate(false);
        dbConfig.setReadOnly(true);
        dbConfig.setSortedDuplicates(true);
        Database db = env.openDatabase(null, Utils.DB2_NAME, dbConfig);
        Cursor cursor = db.openCursor(null, null);
        try {
            DatabaseEntry key = new DatabaseEntry();
            DatabaseEntry data = new DatabaseEntry();
            OperationStatus status = cursor.getFirst(key, data, null);
            if (status != OperationStatus.SUCCESS) {
View Full Code Here

      loader.setDbName("foobar");
            loader.load();

            /* Make sure we retrieve the expected data. */
            Database checkDb = env.openDatabase(null, "foobar", null);
            Cursor cursor = checkDb.openCursor(null, null);
            DatabaseEntry key = new DatabaseEntry();
            DatabaseEntry data = new DatabaseEntry();
            assertEquals(OperationStatus.SUCCESS,
                         cursor.getNext(key, data, LockMode.DEFAULT));
            assertEquals("abc", new String(key.getData()));
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.