Mimer JDBC Engine 2.12

com.mimer.jdbc
Class ResultSet

java.lang.Object
  |
  +--com.mimer.jdbc.ResultSet
All Implemented Interfaces:
ResultSet

public class ResultSet
extends Object
implements ResultSet

Represents a result set, either forward only or scrollable.

The below table shows which Mimer SQL server data types are accessible from the specified JDBC getter methods. Those data types that may be retrieved using a specific getter method may also be set using the corresponding setter method with a PreparedStatement object.

OT SI IN N(n) BI RE FL FL(n) DP DC NU BI CH CV BI BV NCH NCV DT TI TS IV IV2 BL CL NCL
getByte X x x x x x x x x x x x x x - - x x - - - - - - - -
getShort x X x x x x x x x x x x x x - - x x - - - - - - - -
getInt x x X x x x x x x x x x x x - - x x - - - - - - - -
getLong x x x x X x x x x x x x x x - - x x - - - - - - - -
getFloat x x x x x X x x x x x x x x - - x x - - - - - - - -
getDouble x x x x x x X X X x x x x x - - x x - - - - - - - -
getBigDecimal x x x x x x x x x X X x x x - - x x - - - - - - - -
getBoolean x x x x x x x x x x x X x x - - x x - - - - - - - -
getString x x x x x x x x x x x x X X - - x x x x x x x - - -
getBytes - - - - - - - - - - - - - - X X - - - - - - - - - -
getDate - - - - - - - - - - - - x x - - x x X x x - - - - -
getTime - - - - - - - - - - - - x x - - x x x X x - - - - -
getTimestamp - - - - - - - - - - - - x x - - x x x x X - - - - -
getAsciiStream - - - - - - - - - - - - x x x x x x - - - - - - x x
getBinaryStream - - - - - - - - - - - - - - x x - - - - - - - x - -
getCharacterStream - - - - - - - - - - - - x x - - x x - - - - - - x x
getClob - - - - - - - - - - - - - - - - - - - - - - - - x x
getBlob - - - - - - - - - - - - - - - - - - - - - - - x - -
getArray - - - - - - - - - - - - - - - - - - - - - - - - - -
getRef - - - - - - - - - - - - - - - - - - - - - - - - - -
getURL - - - - - - - - - - - - - - - - - - - - - - - - - -
getObject x x x x x x x x x x x x x x x x x x x x x x x x x x

Abbreviations in table above:

OTODBC.TINYINT
SISMALLINT
ININTEGER
IN(n)INTEGER(n)
BIBIGINT
REREAL
FLFLOAT
FL(n)FLOAT(n)
DPDOUBLE PRECISION
DCDECIMAL
NUNUMERIC
BIODBC.BIT
CHCHARACTER
VCCHARACTER VARYING
BIBINARY
VBBINARY VARYING
NCHNATIONAL CHARACTER
NVCNATIONAL CHARACTER VARYING
DTDATE
TITIME
TSTIMESTAMP
IVINTERVAL YEAR
INTERVAL MONTH
INTERVAL DAY
INTERVAL HOUR
INTERVAL MINUTE
INTERVAL SECOND
IV2INTERVAL YEAR TO MONTH
INTERVAL DAY TO HOUR
INTERVAL DAY TO MINUTE
INTERVAL DAY TO SECOND
INTERVAL HOUR TO MINUTE
INTERVAL HOUR TO SECOND
INTERVAL MINUTE TO SECOND
BLBINARY LARGE OBJECT
CLCHARACTER LARGE OBJECT
NCLNATIONAL CHARACTER LARGE OBJECT


Field Summary
 
Fields inherited from interface java.sql.ResultSet
CLOSE_CURSORS_AT_COMMIT, CONCUR_READ_ONLY, CONCUR_UPDATABLE, FETCH_FORWARD, FETCH_REVERSE, FETCH_UNKNOWN, HOLD_CURSORS_OVER_COMMIT, TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE, TYPE_SCROLL_SENSITIVE
 
Method Summary
 boolean absolute(int row)
          Positions the cursor on a absolute position.
 void afterLast()
          Positions the cursor after the end of the result set.
 void beforeFirst()
          Positions the cursor before the beginning of the result set.
 void cancelRowUpdates()
          Cancels the updates made to the current row in this ResultSet object.
 void clearWarnings()
          Clears all warnings reported on the object.
 void close()
          Closes the statement.
 void deleteRow()
          Deletes the current row from this ResultSet object and from the underlying database.
 int findColumn(String columnName)
          Finds a column index from a column name.
 boolean first()
          Positions the cursor at the first row of the result set.
 Array getArray(int columnIndex)
          Get an SQL array.
 Array getArray(String columnName)
          Get an SQL array.
 InputStream getAsciiStream(int columnIndex)
          Returns an ascii stream representing the result set column.
 InputStream getAsciiStream(String columnName)
          Returns an ascii stream representing the result set column.
 BigDecimal getBigDecimal(int columnIndex)
          Returns a java.math.BigDecimal object without scale.
 BigDecimal getBigDecimal(int columnIndex, int scale)
          Returns a java.math.BigDecimal object.
 BigDecimal getBigDecimal(String columnName)
          Returns a java.math.BigDecimal object.
 BigDecimal getBigDecimal(String columnName, int scale)
          Returns a java.math.BigDecimal object.
 InputStream getBinaryStream(int columnIndex)
          Returns an binary stream representing the result set column.
 InputStream getBinaryStream(String columnName)
          Returns an binary stream representing the result set column.
 Blob getBlob(int columnIndex)
          Get a BLOB LOCATOR object.
 Blob getBlob(String columnName)
          Get a BLOB LOCATOR object.
 boolean getBoolean(int columnIndex)
          Returns a boolean.
 boolean getBoolean(String columnName)
          Returns a boolean.
 byte getByte(int columnIndex)
          Returns a byte.
 byte getByte(String columnName)
          Returns a byte.
 byte[] getBytes(int columnIndex)
          Returns an array of bytes.
 byte[] getBytes(String columnName)
          Returns an array of bytes.
 Reader getCharacterStream(int columnIndex)
          Get a character stream.
 Reader getCharacterStream(String columnName)
          Get a character stream.
 Clob getClob(int columnIndex)
          Get a CLOB LOCATOR object.
 Clob getClob(String columnName)
          Get a CLOB LOCATOR object.
 int getConcurrency()
          Returns the concurrency mode for this result set.
 String getCursorName()
          Returns the name of this cursor.
 Date getDate(int columnIndex)
          Returns a Date.
 Date getDate(int columnIndex, Calendar cal)
          Get a date with timezone compensation.
 Date getDate(String columnName)
          Return a date.
 Date getDate(String columnName, Calendar cal)
          Get a date with timezone compensation.
 double getDouble(int columnIndex)
          Returns a double.
 double getDouble(String columnName)
          Returns a double.
 int getFetchDirection()
          Gets the current fetch direction hint.
 int getFetchSize()
          Retrieves the current fetch size.
 float getFloat(int columnIndex)
          Returns a float.
 float getFloat(String columnName)
          Returns a float.
 int getInt(int columnIndex)
          Returns an integer.
 int getInt(String columnName)
          Returns an integer.
 long getLong(int columnIndex)
          Returns an long.
 long getLong(String columnName)
          Returns an long.
 ResultSetMetaData getMetaData()
          Returns a ResultSetMetaData object describing the result set.
 Object getObject(int columnIndex)
          Returns an object.
 Object getObject(int columnIndex, Map map)
          Get object with type map.
 Object getObject(String columnName)
          Returns an object.
 Object getObject(String columnName, Map map)
          Get object with type map.
 Ref getRef(int columnIndex)
          Get a reference type.
 Ref getRef(String columnName)
          Get a reference type.
 int getRow()
          Return the current row number.
 short getShort(int columnIndex)
          Returns a short.
 short getShort(String columnName)
          Returns a short.
 Statement getStatement()
          Get the statement that belongs to this result set.
 String getString(int columnIndex)
          Returns a string.
 String getString(String columnName)
          Returns a string.
 Time getTime(int columnIndex)
          Returns a time.
 Time getTime(int columnIndex, Calendar cal)
          Get a time with timezone compensation.
 Time getTime(String columnName)
          Returns a time.
 Time getTime(String columnName, Calendar cal)
          Get a time with timezone compensation.
 Timestamp getTimestamp(int columnIndex)
          Returns a timestamp.
 Timestamp getTimestamp(int columnIndex, Calendar cal)
          Get a timestamp with timezone compensation.
 Timestamp getTimestamp(String columnName)
          Returns a time.
 Timestamp getTimestamp(String columnName, Calendar cal)
          Get a timestamp with timezone compensation.
 int getType()
          Return the type of the result set.
 InputStream getUnicodeStream(int columnIndex)
           
 InputStream getUnicodeStream(String columnName)
           
 SQLWarning getWarnings()
          Returns the first warning posted to this object.
 void insertRow()
          Inserts the contents of the insert row into this ResultSet object and into the database.
 boolean isAfterLast()
          Returns true if the current row is after the last row of the result set.
 boolean isBeforeFirst()
          Returns true if the current row is before the first row of the result set.
 boolean isFirst()
          Returns true if the current row is at the first row of the result set.
 boolean isLast()
          Returns true if the current row is at the last row of the result set.
 boolean last()
          Positions the cursor on the last row of the result set.
 void moveToCurrentRow()
          Moves the cursor to the remembered cursor position, usually the current row.
 void moveToInsertRow()
          Moves the cursor to the insert row.
 boolean next()
          Moves on to the next row in the result set.
 boolean previous()
          Positions the cursor one row backwards in the result set.
 void refreshRow()
          The refreshRow method provides a way for an application to explicitly tell the JDBC driver to refetch a row(s) from the database.
 boolean relative(int rows)
          Positioning relative to the current cursor position.
 boolean rowDeleted()
          Indicates whether a row has been deleted.
 boolean rowInserted()
          Indicates whether the current row has had an insertion.
 boolean rowUpdated()
          Indicates whether the current row has been updated.
 void setFetchDirection(int direction)
          Sets the current fetch direction hint.
 void setFetchSize(int rows)
          Sets the current fetch size.
 void updateAsciiStream(int columnIndex, InputStream x, int length)
          Updates the designated column with an ascii stream value.
 void updateAsciiStream(String columnName, InputStream x, int length)
          Updates the designated column with an ascii stream value.
 void updateBigDecimal(int columnIndex, BigDecimal x)
          Updates the designated column with a java.math.BigDecimal value.
 void updateBigDecimal(String columnName, BigDecimal x)
          Updates the designated column with a java.math.BigDecimal value.
 void updateBinaryStream(int columnIndex, InputStream x, int length)
          Updates the designated column with a binary stream value.
 void updateBinaryStream(String columnName, InputStream x, int length)
          Updates the designated column with a binary stream value.
 void updateBoolean(int columnIndex, boolean x)
          Updates the designated column with a boolean value.
 void updateBoolean(String columnName, boolean x)
          Updates the designated column with a boolean value.
 void updateByte(int columnIndex, byte x)
          Updates the designated column with a byte value.
 void updateByte(String columnName, byte x)
          Updates the designated column with a byte value.
 void updateBytes(int columnIndex, byte[] x)
          Updates the designated column with a byte array value.
 void updateBytes(String columnName, byte[] x)
          Updates the designated column with a byte array value.
 void updateCharacterStream(int columnIndex, Reader x, int length)
          Updates the designated column with a character stream value.
 void updateCharacterStream(String columnName, Reader x, int length)
          Updates the designated column with a character stream value.
 void updateDate(int columnIndex, Date x)
          Updates the designated column with a java.sql.Date value.
 void updateDate(String columnName, Date x)
          Updates the designated column with a java.sql.Date value.
 void updateDouble(int columnIndex, double x)
          Updates the designated column with a double value.
 void updateDouble(String columnName, double x)
          Updates the designated column with a double value.
 void updateFloat(int columnIndex, float x)
          Updates the designated column with a float value.
 void updateFloat(String columnName, float x)
          Updates the designated column with a float value.
 void updateInt(int columnIndex, int x)
          Updates the designated column with an int value.
 void updateInt(String columnName, int x)
          Updates the designated column with an int value.
 void updateLong(int columnIndex, long x)
          Updates the designated column with a long value.
 void updateLong(String columnName, long x)
          Updates the designated column with a long value.
 void updateNull(int columnIndex)
          Gives a nullable column a null value.
 void updateNull(String columnName)
          Gives a nullable column a null value.
 void updateObject(int columnIndex, Object x)
          Updates the designated column with an Object value.
 void updateObject(int columnIndex, Object x, int scale)
          Updates the designated column with an Object value.
 void updateObject(String columnName, Object x)
          Updates the designated column with an Object value.
 void updateObject(String columnName, Object x, int scale)
          Updates the designated column with an Object value.
 void updateRow()
          Updates the underlying database with the new contents of the current row of this ResultSet object.
 void updateShort(int columnIndex, short x)
          Updates the designated column with a short value.
 void updateShort(String columnName, short x)
          Updates the designated column with a short value.
 void updateString(int columnIndex, String x)
          Updates the designated column with a String value.
 void updateString(String columnName, String x)
          Updates the designated column with a String value.
 void updateTime(int columnIndex, Time x)
          Updates the designated column with a java.sql.Time value.
 void updateTime(String columnName, Time x)
          Updates the designated column with a java.sql.Time value.
 void updateTimestamp(int columnIndex, Timestamp x)
          Updates the designated column with a java.sql.Timestamp value.
 void updateTimestamp(String columnName, Timestamp x)
          Updates the designated column with a java.sql.Timestamp value.
 boolean wasNull()
          Returns true if the last column read was a NULL.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.sql.ResultSet
getURL, getURL, updateArray, updateArray, updateBlob, updateBlob, updateClob, updateClob, updateRef, updateRef
 

Method Detail

absolute

public boolean absolute(int row)
                 throws SQLException
Positions the cursor on a absolute position.

Performance consideration: If the application calls ResultSet.absolute to position itself to a particular row, the entire result set up to that point has to mbecome materialized on the server. This means that positioning far ahead in the result set might take some time, but returning to a position once visited is fast. For example:

  1. ResultSet is created.
  2. ResultSet is advanced one row at a time until the 10th row.
  3. ResultSet.absolute(1000000) is called. At this time, only the beginning of the result set has been formed. To get to row 1000000 the server has to materialize all rows up to that point. This can take a while.
  4. ResultSet.absolute(100) is called. This row has already been formed, so returning to it should be nearly instantaneous.
  5. ResultSet.absolute(1000000) is called. This row has also already been formed, so returning to it is also nearly instantaneous.

In some situations, the entire result set is formed before the first row can be returned. An example of such a situation is when we have an ORDER BY clause on a non-indexed column. If this is so, we experience the penalty of forming the entire result set before the first row is returned, and then we don't see the effects outlined above.

Specified by:
absolute in interface ResultSet
Parameters:
row - If positive it is an absolute position from the start of the result set. If negative it is a absolute position coutned from the end of the result set.
Throws:
SQLException - if an error occurs. SQLSTATE HY109 is thrown if this is a forward-only result set. HY107 is thrown if the row parameter was 0.

afterLast

public void afterLast()
               throws SQLException
Positions the cursor after the end of the result set.

Performance consideration: If the end of result set hasn't been formed before, this operation may take some time since all rows up until the end of the result set has be formed on the server. The only workaround for this is to work with smaller result sets.

Specified by:
afterLast in interface ResultSet
Throws:
SQLException - if an error occurs. SQLSTATE HY109 is thrown if this is a forward-only result set.

beforeFirst

public void beforeFirst()
                 throws SQLException
Positions the cursor before the beginning of the result set.

Specified by:
beforeFirst in interface ResultSet
Throws:
SQLException - if an error occurs. SQLSTATE HY109 is thrown if this is a forward-only result set.

cancelRowUpdates

public void cancelRowUpdates()
                      throws SQLException
Cancels the updates made to the current row in this ResultSet object.

Mimer SQL currently don't support updatable cursors. Use positioned UPDATE/DELETE:s instead.

Specified by:
cancelRowUpdates in interface ResultSet
Throws:
SQLException - if a database access error occurs or if this method is called when the cursor is on the insert row

clearWarnings

public void clearWarnings()
                   throws SQLException
Clears all warnings reported on the object.

Specified by:
clearWarnings in interface ResultSet
Throws:
SQLException - if an error occurs.

close

public void close()
           throws SQLException
Closes the statement.

Specified by:
close in interface ResultSet
Throws:
SQLException - if an error occurs.

deleteRow

public void deleteRow()
               throws SQLException
Deletes the current row from this ResultSet object and from the underlying database. This method cannot be called when the cursor is on the insert row.

Mimer SQL currently don't support updatable cursors. Use positioned UPDATE/DELETE:s instead.

Specified by:
deleteRow in interface ResultSet
Throws:
SQLException - if a database access error occurs or if this method is called when the cursor is on the insert row

findColumn

public int findColumn(String columnName)
               throws SQLException
Finds a column index from a column name.

Specified by:
findColumn in interface ResultSet
Parameters:
columnName - The column name.
Returns:
The column index.
Throws:
SQLException - if an error occurs. SQLSTATE HY010 is thrown if the result set is not open. 07009 is thrown if the column name doesn't exist.

first

public boolean first()
              throws SQLException
Positions the cursor at the first row of the result set.

Specified by:
first in interface ResultSet
Returns:
True if the cursor is on a valid row.
Throws:
SQLException - if an error occurs. SQLSTATE HY109 is thrown if this is a forward-only result set.

getArray

public Array getArray(int columnIndex)
               throws SQLException
Get an SQL array.

Mimer SQL (as of 9.2) does not support SQL arrays. This method will always throw an error.

Specified by:
getArray in interface ResultSet
Parameters:
columnIndex - The column index.
Throws:
SQLException - if an error occurs. SQLSTATE HY010 is thrown if the cursor is not open. 24000 is thrown if the cursor is not located on a valid row. 07009 is thrown if the columnIndex is not valid. 2200G is thrown if the column type wasn't castable to a string, see ResultSet for an overview of which column types are castable to which Java types.

getArray

public Array getArray(String columnName)
               throws SQLException
Get an SQL array.

Mimer SQL (as of 9.2) does not support SQL arrays. This method will always throw an error.

Specified by:
getArray in interface ResultSet
Parameters:
columnName - The column name.
Throws:
SQLException - if an error occurs. SQLSTATE HY010 is thrown if the cursor is not open. 24000 is thrown if the cursor is not located on a valid row. 07009 is thrown if the columnName is not valid. 2200G is thrown if the column type wasn't castable to a string, see ResultSet for an overview of which column types are castable to which Java types.

getAsciiStream

public InputStream getAsciiStream(int columnIndex)
                           throws SQLException
Returns an ascii stream representing the result set column.

Performance consideration: When calling this method on a CLOB or NCLOB server column, this call makes a separate server call to retrieve the object. This is different from all other data types, since they are fully transferred to the client no later when the cursor is moved to the current column. If you only wish to keep a reference to the CLOB or NCLOB for later use, please consider using the ResultSet.getClob since this only returns a LOCATOR reference to the object, and no server calls are being made.

Specified by:
getAsciiStream in interface ResultSet
Parameters:
columnIndex - The column number.
Throws:
SQLException - if an error occurs. SQLSTATE HY010 is thrown if the cursor is not open. 24000 is thrown if the cursor is not located on a valid row. 07009 is thrown if the columnIndex is invalid. 08S01 is thrown on a network receive error. 2200G is thrown if the column type wasn't castable to a string, see {link #ResultSetTypeCasting} for an overview of which column types are castable to which Java types.
See Also:
getClob(int)

getAsciiStream

public InputStream getAsciiStream(String columnName)
                           throws SQLException
Returns an ascii stream representing the result set column.

Specified by:
getAsciiStream in interface ResultSet
Parameters:
columnName - The column name.
Throws:
SQLException - if an error occurs. SQLSTATE HY010 is thrown if the cursor is not open. 24000 is thrown if the cursor is not located on a valid row. 07009 is thrown if the columnName does not exist. 08S01 is thrown on a network receive error. 2200G is thrown if the column type wasn't castable to a string, see ResultSet for an overview of which column types are castable to which Java types.

getBigDecimal

public BigDecimal getBigDecimal(int columnIndex)
                         throws SQLException
Returns a java.math.BigDecimal object without scale.

Specified by:
getBigDecimal in interface ResultSet
Parameters:
columnIndex - The column number.
Throws:
SQLException - if an error occurs. SQLSTATE HY010 is thrown if the cursor is not open. 24000 is thrown if the cursor is not located on a valid row. 07009 is thrown if the columnIndex is invalid. 22018 is thrown if a character value could not be casted to a numeric value. 2200G is thrown if the column type wasn't castable to a string, see ResultSet for an overview of which column types are castable to which Java types.

getBigDecimal

public BigDecimal getBigDecimal(int columnIndex,
                                int scale)
                         throws SQLException