Examples of DatabaseEntry


Examples of com.sleepycat.db.DatabaseEntry

        Dbc cursor = null;
        List<String> list = new ArrayList<String>();

        try {
            try {
                DatabaseEntry key = new DatabaseEntry(new byte[0]);
                DatabaseEntry data = new DatabaseEntry((byte[]) null);

                data.setPartial(true);

                cursor = files.cursor(txn, flags);

                if (cursor.get(key, data,
                               DbConstants.DB_SET_RANGE | flags) != DbConstants.DB_NOTFOUND)
View Full Code Here

Examples of com.sleepycat.je.DatabaseEntry

      int matches = 0;
      List<WebURL> results = new ArrayList<WebURL>(max);

      Cursor cursor = null;
      OperationStatus result = null;
      DatabaseEntry key = new DatabaseEntry();
      DatabaseEntry value = new DatabaseEntry();
      Transaction txn;
      if (resumable) {
        txn = env.beginTransaction(null, null);
      } else {
        txn = null;
      }
      try {
        cursor = urlsDB.openCursor(txn, null);
        result = cursor.getFirst(key, value, null);

        while (matches < max && result == OperationStatus.SUCCESS) {
          if (value.getData().length > 0) {
            WebURL curi = (WebURL) webURLBinding.entryToObject(value);
            results.add(curi);
            matches++;
          }
          result = cursor.getNext(key, value, null);
View Full Code Here

Examples of com.sleepycat.je.DatabaseEntry

    synchronized (mutex) {
      int matches = 0;

      Cursor cursor = null;
      OperationStatus result = null;
      DatabaseEntry key = new DatabaseEntry();
      DatabaseEntry value = new DatabaseEntry();
      Transaction txn;
      if (resumable) {
        txn = env.beginTransaction(null, null);
      } else {
        txn = null;
View Full Code Here

Examples of com.sleepycat.je.DatabaseEntry

    }
  }

  public void put(WebURL curi) throws DatabaseException {
    byte[] keyData = Util.int2ByteArray(curi.getDocid());
    DatabaseEntry value = new DatabaseEntry();
    webURLBinding.objectToEntry(curi, value);
    Transaction txn;
    if (resumable) {
      txn = env.beginTransaction(null, null);
    } else {
      txn = null;
    }
    urlsDB.put(txn, new DatabaseEntry(keyData), value);
    if (resumable) {
      txn.commit();
    }
  }
View Full Code Here

Examples of com.sleepycat.je.DatabaseEntry

  }

  public boolean removeURL(WebURL webUrl) {
    synchronized (mutex) {
      try {
        DatabaseEntry key = new DatabaseEntry(Util.int2ByteArray(webUrl.getDocid()));       
        Cursor cursor = null;
        OperationStatus result = null;
        DatabaseEntry value = new DatabaseEntry();
        Transaction txn = env.beginTransaction(null, null);
        try {
          cursor = urlsDB.openCursor(txn, null);
          result = cursor.getSearchKey(key, value, null);
         
View Full Code Here

Examples of com.sleepycat.je.DatabaseEntry

   assertTrue("t6 open ", dbt.openDB(DBNAME2, false) );
   assertNotNull("t6 current null", dbt.getCurrentDB() );

   //*-- fetch the document and verify
   String dbKey = "0000000002";
   DatabaseEntry data = new DatabaseEntry(); TestDoc doc = new TestDoc();
   if (dbt.fetch(dbKey, data) )
   {  doc = (TestDoc) doc.getBdbBinding().entryToObject(data);    }
   String contents = "contents " + 2;
   assertEquals("t6", contents, doc.getContents() );
   dbt.closeDB(); dbt.closeEnv()
View Full Code Here

Examples of com.sleepycat.je.DatabaseEntry

   loadDB("t7", 10, false, DBNAME2);

   //*-- fetch a document, delete the document and attempt to fetch it again
   dbt = new DbTools(); dbt.openEnv(DBDIR, false);
   assertTrue( "t7 open ", dbt.openDB(DBNAME2, false) );
   String dbKey = "0000000002"; DatabaseEntry data = new DatabaseEntry();
   assertTrue( "t7 fetch not successful", dbt.fetch(dbKey, data) );
   data = new DatabaseEntry();
   assertTrue("t7 delete failed", dbt.delete(dbKey) );
   assertFalse( "t7 fetch should have failed", dbt.fetch(dbKey, data) );
   dbt.closeDB(); dbt.closeEnv();

   //*-- try to delete a non-existent row
View Full Code Here

Examples of com.sleepycat.je.DatabaseEntry

   loadDB("t8", 10, false, DBNAME2);

   //*-- fetch a record, update its contents and verify the update
   dbt = new DbTools(); dbt.openEnv(DBDIR, false);
   assertTrue( "t8 open ", dbt.openDB(DBNAME2, false) );
   String dbKey = "0000000002"; DatabaseEntry data = new DatabaseEntry();
   assertTrue("t8 fetch", dbt.fetch(dbKey, data) );
   TestDoc doc = new TestDoc();
   doc =  (TestDoc) doc.getBdbBinding().entryToObject(data);

   String newContents = "new contents"; doc.setContents(newContents);
View Full Code Here

Examples of com.sleepycat.je.DatabaseEntry

   DBKeyCreator skc2 =  new DBKeyCreator(new TestDocBinding() );
   assertTrue("t12 create SEC ",  dbt.createSecDB(SECDB, false, skc2) );
   assertTrue("t12 open SEC", dbt.openSecDB(SECDB, false, skc2) );

   //*-- fetch a single entry
   DatabaseEntry dbe = dbt.fetchSec("1");
   assertNotNull("t12 fetch SEC", dbe );
   TestDoc doc = new TestDoc(); doc = (TestDoc) doc.getBdbBinding().entryToObject(dbe);
   assertEquals("t12 contents SEC", "contents 2", doc.getContents() );

   //*--  fetch an array of entries
View Full Code Here

Examples of com.sleepycat.je.DatabaseEntry

   assertTrue("t13 open db1",  dbt.openDB(DBNAME1, true, dupFlag) );
   assertTrue("t13 open db2",  dbt.openDB(DBNAME2, true, dupFlag) );

   //*-- fetch a single entry from DBNAME1
   dbt.setCurrentDB(DBNAME1);
   String dbKey = "0000000002"; DatabaseEntry data = new DatabaseEntry();
   assertTrue("t13 fetch", dbt.fetch(dbKey, data) );
   TestDoc doc = new TestDoc();
   doc =  (TestDoc) doc.getBdbBinding().entryToObject(data);
   assertEquals("t13 contents from 1", "contents 2", doc.getContents());

   //*-- fetch a single entry from DBNAME2
   dbt.setCurrentDB(DBNAME2);
   dbKey = "0000000012"; data = new DatabaseEntry();
   assertTrue("t13 fetch", dbt.fetch(dbKey, data) );
   doc = new TestDoc();
   doc =  (TestDoc) doc.getBdbBinding().entryToObject(data);
   assertEquals("t13 contents from 2", "contents 12", doc.getContents());

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.