public class SeqScan extends java.lang.Object implements DbIterator
Modifier and Type | Field and Description |
---|---|
private DbFileIterator |
iterator |
private static long |
serialVersionUID |
private java.lang.String |
tableAlias |
private int |
tableId |
private TransactionId |
tid |
Constructor and Description |
---|
SeqScan(TransactionId tid,
int tableid) |
SeqScan(TransactionId tid,
int tableid,
java.lang.String tableAlias)
Creates a sequential scan over the specified table as a part of the
specified transaction.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the iterator
|
java.lang.String |
getAlias() |
java.lang.String |
getTableName() |
TupleDesc |
getTupleDesc()
Returns the TupleDesc with field names from the underlying HeapFile,
prefixed with the tableAlias string from the constructor.
|
boolean |
hasNext()
Returns true if the iterator still has tuples
|
Tuple |
next()
Return next tuple in the iterator
|
void |
open()
Opens the Scanner for reading
|
void |
reset(int tableid,
java.lang.String tableAlias)
Reset the tableid, and tableAlias of this operator.
|
void |
rewind()
Rewinds the iterator to the start
|
private static final long serialVersionUID
private TransactionId tid
private int tableId
private java.lang.String tableAlias
private DbFileIterator iterator
public SeqScan(TransactionId tid, int tableid, java.lang.String tableAlias)
tid
- The transaction this scan is running as a part of.tableid
- the table to scan.tableAlias
- the alias of this table (needed by the parser); the returned
tupleDesc should have fields with name tableAlias.fieldName
(note: this class is not responsible for handling a case where
tableAlias or fieldName are null. It shouldn't crash if they
are, but the resulting name can be null.fieldName,
tableAlias.null, or null.null).public SeqScan(TransactionId tid, int tableid)
public java.lang.String getTableName()
public java.lang.String getAlias()
public void reset(int tableid, java.lang.String tableAlias)
tableid
- the table to scan.tableAlias
- the alias of this table (needed by the parser); the returned
tupleDesc should have fields with name tableAlias.fieldName
(note: this class is not responsible for handling a case where
tableAlias or fieldName are null. It shouldn't crash if they
are, but the resulting name can be null.fieldName,
tableAlias.null, or null.null).public void open() throws DbException, TransactionAbortedException
open
in interface DbIterator
DbException
TransactionAbortedException
public TupleDesc getTupleDesc()
getTupleDesc
in interface DbIterator
public boolean hasNext() throws TransactionAbortedException, DbException
hasNext
in interface DbIterator
TransactionAbortedException
DbException
public Tuple next() throws java.util.NoSuchElementException, TransactionAbortedException, DbException
next
in interface DbIterator
java.util.NoSuchElementException
TransactionAbortedException
DbException
public void close()
close
in interface DbIterator
public void rewind() throws DbException, java.util.NoSuchElementException, TransactionAbortedException
rewind
in interface DbIterator
DbException
java.util.NoSuchElementException
TransactionAbortedException