public class SeqScan extends java.lang.Object implements DbIterator
| Modifier and Type | Field and Description |
|---|---|
private static long |
serialVersionUID |
| 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 has more tuples.
|
Tuple |
next()
Returns the next tuple from the operator (typically implementing by reading
from a child operator or an access method).
|
void |
open()
Opens the iterator.
|
void |
reset(int tableid,
java.lang.String tableAlias)
Reset the tableid, and tableAlias of this operator.
|
void |
rewind()
Resets the iterator to the start.
|
private static final long serialVersionUID
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
DbIteratoropen in interface DbIteratorDbException - when there are problems opening/accessing the database.TransactionAbortedExceptionpublic TupleDesc getTupleDesc()
getTupleDesc in interface DbIteratorpublic boolean hasNext()
throws TransactionAbortedException,
DbException
DbIteratorhasNext in interface DbIteratorTransactionAbortedExceptionDbExceptionpublic Tuple next() throws java.util.NoSuchElementException, TransactionAbortedException, DbException
DbIteratornext in interface DbIteratorjava.util.NoSuchElementException - if there are no more tuples.TransactionAbortedExceptionDbExceptionpublic void close()
DbIteratorclose in interface DbIteratorpublic void rewind()
throws DbException,
java.util.NoSuchElementException,
TransactionAbortedException
DbIteratorrewind in interface DbIteratorDbException - when rewind is unsupported.java.util.NoSuchElementExceptionTransactionAbortedException