MCPcopy Create free account
hub / github.com/1345414527/MIT6.830 / insertRow

Method insertRow

test/simpledb/systemtest/LogTest.java:29–46  ·  view source on GitHub ↗
(HeapFile hf, Transaction t, int v1)

Source from the content-addressed store, hash-verified

27 HeapFile hf2;
28
29 void insertRow(HeapFile hf, Transaction t, int v1)
30 throws DbException, TransactionAbortedException {
31 // Create a row to insert
32 TupleDesc twoIntColumns = Utility.getTupleDesc(2);
33 Tuple value = new Tuple(twoIntColumns);
34 value.setField(0, new IntField(v1));
35 value.setField(1, new IntField(0));
36 TupleIterator insertRow = new TupleIterator(Utility.getTupleDesc(2), Collections.singletonList(value));
37
38 // Insert the row
39 Insert insert = new Insert(t.getId(), insertRow, hf.getId());
40 insert.open();
41 Tuple result = insert.next();
42 assertEquals(SystemTestUtil.SINGLE_INT_DESCRIPTOR, result.getTupleDesc());
43 assertEquals(1, ((IntField)result.getField(0)).getValue());
44 assertFalse(insert.hasNext());
45 insert.close();
46 }
47
48 // check that the specified tuple is, or is not, present
49 void look(HeapFile hf, Transaction t, int v1, boolean present)

Callers 7

doInsertMethod · 0.95
dontInsertMethod · 0.95
TestFlushAllMethod · 0.95
TestOpenCrashMethod · 0.95

Calls 10

getTupleDescMethod · 0.95
setFieldMethod · 0.95
openMethod · 0.95
getTupleDescMethod · 0.95
getFieldMethod · 0.95
closeMethod · 0.95
getIdMethod · 0.65
nextMethod · 0.65
hasNextMethod · 0.65
getValueMethod · 0.45

Tested by

no test coverage detected