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, setEstimatedCardinalityprivate 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()
DbIteratorgetTupleDesc in interface DbIteratorgetTupleDesc in class Operatorpublic void open()
throws DbException,
TransactionAbortedException
DbIteratoropen in interface DbIteratoropen in class OperatorDbException - when there are problems opening/accessing the database.TransactionAbortedExceptionpublic void close()
Operatorclose in interface DbIteratorclose in class Operatorpublic void rewind()
throws DbException,
TransactionAbortedException
DbIteratorDbException - when rewind is unsupported.TransactionAbortedExceptionprotected Tuple fetchNext() throws TransactionAbortedException, DbException
fetchNext in class OperatorTransactionAbortedExceptionDbExceptionDatabase.getBufferPool(),
BufferPool.insertTuple(simpledb.TransactionId, int, simpledb.Tuple)public DbIterator[] getChildren()
getChildren in class Operatorpublic void setChildren(DbIterator[] children)
OperatorsetChildren in class Operatorchildren - the DbIterators which are to be set as the children(child) of
this operator