import simpledb.server.SimpleDB; import simpledb.file.Block; import simpledb.tx.Transaction; public class TxMgrTest { public static void main(String[] args) throws Exception { SimpleDB.init("testdb"); Transaction tx = new Transaction(); Block blk = new Block("testfile", 0); tx.pin(blk); int ival = tx.getInt(blk, 20); String sval = tx.getString(blk, 40); System.out.println("current value at location 20 = " + ival); System.out.println("current value at location 40 = " + sval); tx.setInt(blk, 20, ival+1); tx.setString(blk, 40, sval+"1"); tx.unpin(blk); tx.commit(); Transaction tx2 = new Transaction(); tx2.pin(blk); System.out.println("new value at location 20 = " + tx2.getInt(blk, 20)); System.out.println("new value at location 40 = " + tx2.getString(blk, 40)); tx2.unpin(blk); tx2.commit(); } }