import simpledb.server.SimpleDB; import simpledb.tx.Transaction; import simpledb.record.*; import static java.sql.Types.INTEGER; public class Hw6Test { public static void main(String[] args) throws Exception { SimpleDB.init("studentdb"); Transaction tx = new Transaction(); TableInfo ti = SimpleDB.mdMgr().getTableInfo("student", tx); Schema sch = ti.schema(); RecordFile rf = new RecordFile(ti, tx); for (String fldname : ti.schema().fields()) System.out.print(fldname + "\t"); System.out.println(); rf.afterLast(); while (rf.previous()) { for (String fldname : sch.fields()) if (sch.type(fldname) == INTEGER) System.out.print(rf.getInt(fldname) + "\t"); else System.out.print(rf.getString(fldname) + "\t"); System.out.println(); } rf.close(); tx.commit(); } }