Package com.sleepycat.je

Examples of com.sleepycat.je.SecondaryDatabase.openSecondaryCursor()


      Transaction tran = env.beginTransaction(null, null);
      DatabaseEntry key = new DatabaseEntry();
      DatabaseEntry pKey = new DatabaseEntry();
      DatabaseEntry data = new DatabaseEntry();
      try {
        SecondaryCursor cursor = db.openSecondaryCursor(tran, null);
        try {
          while (cursor.getNext(key, pKey, data, null) == OperationStatus.SUCCESS) {
            cursor.delete();
            dataBinding.entryToObject(data).remove();
          }
View Full Code Here


          IMetaData o = keys[i];
          SecondaryDatabase db = dbKeys.get(o.getName());
          if (db == null) {
            return;
          }
          SecondaryCursor cursor = db.openSecondaryCursor(null, null);
          key.setData(o.getBytes());
          cursor.getSearchKey(key, data, null);
          cursors[i] = cursor;
        }
        JoinCursor joinCursor = dbMain.join(cursors, null);
View Full Code Here

      Transaction tran = env.beginTransaction(null, null);
      DatabaseEntry key = new DatabaseEntry(data.getBytes());
      DatabaseEntry pKey = new DatabaseEntry();
      DatabaseEntry pData = new DatabaseEntry();
      try {
        SecondaryCursor cursor = db.openSecondaryCursor(tran, null);
        try {
          OperationStatus ret = cursor.getSearchKey(key, pKey, pData, null);
          while (ret == OperationStatus.SUCCESS) {
            cursor.delete();
            dataBinding.entryToObject(pData).remove();
View Full Code Here

        Cursor priCursor = null;
        SecondaryCursor secCursor = null;
        try {
            priCursor = priDb.openCursor(txn, null);
            secCursor = secDb.openSecondaryCursor(txn, null);

            /* Cursor.putNoOverwrite() */
            status = priCursor.putNoOverwrite(entry(1), entry(2));
            assertSame(OperationStatus.SUCCESS, status);
            status = secCursor.getSearchKey(entry(102), key, data,
View Full Code Here

        /* Get a cursor txn. */
        txnCommit(txn);
        txn = txnBeginCursor();

        SecondaryCursor cursor = secDb.openSecondaryCursor(txn, null);
        try {
            /* SecondaryCursor.getFirst()/getNext() */
            secKey.setData(null);
            key.setData(null);
            data.setData(null);
View Full Code Here

        txnCommit(txn);
        txn = txnBeginCursor();

        SecondaryCursor cursor = null;
        try {
            cursor = secDb.openSecondaryCursor(txn, null);

            try {
                cursor.getSearchBoth(key, data, LockMode.DEFAULT);
                fail();
            } catch (UnsupportedOperationException expected) { }
View Full Code Here

        /* Cursor operations. */

        txnCommit(txn);
        txn = txnBeginCursor();
        Cursor cursor = priDb.openCursor(txn, null);
        SecondaryCursor secCursor = secDb.openSecondaryCursor(txn, null);

        assertEquals(OperationStatus.SUCCESS,
                     cursor.getSearchKey(key, found, null));
        assertEquals(OperationStatus.SUCCESS,
                     cursor.getSearchBoth(key, data, null));
View Full Code Here

                     priDb.put(txn, key, data));

        txnCommit(txn);
        txn = txnBeginCursor();
        Cursor cursor = priDb.openCursor(txn, null);
        SecondaryCursor secCursor = secDb.openSecondaryCursor(txn, null);

        /* Check the uninitialized state for certain operations. */

        try {
            cursor.count();
View Full Code Here

        txnCommit(txn);
        txn = txnBeginCursor();

        SecondaryCursor c0 = secDb0.openSecondaryCursor(txn, null);
        SecondaryCursor c1 = secDb1.openSecondaryCursor(txn, null);
        SecondaryCursor c2 = secDb2.openSecondaryCursor(txn, null);
        SecondaryCursor[] cursors = {c0, c1, c2};

        for (int i = 0; i < joinSet.length; i += 2) {
            int[] indexKeys = joinSet[i];
            int[] priKeys = joinSet[i + 1];
View Full Code Here

        status = priDb2.get(txn, entry(3), data, LockMode.DEFAULT);
        assertEquals(OperationStatus.SUCCESS, status);
        assertEquals(1, val(data));

        SecondaryCursor cursor = secDb2.openSecondaryCursor(txn, null);
        status = cursor.getFirst(key, pkey, data, LockMode.DEFAULT);
        assertEquals(OperationStatus.SUCCESS, status);
        assertEquals(1, val(key));
        assertEquals(2, val(pkey));
        assertEquals(1, val(data));
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.