Package jdbm

Examples of jdbm.RecordManager.fetch()


        // insert a 1500 byte record.
        byte[] data = UtilTT.makeRecord(1500, (byte) 1);
        long rowid = recman.insert(data);
        assertTrue("check data1",
               UtilTT.checkRecord((byte[]) recman.fetch(rowid), 1500, (byte) 1) );


        // delete the record
        recman.delete(rowid);
View Full Code Here


        // insert a 0 byte record. Should have the same rowid.
        data = UtilTT.makeRecord(0, (byte) 2);
        long rowid2 = recman.insert(data);
        assertEquals("old and new rowid", rowid, rowid2);
        assertTrue("check data2",
               UtilTT.checkRecord((byte[]) recman.fetch(rowid2), 0, (byte) 2) );

        // now make the record a bit bigger
        data = UtilTT.makeRecord(10000, (byte) 3);
        recman.update(rowid, data);
        assertTrue("check data3",
View Full Code Here

        // now make the record a bit bigger
        data = UtilTT.makeRecord(10000, (byte) 3);
        recman.update(rowid, data);
        assertTrue("check data3",
               UtilTT.checkRecord((byte[]) recman.fetch(rowid), 10000, (byte) 3) );

        // .. and again
        data = UtilTT.makeRecord(30000, (byte) 4);
        recman.update(rowid, data);
        assertTrue("check data3",
View Full Code Here

        // .. and again
        data = UtilTT.makeRecord(30000, (byte) 4);
        recman.update(rowid, data);
        assertTrue("check data3",
               UtilTT.checkRecord((byte[]) recman.fetch(rowid), 30000, (byte) 4) );

        // close the file
        recman.close();
    }
View Full Code Here

        // insert a 150000 byte record.
        byte[] data1 = UtilTT.makeRecord(150000, (byte) 1);
        long rowid1 = recman.insert(data1);
        assertTrue("check data1",
               UtilTT.checkRecord((byte[]) recman.fetch(rowid1), 150000, (byte) 1) );

        // rollback transaction, should revert to previous state
        recman.rollback();

        // insert same 150000 byte record.
View Full Code Here

        // insert same 150000 byte record.
        byte[] data2 = UtilTT.makeRecord(150000, (byte) 1);
        long rowid2 = recman.insert(data2);
        assertTrue("check data2",
               UtilTT.checkRecord((byte[]) recman.fetch(rowid2), 150000, (byte) 1) );

        assertEquals("old and new rowid", rowid1, rowid2);

        recman.commit();
View Full Code Here

        // insert a 150000 byte record.
        data1 = UtilTT.makeRecord(150000, (byte) 2);
        rowid1 = recman.insert(data1);
        assertTrue("check data1",
               UtilTT.checkRecord((byte[]) recman.fetch(rowid1), 150000, (byte) 2) );

        // rollback transaction, should revert to previous state
        recman.rollback();

        // insert same 150000 byte record.
View Full Code Here

        // insert same 150000 byte record.
        data2 = UtilTT.makeRecord(150000, (byte) 2);
        rowid2 = recman.insert(data2);
        assertTrue("check data2",
               UtilTT.checkRecord((byte[]) recman.fetch(rowid2), 150000, (byte) 2) );

        assertEquals("old and new rowid", rowid1, rowid2);

        // close the file
        recman.close();
View Full Code Here

   
    public void testNonExistingRecid() throws IOException{
      RecordManager recman = newRecordManager();
     
      Object obj = recman.fetch(6666666);
      assertTrue(obj == null);
     
      try{
        recman.update(6666666, obj);
        recman.commit();
View Full Code Here

         
    RecordManager recman = new BaseRecordManager(newTestFile());
   
    byte[] data = UtilTT.makeRecord(1000000, (byte) 12);
    final long id = recman.insert(data);   
    data = (byte[]) recman.fetch(id);
    UtilTT.checkRecord(data, 1000000, (byte) 12);
    recman.commit();

    data = UtilTT.makeRecord(2000000, (byte) 13);
    recman.update(id, 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.