| java.lang.Object org.h2.tools.SimpleResultSet
SimpleResultSet | public class SimpleResultSet implements ResultSet,ResultSetMetaData(Code) | | This class is a simple result set and meta data implementation.
It can be used in Java functions that return a result set.
Only the most basic methods are implemented, the others throw an exception.
This implementation is standalone, and only relies on standard classes.
It can be extended easily if required.
An application can create a result set using the following code:
SimpleResultSet rs = new SimpleResultSet();
rs.addColumn("ID", Types.INTEGER, 10, 0);
rs.addColumn("NAME", Types.VARCHAR, 255, 0);
rs.addRow(new Object[] { new Integer(0), "Hello" });
rs.addRow(new Object[] { new Integer(1), "World" });
|
Constructor Summary | |
public | SimpleResultSet() This constructor is used if the result set is later populated with addRow. | public | SimpleResultSet(SimpleRowSource source) This constructor is used if the result set should retrieve the rows using
the specified row source object. |
Method Summary | |
public boolean | absolute(int row) | public void | addColumn(String name, int sqlType, int precision, int scale) Adds a column to the result set. | public void | addRow(Object[] row) Add a new row to the result set. | public void | afterLast() | public void | beforeFirst() Moves the current position to before the first row, that means resets the
result set. | public void | cancelRowUpdates() | public void | clearWarnings() | public void | close() Closes the result set and releases the resources. | public void | deleteRow() | public int | findColumn(String columnName) Searches for a specific column in the result set. | public boolean | first() | public Array | getArray(int columnIndex) Returns the value as a java.sql.Array. | public Array | getArray(String columnName) Returns the value as a java.sql.Array. | public InputStream | getAsciiStream(int columnIndex) | public InputStream | getAsciiStream(String columnName) | public BigDecimal | getBigDecimal(int columnIndex) Returns the value as a java.math.BigDecimal. | public BigDecimal | getBigDecimal(String columnName) Returns the value as a java.math.BigDecimal. | public BigDecimal | getBigDecimal(int columnIndex, int scale) | public BigDecimal | getBigDecimal(String columnName, int scale) | public InputStream | getBinaryStream(int columnIndex) | public InputStream | getBinaryStream(String columnName) | public Blob | getBlob(int i) | public Blob | getBlob(String colName) | public boolean | getBoolean(int columnIndex) Returns the value as a boolean. | public boolean | getBoolean(String columnName) Returns the value as a boolean. | public byte | getByte(int columnIndex) Returns the value as a byte. | public byte | getByte(String columnName) Returns the value as a byte. | public byte[] | getBytes(int columnIndex) Returns the value as a byte array. | public byte[] | getBytes(String columnName) Returns the value as a byte array. | public String | getCatalogName(int columnIndex) Returns null. | public Reader | getCharacterStream(int columnIndex) | public Reader | getCharacterStream(String columnName) | public Clob | getClob(int i) | public Clob | getClob(String colName) | public String | getColumnClassName(int columnIndex) Returns null. | public int | getColumnCount() Returns the column count. | public int | getColumnDisplaySize(int columnIndex) Returns 15. | public String | getColumnLabel(int columnIndex) Returns the column name. | public String | getColumnName(int columnIndex) Returns the column name. | public int | getColumnType(int columnIndex) Returns the SQL type. | public String | getColumnTypeName(int columnIndex) Returns null. | public int | getConcurrency() Returns ResultSet.CONCUR_READ_ONLY. | public String | getCursorName() | public Date | getDate(int columnIndex) Returns the value as an java.sql.Date. | public Date | getDate(String columnName) Returns the value as a java.sql.Date. | public Date | getDate(int columnIndex, Calendar cal) | public Date | getDate(String columnName, Calendar cal) | public double | getDouble(int columnIndex) Returns the value as an double. | public double | getDouble(String columnName) Returns the value as a double. | public int | getFetchDirection() Returns ResultSet.FETCH_FORWARD. | public int | getFetchSize() Returns 0. | public float | getFloat(int columnIndex) Returns the value as a float. | public float | getFloat(String columnName) Returns the value as a float. | public int | getHoldability() Returns the current result set holdability. | public int | getInt(int columnIndex) Returns the value as an int. | public int | getInt(String columnName) Returns the value as an int. | public long | getLong(int columnIndex) Returns the value as a long. | public long | getLong(String columnName) Returns the value as a long. | public ResultSetMetaData | getMetaData() Returns a reference to itself. | public Reader | getNCharacterStream(int columnIndex) | public Reader | getNCharacterStream(String columnName) | public String | getNString(int columnIndex) | public String | getNString(String columnName) | public Object | getObject(int columnIndex) Returns the value as an Object. | public Object | getObject(String columnName) Returns the value as an Object. | public Object | getObject(int i, Map map) | public Object | getObject(String colName, Map map) | public int | getPrecision(int columnIndex) Returns the precision. | public Ref | getRef(int i) | public Ref | getRef(String colName) | public int | getRow() Returns the row number (1, 2,...) or 0 for no row. | public int | getScale(int columnIndex) Returns the scale. | public String | getSchemaName(int columnIndex) Returns null. | public short | getShort(int columnIndex) Returns the value as a short. | public short | getShort(String columnName) Returns the value as a short. | public Statement | getStatement() Returns null. | public String | getString(int columnIndex) Returns the value as a String. | public String | getString(String columnName) Returns the value as a String. | public String | getTableName(int columnIndex) Returns null. | public Time | getTime(int columnIndex) Returns the value as an java.sql.Time. | public Time | getTime(String columnName) Returns the value as a java.sql.Time. | public Time | getTime(int columnIndex, Calendar cal) | public Time | getTime(String columnName, Calendar cal) | public Timestamp | getTimestamp(int columnIndex) Returns the value as an java.sql.Timestamp. | public Timestamp | getTimestamp(String columnName) Returns the value as a java.sql.Timestamp. | public Timestamp | getTimestamp(int columnIndex, Calendar cal) | public Timestamp | getTimestamp(String columnName, Calendar cal) | public int | getType() Returns ResultSet.TYPE_FORWARD_ONLY. | public URL | getURL(int columnIndex) | public URL | getURL(String columnName) | public InputStream | getUnicodeStream(int columnIndex) | public InputStream | getUnicodeStream(String columnName) | public SQLWarning | getWarnings() Returns null. | public void | insertRow() | public boolean | isAfterLast() | public boolean | isAutoIncrement(int columnIndex) Returns false. | public boolean | isBeforeFirst() | public boolean | isCaseSensitive(int columnIndex) Returns true. | public boolean | isClosed() Returns whether this result set has been closed. | public boolean | isCurrency(int columnIndex) Returns false. | public boolean | isDefinitelyWritable(int columnIndex) Returns false. | public boolean | isFirst() | public boolean | isLast() | public int | isNullable(int columnIndex) Returns ResultSetMetaData.columnNullableUnknown. | public boolean | isReadOnly(int columnIndex) Returns true. | public boolean | isSearchable(int columnIndex) Returns true. | public boolean | isSigned(int columnIndex) Returns true. | public boolean | isWritable(int columnIndex) Returns false. | public boolean | last() | public void | moveToCurrentRow() | public void | moveToInsertRow() | public boolean | next() Moves the cursor to the next row of the result set. | public boolean | previous() | public void | refreshRow() | public boolean | relative(int rows) | public boolean | rowDeleted() | public boolean | rowInserted() | public boolean | rowUpdated() | public void | setFetchDirection(int direction) | public void | setFetchSize(int rows) | public void | updateArray(int columnIndex, Array x) | public void | updateArray(String columnName, Array x) | public void | updateAsciiStream(int columnIndex, InputStream x, int length) | public void | updateAsciiStream(String columnName, InputStream x, int length) | public void | updateAsciiStream(int columnIndex, InputStream x) | public void | updateAsciiStream(String columnName, InputStream x) | public void | updateAsciiStream(int columnIndex, InputStream x, long length) | public void | updateAsciiStream(String columnName, InputStream x, long length) | public void | updateBigDecimal(int columnIndex, BigDecimal x) | public void | updateBigDecimal(String columnName, BigDecimal x) | public void | updateBinaryStream(int columnIndex, InputStream x, int length) | public void | updateBinaryStream(String columnName, InputStream x, int length) | public void | updateBinaryStream(int columnName, InputStream x) | public void | updateBinaryStream(String columnName, InputStream x) | public void | updateBinaryStream(int columnIndex, InputStream x, long length) | public void | updateBinaryStream(String columnName, InputStream x, long length) | public void | updateBlob(int columnIndex, Blob x) | public void | updateBlob(String columnName, Blob x) | public void | updateBlob(int columnIndex, InputStream x) | public void | updateBlob(String columnName, InputStream x) | public void | updateBlob(int columnIndex, InputStream x, long length) | public void | updateBlob(String columnName, InputStream x, long length) | public void | updateBoolean(int columnIndex, boolean x) | public void | updateBoolean(String columnName, boolean x) | public void | updateByte(int columnIndex, byte x) | public void | updateByte(String columnName, byte x) | public void | updateBytes(int columnIndex, byte[] x) | public void | updateBytes(String columnName, byte[] x) | public void | updateCharacterStream(int columnIndex, Reader x, int length) | public void | updateCharacterStream(String columnName, Reader reader, int length) | public void | updateCharacterStream(int columnIndex, Reader x) | public void | updateCharacterStream(String columnName, Reader x) | public void | updateCharacterStream(int columnIndex, Reader x, long length) | public void | updateCharacterStream(String columnName, Reader x, long length) | public void | updateClob(int columnIndex, Clob x) | public void | updateClob(String columnName, Clob x) | public void | updateClob(int columnIndex, Reader x) | public void | updateClob(String columnName, Reader x) | public void | updateClob(int columnIndex, Reader x, long length) | public void | updateClob(String columnName, Reader x, long length) | public void | updateDate(int columnIndex, Date x) | public void | updateDate(String columnName, Date x) | public void | updateDouble(int columnIndex, double x) | public void | updateDouble(String columnName, double x) | public void | updateFloat(int columnIndex, float x) | public void | updateFloat(String columnName, float x) | public void | updateInt(int columnIndex, int x) | public void | updateInt(String columnName, int x) | public void | updateLong(int columnIndex, long x) | public void | updateLong(String columnName, long x) | public void | updateNCharacterStream(int columnIndex, Reader x, int length) | public void | updateNCharacterStream(String columnName, Reader x, int length) | public void | updateNCharacterStream(int columnIndex, Reader x) | public void | updateNCharacterStream(String columnName, Reader x) | public void | updateNCharacterStream(int columnIndex, Reader x, long length) | public void | updateNCharacterStream(String columnName, Reader x, long length) | public void | updateNClob(int columnIndex, Reader x) | public void | updateNClob(String columnName, Reader x) | public void | updateNClob(int columnIndex, Reader x, long length) | public void | updateNClob(String columnName, Reader x, long length) | public void | updateNString(int columnIndex, String nString) | public void | updateNString(String columnName, String nString) | public void | updateNull(String columnName) | public void | updateNull(int columnIndex) | public void | updateObject(int columnIndex, Object x) | public void | updateObject(int columnIndex, Object x, int scale) | public void | updateObject(String columnName, Object x) | public void | updateObject(String columnName, Object x, int scale) | public void | updateRef(int columnIndex, Ref x) | public void | updateRef(String columnName, Ref x) | public void | updateRow() | public void | updateShort(int columnIndex, short x) | public void | updateShort(String columnName, short x) | public void | updateString(int columnIndex, String x) | public void | updateString(String columnName, String x) | public void | updateTime(int columnIndex, Time x) | public void | updateTime(String columnName, Time x) | public void | updateTimestamp(int columnIndex, Timestamp x) | public void | updateTimestamp(String columnName, Timestamp x) | public boolean | wasNull() Returns whether the last column accessed was null. |
SimpleResultSet | public SimpleResultSet()(Code) | | This constructor is used if the result set is later populated with addRow.
|
SimpleResultSet | public SimpleResultSet(SimpleRowSource source)(Code) | | This constructor is used if the result set should retrieve the rows using
the specified row source object.
Parameters: source - the row source |
addColumn | public void addColumn(String name, int sqlType, int precision, int scale) throws SQLException(Code) | | Adds a column to the result set.
Parameters: name - null is replaced with C1, C2,... Parameters: sqlType - the value returned in getColumnType(..) (ignored internally) Parameters: precision - the precision Parameters: scale - the scale throws: SQLException - |
addRow | public void addRow(Object[] row) throws SQLException(Code) | | Add a new row to the result set.
Parameters: row - the row as an array of objects |
beforeFirst | public void beforeFirst() throws SQLException(Code) | | Moves the current position to before the first row, that means resets the
result set.
throws: SQLException - is this method is not supported |
close | public void close() throws SQLException(Code) | | Closes the result set and releases the resources.
|
findColumn | public int findColumn(String columnName) throws SQLException(Code) | | Searches for a specific column in the result set. A case-insensitive
search is made.
Parameters: columnName - the name of the column label the column index (1,2,...) throws: SQLException - if the column is not found or if the result set isclosed |
getArray | public Array getArray(int columnIndex) throws SQLException(Code) | | Returns the value as a java.sql.Array.
the value |
getBigDecimal | public BigDecimal getBigDecimal(int columnIndex) throws SQLException(Code) | | Returns the value as a java.math.BigDecimal.
the value |
getBoolean | public boolean getBoolean(int columnIndex) throws SQLException(Code) | | Returns the value as a boolean.
the value |
getBoolean | public boolean getBoolean(String columnName) throws SQLException(Code) | | Returns the value as a boolean.
the value |
getByte | public byte getByte(int columnIndex) throws SQLException(Code) | | Returns the value as a byte.
the value |
getBytes | public byte[] getBytes(int columnIndex) throws SQLException(Code) | | Returns the value as a byte array.
the value |
getBytes | public byte[] getBytes(String columnName) throws SQLException(Code) | | Returns the value as a byte array.
the value |
getColumnCount | public int getColumnCount() throws SQLException(Code) | | Returns the column count.
the column count |
getColumnDisplaySize | public int getColumnDisplaySize(int columnIndex) throws SQLException(Code) | | Returns 15.
15 |
getColumnLabel | public String getColumnLabel(int columnIndex) throws SQLException(Code) | | Returns the column name.
the column name |
getColumnName | public String getColumnName(int columnIndex) throws SQLException(Code) | | Returns the column name.
the column name |
getColumnType | public int getColumnType(int columnIndex) throws SQLException(Code) | | Returns the SQL type.
the SQL type |
getConcurrency | public int getConcurrency() throws SQLException(Code) | | Returns ResultSet.CONCUR_READ_ONLY.
CONCUR_READ_ONLY |
getDate | public Date getDate(int columnIndex) throws SQLException(Code) | | Returns the value as an java.sql.Date.
the value |
getDouble | public double getDouble(int columnIndex) throws SQLException(Code) | | Returns the value as an double.
the value |
getFetchDirection | public int getFetchDirection() throws SQLException(Code) | | Returns ResultSet.FETCH_FORWARD.
FETCH_FORWARD |
getFloat | public float getFloat(int columnIndex) throws SQLException(Code) | | Returns the value as a float.
the value |
getHoldability | public int getHoldability()(Code) | | Returns the current result set holdability.
the holdability |
getInt | public int getInt(int columnIndex) throws SQLException(Code) | | Returns the value as an int.
the value |
getLong | public long getLong(int columnIndex) throws SQLException(Code) | | Returns the value as a long.
the value |
getPrecision | public int getPrecision(int columnIndex) throws SQLException(Code) | | Returns the precision.
the precision |
getRow | public int getRow() throws SQLException(Code) | | Returns the row number (1, 2,...) or 0 for no row.
0 |
getScale | public int getScale(int columnIndex) throws SQLException(Code) | | Returns the scale.
the scale |
getShort | public short getShort(int columnIndex) throws SQLException(Code) | | Returns the value as a short.
the value |
getTime | public Time getTime(int columnIndex) throws SQLException(Code) | | Returns the value as an java.sql.Time.
the value |
getTimestamp | public Timestamp getTimestamp(int columnIndex) throws SQLException(Code) | | Returns the value as an java.sql.Timestamp.
the value |
getType | public int getType() throws SQLException(Code) | | Returns ResultSet.TYPE_FORWARD_ONLY.
TYPE_FORWARD_ONLY |
isAutoIncrement | public boolean isAutoIncrement(int columnIndex) throws SQLException(Code) | | Returns false.
false |
isCaseSensitive | public boolean isCaseSensitive(int columnIndex) throws SQLException(Code) | | Returns true.
true |
isClosed | public boolean isClosed() throws SQLException(Code) | | Returns whether this result set has been closed.
true if the result set was closed |
isCurrency | public boolean isCurrency(int columnIndex) throws SQLException(Code) | | Returns false.
false |
isDefinitelyWritable | public boolean isDefinitelyWritable(int columnIndex) throws SQLException(Code) | | Returns false.
false |
isNullable | public int isNullable(int columnIndex) throws SQLException(Code) | | Returns ResultSetMetaData.columnNullableUnknown.
columnNullableUnknown |
isReadOnly | public boolean isReadOnly(int columnIndex) throws SQLException(Code) | | Returns true.
true |
isSearchable | public boolean isSearchable(int columnIndex) throws SQLException(Code) | | Returns true.
true |
isSigned | public boolean isSigned(int columnIndex) throws SQLException(Code) | | Returns true.
true |
isWritable | public boolean isWritable(int columnIndex) throws SQLException(Code) | | Returns false.
false |
next | public boolean next() throws SQLException(Code) | | Moves the cursor to the next row of the result set.
true if successful, false if there are no more rows |
setFetchDirection | public void setFetchDirection(int direction) throws SQLException(Code) | | INTERNAL
|
updateBoolean | public void updateBoolean(int columnIndex, boolean x) throws SQLException(Code) | | INTERNAL
|
updateByte | public void updateByte(int columnIndex, byte x) throws SQLException(Code) | | INTERNAL
|
updateBytes | public void updateBytes(int columnIndex, byte[] x) throws SQLException(Code) | | INTERNAL
|
updateCharacterStream | public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException(Code) | | INTERNAL
|
updateCharacterStream | public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException(Code) | | INTERNAL
|
updateDouble | public void updateDouble(int columnIndex, double x) throws SQLException(Code) | | INTERNAL
|
updateFloat | public void updateFloat(int columnIndex, float x) throws SQLException(Code) | | INTERNAL
|
updateLong | public void updateLong(int columnIndex, long x) throws SQLException(Code) | | INTERNAL
|
updateNCharacterStream | public void updateNCharacterStream(int columnIndex, Reader x, int length) throws SQLException(Code) | | INTERNAL
|
updateNCharacterStream | public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException(Code) | | INTERNAL
|
updateShort | public void updateShort(int columnIndex, short x) throws SQLException(Code) | | INTERNAL
|
wasNull | public boolean wasNull() throws SQLException(Code) | | Returns whether the last column accessed was null.
true if the last column accessed was null |
|
|