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.result.Row;
11: import org.h2.result.SearchRow;
12:
13: /**
14: * A cursor is a helper object to iterate through an index.
15: * For indexes are sorted (such as the b tree index), it can iterate
16: * to the very end of the index. For other indexes that don't support
17: * that (such as a hash index), only one row is returned.
18: * The cursor is initially positioned before the first row, that means
19: * next() must be called before accessing data.
20: *
21: */
22: public interface Cursor {
23:
24: /**
25: * Get the complete current row.
26: * All column are available.
27: *
28: * @return the complete row
29: */
30: Row get() throws SQLException;
31:
32: /**
33: * Get the current row.
34: * Only the data for indexed columns is available in this row.
35: *
36: * @return the search row
37: */
38: SearchRow getSearchRow() throws SQLException;
39:
40: /**
41: * Get the position of the current row.
42: *
43: * @return the position
44: */
45: int getPos();
46:
47: /**
48: * Skip to the next row if one is available.
49: *
50: * @return true if another row is available
51: */
52: boolean next() throws SQLException;
53:
54: }
|