01: /*
02: * Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0
03: * (http://h2database.com/html/license.html).
04: * Initial Developer: H2 Group
05: */
06: package org.h2.index;
07:
08: import java.sql.SQLException;
09:
10: import org.h2.message.Message;
11: import org.h2.result.Row;
12: import org.h2.result.SearchRow;
13: import org.h2.util.ObjectArray;
14:
15: /**
16: * An index for a meta data table.
17: * This index can only scan through all rows, search is not supported.
18: */
19: public class MetaCursor implements Cursor {
20:
21: private Row current;
22: private ObjectArray rows;
23: private int index;
24:
25: MetaCursor(ObjectArray rows) {
26: this .rows = rows;
27: }
28:
29: public Row get() {
30: return current;
31: }
32:
33: public SearchRow getSearchRow() throws SQLException {
34: return current;
35: }
36:
37: public int getPos() {
38: throw Message.getInternalError();
39: }
40:
41: public boolean next() throws SQLException {
42: current = (Row) (index >= rows.size() ? null : rows
43: .get(index++));
44: return current != null;
45: }
46:
47: }
|