public class Insert extends Operator
Modifier and Type | Field and Description |
---|---|
private boolean |
calledOnce |
private DbIterator |
iterator |
private static long |
serialVersionUID |
private int |
tableId |
private TransactionId |
tid |
Constructor and Description |
---|
Insert(TransactionId t,
DbIterator child,
int tableid)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this iterator.
|
protected Tuple |
fetchNext()
Inserts tuples read from child into the tableid specified by the
constructor.
|
DbIterator[] |
getChildren() |
TupleDesc |
getTupleDesc()
Returns the TupleDesc associated with this DbIterator.
|
void |
open()
Opens the iterator.
|
void |
rewind()
Resets the iterator to the start.
|
void |
setChildren(DbIterator[] children)
Set the children(child) of this operator.
|
getEstimatedCardinality, hasNext, next, setEstimatedCardinality
private static final long serialVersionUID
private TransactionId tid
private DbIterator iterator
private int tableId
private boolean calledOnce
public Insert(TransactionId t, DbIterator child, int tableid) throws DbException
t
- The transaction running the insert.child
- The child operator from which to read tuples to be inserted.tableid
- The table in which to insert tuples.DbException
- if TupleDesc of child differs from table into which we are to
insert.public TupleDesc getTupleDesc()
DbIterator
getTupleDesc
in interface DbIterator
getTupleDesc
in class Operator
public void open() throws DbException, TransactionAbortedException
DbIterator
open
in interface DbIterator
open
in class Operator
DbException
- when there are problems opening/accessing the database.TransactionAbortedException
public void close()
Operator
close
in interface DbIterator
close
in class Operator
public void rewind() throws DbException, TransactionAbortedException
DbIterator
DbException
- when rewind is unsupported.TransactionAbortedException
protected Tuple fetchNext() throws TransactionAbortedException, DbException
fetchNext
in class Operator
TransactionAbortedException
DbException
Database.getBufferPool()
,
BufferPool.insertTuple(simpledb.TransactionId, int, simpledb.Tuple)
public DbIterator[] getChildren()
getChildren
in class Operator
public void setChildren(DbIterator[] children)
Operator
setChildren
in class Operator
children
- the DbIterators which are to be set as the children(child) of
this operator