Reset the tableid, and tableAlias of this operator. @param tableid the table to scan. @param 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 respon
(int tableid, String tableAlias)
| 84 | * tableAlias.null, or null.null). |
| 85 | */ |
| 86 | public void reset(int tableid, String tableAlias) { |
| 87 | this.isOpen=false; |
| 88 | this.alias = tableAlias; |
| 89 | this.tablename = Database.getCatalog().getTableName(tableid); |
| 90 | if(ipred == null) { |
| 91 | this.it = Database.getCatalog().getDatabaseFile(tableid).iterator(tid); |
| 92 | } |
| 93 | else { |
| 94 | this.it = ((BTreeFile) Database.getCatalog().getDatabaseFile(tableid)).indexIterator(tid, ipred); |
| 95 | } |
| 96 | myTd = Database.getCatalog().getTupleDesc(tableid); |
| 97 | String[] newNames = new String[myTd.numFields()]; |
| 98 | Type[] newTypes = new Type[myTd.numFields()]; |
| 99 | for (int i = 0; i < myTd.numFields(); i++) { |
| 100 | String name = myTd.getFieldName(i); |
| 101 | Type t = myTd.getFieldType(i); |
| 102 | |
| 103 | newNames[i] = tableAlias + "." + name; |
| 104 | newTypes[i] = t; |
| 105 | } |
| 106 | myTd = new TupleDesc(newTypes, newNames); |
| 107 | } |
| 108 | |
| 109 | public BTreeScan(TransactionId tid, int tableid, IndexPredicate ipred) { |
| 110 | this(tid, tableid, Database.getCatalog().getTableName(tableid), ipred); |
no test coverage detected