Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.hsqldb
Class jdbcResultSet  view jdbcResultSet download jdbcResultSet.java

java.lang.Object
  extended byorg.hsqldb.jdbcResultSet
All Implemented Interfaces:
java.sql.ResultSet, java.sql.ResultSetMetaData

public class jdbcResultSet
extends java.lang.Object
implements java.sql.ResultSet, java.sql.ResultSetMetaData

Implements both the java.sql.ResultSet and java.sql.ResultSetMetaData interfaces.

In short:

The following is composed of three sections:

  1. The generic overview for ResultSet.
  2. The generic overview for ResultSetMetaData.
  3. A discussion of some HSQLDB-specific concerns.

From ResultSet:

A table of data representing a database result set, which is usually generated by executing a statement that queries the database.

A ResultSet object maintains a cursor pointing to its current row of data. Initially the cursor is positioned before the first row. The next method moves the cursor to the next row, and because it returns false when there are no more rows in the ResultSet object, it can be used in a while loop to iterate through the result set.

A default ResultSet object is not updatable and has a cursor that moves forward only. Thus, you can iterate through it only once and only from the first row to the last row. It is possible to produce ResultSet objects that are scrollable and/or updatable. The following code fragment, in which con is a valid Connection object, illustrates how to make a result set that is scrollable and insensitive to updates by others, and that is updatable. See ResultSet fields for other options.


 Statement stmt = con.createStatement(
                            ResultSet.TYPE_SCROLL_INSENSITIVE,
                            ResultSet.CONCUR_UPDATABLE);
 ResultSet rs = stmt.executeQuery("SELECT a, b FROM TABLE2");
 // rs will be scrollable, will not show changes made by others,
 // and will be updatable

 
The ResultSet interface provides getter methods (getBoolean, getLong, and so on) for retrieving column values from the current row. Values can be retrieved using either the index number of the column or the name of the column. In general, using the column index will be more efficient. Columns are numbered from 1. For maximum portability, result set columns within each row should be read in left-to-right order, and each column should be read only once.

For the getter methods, a JDBC driver attempts to convert the underlying data to the Java type specified in the getter method and returns a suitable Java value. The JDBC specification has a table showing the allowable mappings from SQL types to Java types that can be used by the ResultSet getter methods.

Column names used as input to getter methods are case insensitive. When a getter method is called with a column name and several columns have the same name, the value of the first matching column will be returned. The column name option is designed to be used when column names are used in the SQL query that generated the result set. For columns that are NOT explicitly named in the query, it is best to use column numbers. If column names are used, there is no way for the programmer to guarantee that they actually refer to the intended columns.

A set of updater methods were added to this interface in the JDBC 2.0 API (JavaTM 2 SDK, Standard Edition, version 1.2). The comments regarding parameters to the getter methods also apply to parameters to the updater methods.

The updater methods may be used in two ways:

  1. to update a column value in the current row. In a scrollable ResultSet object, the cursor can be moved backwards and forwards, to an absolute position, or to a position relative to the current row. The following code fragment updates the NAME column in the fifth row of the ResultSet object rs and then uses the method updateRow to update the data source table from which rs was derived.
    
     rs.absolute(5); // moves the cursor to the fifth row of rs
     rs.updateString("NAME", "AINSWORTH"); // updates the
     // NAME column of row 5 to be AINSWORTH
     rs.updateRow(); // updates the row in the data source
    
     
  2. to insert column values into the insert row. An updatable ResultSet object has a special row associated with it that serves as a staging area for building a row to be inserted. The following code fragment moves the cursor to the insert row, builds a three-column row, and inserts it into rs and into the data source table using the method insertRow.
    
     rs.moveToInsertRow(); // moves cursor to the insert row
     rs.updateString(1, "AINSWORTH"); // updates the
     // first column of the insert row to be AINSWORTH
     rs.updateInt(2,35); // updates the second column to be 35
     rs.updateBoolean(3, true); // updates the third row to true
     rs.insertRow();
     rs.moveToCurrentRow();
    
     

A ResultSet object is automatically closed when the Statement object that generated it is closed, re-executed, or used to retrieve the next result from a sequence of multiple results.

The number, types and properties of a ResultSet object's columns are provided by the ResulSetMetaData object returned by the ResultSet.getMetaData method.

From ResultSetMetaData:

An object that can be used to get information about the types and properties of the columns in a ResultSet object. The following code fragment creates the ResultSet object rs, creates the ResultSetMetaData object rsmd, and uses rsmd to find out how many columns rs has and whether the first column in rs can be used in a WHERE clause.


 ResultSet rs = stmt.executeQuery("SELECT a, b, c FROM TABLE2");
 ResultSetMetaData rsmd = rs.getMetaData();
 int numberOfColumns = rsmd.getColumnCount();
 boolean b = rsmd.isSearchable(1);

 
HSQLDB-Specific Information:

As stated above, jdbcResultSet implements both the ResultSet and ResultSetMetaData interfaces. However, to gain access to the interface methods of ResultSetMetaData in a driver independent way, the traditional call to the getMetaData 55 method should be used, rather than casting objects known to be of type jdbcResultSet to type ResultSetMetaData.

A ResultSet object generated by HSQLDB is, as is standard JDBC behavior, by default of ResultSet.TYPE_FORWARD_ONLY and does not allow the use of absolute and relative positioning methods. However, starting with 1.7.0, if a statement is created with:

Statement stmt createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);

then the ResultSet objects it produces support using all of the absolute and relative positioning methods of JDBC2 to set the position of the current row, for example:

rs.absolute(5);
String fifthRowValue = rs.getString(1);
rs.relative(4);
String ninthRowValue = rs.getString(1);

Note: An HSQLDB ResultSet object persists, even after its connection is closed. This is regardless of the operational mode of the Database from which it came. That is, they persist whether originating from a Server, WebServer or in-process mode Database.

Up to and including HSQLDB 1.7.0, there is no support for any of the methods introduced in JDBC 2 relating to updateable result sets. These methods include all updateXXX methods, as well as the insertRow() 55 , updateRow() 55 , deleteRow() 55 , moveToInsertRow() 55 (and so on) methods. A call to any such unsupported method will simply result in throwing a SQLException which states that the function is not supported. It is not anticipated that HSQLDB-native support for updateable ResultSet objects will be introduced in the HSQLDB 1.7.x series. Such features may be part of the HSQLDB 2.x series, but no decisions have been made at this point.

JRE 1.1.x Notes:

In general, JDBC 2 support requires Java 1.2 and above, and JDBC 3 requires Java 1.4 and above. In HSQLDB, support for methods introduced in different versions of JDBC depends on the JDK version used for compiling and building HSQLDB.

Since 1.7.0, it is possible to build the product so that all JDBC 2 methods can be called while executing under the version 1.1.x Java Runtime EnvironmentTM. However, some of these method calls require int values that are defined only in the JDBC 2 or greater version of the ResultSet interface. For this reason, when the product is compiled under JDK 1.1.x, these values are defined in here, in this class.

In a JRE 1.1.x environment, calling JDBC 2 methods that take or return the JDBC2-only ResultSet values can be achieved by referring to them in parameter specifications and return value comparisons, respectively, as follows:

jdbcResultSet.FETCH_FORWARD
jdbcResultSet.TYPE_FORWARD_ONLY
jdbcResultSet.TYPE_SCROLL_INSENSITIVE
jdbcResultSet.CONCUR_READ_ONLY

However, please note that code written in such a manner will not be compatible for use with other JDBC 2 drivers, since they expect and use ResultSet, rather than jdbcResultSet. Also note, this feature is offered solely as a convenience to developers who must work under JDK 1.1.x due to operating constraints, yet wish to use some of the more advanced features available under the JDBC 2 specification.

ResultSetMetaData Implementation Notes:

HSQLDB supports a subset of ResultSetMetaData interface. The JDBC specification for ResultSetMetaData is in part very vague. Several methods are exclusively for columns that are database table columns. There is a complete lack of specification on how these methods are supposed to distinguish between updatable and non-updatable ResultSet objects or between columns that are database table columns and those that are results of calculations or functions. This causes potential incompatibility between interpretations of the specifications in different JDBC drivers.

As such, DatabaseMetadata reporting will be enhanced in future 1.7.x and greater versions, but enhancements to reporting ResultSetMetaData have to be considered carefully as they impose a performance penalty on all ResultSet objects returned from HSQLDB, whether or not the ResultSetMetaData methods are used.

(fredt@users)
(boucherb@users)


Field Summary
private  boolean bInit
          Is current row before the first row?
private  boolean bWasNull
          Did the last getXXX method encounter a null value?
private  HsqlProperties connProperties
          Properties for the connectin
private  boolean getColumnName
          Does getColumnName 55 return the column name (true) or label (false)?
private  int iColumnCount
          How many columns does this ResultSet have?
private  int iCurrentRow
          The offset of the row, if any, currently positioned on.
private  int iUpdateCount
          If a result of updating the database, then this is the number of rows updated.
private  Record nCurrent
          The record containing the data for the row, if any, currently positioned on.
private  Result rResult
          The internal representation.
(package private)  int rsType
          The direction of this result.
(package private)  java.sql.Statement sqlStatement
          The Statement that generated this result.
private  boolean strictMetaData
          if false, various unsupported ResultSetMetaData methods return the true/false values they used to return in version 1.61.
 
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
 
Fields inherited from interface java.sql.ResultSetMetaData
columnNoNulls, columnNullable, columnNullableUnknown
 
Constructor Summary
(package private) jdbcResultSet(Result r, HsqlProperties props)
          Constructs a new jdbcResultSet object using the specified org.hsqldb.Result.
 
Method Summary
 boolean absolute(int row)
           Moves the cursor to the given row number in this ResultSet object.
 void afterLast()
           Moves the cursor to the end of this ResultSet object, just after the last row.
 void beforeFirst()
           Moves the cursor to the front of this ResultSet object, just before the first row.
 void cancelRowUpdates()
           Cancels the updates made to the current row in this ResultSet object.
private  void checkAvailable()
          Internal row data availability check.
private  void checkColumn(int columnIndex)
          Internal check for column index validity.
private  void checkNull(java.lang.Object o)
          Internal wasNull tracker.
 void clearWarnings()
           Clears all warnings reported on this ResultSet object.
 void close()
           Releases this ResultSet object's database and JDBC resources immediately instead of waiting for this to happen when it is automatically closed.
 void deleteRow()
           Deletes the current row from this ResultSet object and from the underlying database.
 int findColumn(java.lang.String columnName)
           Maps the given ResultSet column name to its ResultSet column index.
 boolean first()
           Moves the cursor to the first row in this ResultSet object.
 java.sql.Array getArray(int i)
           Retrieves the value of the designated column in the current row of this ResultSet object as an Array object in the Java programming language.
 java.sql.Array getArray(java.lang.String colName)
           Retrieves the value of the designated column in the current row of this ResultSet object as an Array object in the Java programming language.
 java.io.InputStream getAsciiStream(int columnIndex)
           Retrieves the value of the designated column in the current row of this ResultSet object as a stream of ASCII characters.
 java.io.InputStream getAsciiStream(java.lang.String columnName)
           Retrieves the value of the designated column in the current row of this ResultSet object as a stream of ASCII characters.
 java.math.BigDecimal getBigDecimal(int columnIndex)
           Retrieves the value of the designated column in the current row of this ResultSet object as a java.math.BigDecimal with full precision.
 java.math.BigDecimal getBigDecimal(int columnIndex, int scale)
          Deprecated.  
 java.math.BigDecimal getBigDecimal(java.lang.String columnName)
           Retrieves the value of the designated column in the current row of this ResultSet object as a java.math.BigDecimal with full precision.
 java.math.BigDecimal getBigDecimal(java.lang.String columnName, int scale)
          Deprecated.  
 java.io.InputStream getBinaryStream(int columnIndex)
           Retrieves the value of the designated column in the current row of this ResultSet object as a binary stream of uninterpreted bytes.
 java.io.InputStream getBinaryStream(java.lang.String columnName)
           Retrieves the value of the designated column in the current row of this ResultSet object as a stream of uninterpreted bytes.
 java.sql.Blob getBlob(int i)
           Retrieves the value of the designated column in the current row of this ResultSet object as a Blob object in the Java programming language.
 java.sql.Blob getBlob(java.lang.String colName)
           Retrieves the value of the designated column in the current row of this ResultSet object as a Blob object in the Java programming language.
 boolean getBoolean(int columnIndex)
           Retrieves the value of the designated column in the current row of this ResultSet object as a boolean in the Java programming language.
 boolean getBoolean(java.lang.String columnName)
           Retrieves the value of the designated column in the current row of this ResultSet object as a boolean in the Java programming language.
 byte getByte(int columnIndex)
           Retrieves the value of the designated column in the current row of this ResultSet object as a byte in the Java programming language.
 byte getByte(java.lang.String columnName)
           Retrieves the value of the designated column in the current row of this ResultSet object as a byte in the Java programming language.
 byte[] getBytes(int columnIndex)
           Retrieves the value of the designated column in the current row of this ResultSet object as a byte array in the Java programming language.
 byte[] getBytes(java.lang.String columnName)
           Retrieves the value of the designated column in the current row of this ResultSet object as a byte array in the Java programming language.
 java.lang.String getCatalogName(int column)
           Gets the designated column's table's catalog name.
 java.io.Reader getCharacterStream(int columnIndex)
           Retrieves the value of the designated column in the current row of this ResultSet object as a java.io.Reader object.
 java.io.Reader getCharacterStream(java.lang.String columnName)
           Retrieves the value of the designated column in the current row of this ResultSet object as a java.io.Reader object.
 java.sql.Clob getClob(int i)
           Retrieves the value of the designated column in the current row of this ResultSet object as a Clob object in the Java programming language.
 java.sql.Clob getClob(java.lang.String colName)
           Retrieves the value of the designated column in the current row of this ResultSet object as a Clob object in the Java programming language.
 java.lang.String getColumnClassName(int column)
           Returns the fully-qualified name of the Java class whose instances are manufactured if the method ResultSet.getObject is called to retrieve a value from the column.
 int getColumnCount()
           Returns the number of columns in this ResultSet object.
 int getColumnDisplaySize(int column)
           Indicates the designated column's normal maximum width in characters.
private  java.lang.Object getColumnInType(int columnIndex, int type)
          Internal value converter.
 java.lang.String getColumnLabel(int column)
           Gets the designated column's suggested title for use in printouts and displays.
 java.lang.String getColumnName(int column)
           Get the designated column's name.
 int getColumnType(int column)
           Retrieves the designated column's SQL type.
 java.lang.String getColumnTypeName(int column)
           Retrieves the designated column's database-specific type name.
 int getConcurrency()
           Retrieves the concurrency mode of this ResultSet object.
 java.lang.String getCursorName()
           Retrieves the name of the SQL cursor used by this ResultSet object.
 java.sql.Date getDate(int columnIndex)
           Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Date object in the Java programming language.
 java.sql.Date getDate(int columnIndex, java.util.Calendar cal)
           Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Date object in the Java programming language.
 java.sql.Date getDate(java.lang.String columnName)
           Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Date object in the Java programming language.
 java.sql.Date getDate(java.lang.String columnName, java.util.Calendar cal)
           Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Date object in the Java programming language.
 double getDouble(int columnIndex)
           Retrieves the value of the designated column in the current row of this ResultSet object as a double in the Java programming language.
 double getDouble(java.lang.String columnName)
           Retrieves the value of the designated column in the current row of this ResultSet object as a double in the Java programming language.
 int getFetchDirection()
           Retrieves the fetch direction for this ResultSet object.
 int getFetchSize()
           Retrieves the fetch size for this ResultSet object.
 float getFloat(int columnIndex)
           Retrieves the value of the designated column in the current row of this ResultSet object as a float in the Java programming language.
 float getFloat(java.lang.String columnName)
           Retrieves the value of the designated column in the current row of this ResultSet object as a float in the Java programming language.
 int getInt(int columnIndex)
           Retrieves the value of the designated column in the current row of this ResultSet object as an int in the Java programming language.
 int getInt(java.lang.String columnName)
           Retrieves the value of the designated column in the current row of this ResultSet object as an int in the Java programming language.
 long getLong(int columnIndex)
           Retrieves the value of the designated column in the current row of this ResultSet object as a long in the Java programming language.
 long getLong(java.lang.String columnName)
           Retrieves the value of the designated column in the current row of this ResultSet object as a long in the Java programming language.
 java.sql.ResultSetMetaData getMetaData()
           Retrieves the number, types and properties of this ResultSet object's columns.
private  java.sql.SQLException getNotSupported()
          Convenience method for throwing FUNCTION_NOT_SUPPORTED
private  java.sql.SQLException getNotSupportedJDBC3()
          Convenience method for throwing FUNCTION_NOT_SUPPORTED for JDBC 3 methods.
 java.lang.Object getObject(int columnIndex)
           Gets the value of the designated column in the current row of this ResultSet object as an Object in the Java programming language.
 java.lang.Object getObject(int i, java.util.Map map)
           Retrieves the value of the designated column in the current row of this ResultSet object as an Object in the Java programming language.
 java.lang.Object getObject(java.lang.String columnName)
           Gets the value of the designated column in the current row of this ResultSet object as an Object in the Java programming language.
 java.lang.Object getObject(java.lang.String colName, java.util.Map map)
           Retrieves the value of the designated column in the current row of this ResultSet object as an Object in the Java programming language.
 int getPrecision(int column)
           Get the designated column's number of decimal digits.
 java.sql.Ref getRef(int i)
           Retrieves the value of the designated column in the current row of this ResultSet object as a Ref object in the Java programming language.
 java.sql.Ref getRef(java.lang.String colName)
           Retrieves the value of the designated column in the current row of this ResultSet object as a Ref object in the Java programming language.
 int getRow()
           Retrieves the current row number.
 int getScale(int column)
           Gets the designated column's number of digits to right of the decimal point.
 java.lang.String getSchemaName(int column)
           Get the designated column's table's schema.
 short getShort(int columnIndex)
           Retrieves the value of the designated column in the current row of this ResultSet object as a short in the Java programming language.
 short getShort(java.lang.String columnName)
           Retrieves the value of the designated column in the current row of this ResultSet object as a short in the Java programming language.
 java.sql.Statement getStatement()
           Retrieves the Statement object that produced this ResultSet object.
 java.lang.String getString(int columnIndex)
           Retrieves the value of the designated column in the current row of this ResultSet object as a String in the Java programming language.
 java.lang.String getString(java.lang.String columnName)
           Retrieves the value of the designated column in the current row of this ResultSet object as a String in the Java programming language.
 java.lang.String getTableName(int column)
           Gets the designated column's table name.
 java.sql.Time getTime(int columnIndex)
           Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Time object in the Java programming language.
 java.sql.Time getTime(int columnIndex, java.util.Calendar cal)
           Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Time object in the Java programming language.
 java.sql.Time getTime(java.lang.String columnName)
           Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Time object in the Java programming language.
 java.sql.Time getTime(java.lang.String columnName, java.util.Calendar cal)
           Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Time object in the Java programming language.
 java.sql.Timestamp getTimestamp(int columnIndex)
           Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp object in the Java programming language.
 java.sql.Timestamp getTimestamp(int columnIndex, java.util.Calendar cal)
           Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp object in the Java programming anguage.
 java.sql.Timestamp getTimestamp(java.lang.String columnName)
           Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp object.
 java.sql.Timestamp getTimestamp(java.lang.String columnName, java.util.Calendar cal)
           Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp object in the Java programming language.
 int getType()
           Retrieves the type of this ResultSet object.
 java.io.InputStream getUnicodeStream(int columnIndex)
          Deprecated. use getCharacterStream in place of getUnicodeStream
 java.io.InputStream getUnicodeStream(java.lang.String columnName)
          Deprecated. use getCharacterStream instead
(package private)  int getUpdateCount()
          If executing my statement updated rows on the database, how many were affected?
 java.net.URL getURL(int columnIndex)
           Retrieves the value of the designated column in the current row of this ResultSet object as a java.net.URL object in the Java programming language.
 java.net.URL getURL(java.lang.String columnName)
           Retrieves the value of the designated column in the current row of this ResultSet object as a java.net.URL object in the Java programming language.
 java.sql.SQLWarning getWarnings()
           Retrieves the first warning reported by calls on this ResultSet object.
 void insertRow()
           Inserts the contents of the insert row into this ResultSet object and into the database.
 boolean isAfterLast()
           Retrieves whether the cursor is after the last row in this ResultSet object.
 boolean isAutoIncrement(int column)
           Indicates whether the designated column is automatically numbered, thus read-only.
 boolean isBeforeFirst()
           Retrieves whether the cursor is before the first row in this ResultSet object.
 boolean isCaseSensitive(int column)
           Indicates whether a column's case matters.
 boolean isCurrency(int column)
           Indicates whether the designated column is a cash value.
 boolean isDefinitelyWritable(int column)
           Indicates whether a write on the designated column will definitely succeed.
 boolean isFirst()
           Retrieves whether the cursor is on the first row of this ResultSet object.
 boolean isLast()
           Retrieves whether the cursor is on the last row of this ResultSet object.
 int isNullable(int column)
           Indicates the nullability of values in the designated column.
 boolean isReadOnly(int column)
           Indicates whether the designated column is definitely not writable.
(package private)  boolean isResult()
          Does this Result contain actual row data?
 boolean isSearchable(int column)
           Indicates whether the designated column can be used in a where clause.
 boolean isSigned(int column)
           Indicates whether values in the designated column are signed numbers.
 boolean isWritable(int column)
           Indicates whether it is possible for a write on the designated column to succeed.
 boolean last()
           Moves the cursor to the last row in this ResultSet object.
 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 the cursor down one row from its current position.
 boolean previous()
           Moves the cursor to the previous row in this ResultSet object.
 void refreshRow()
           Refreshes the current row with its most recent value in the database.
 boolean relative(int rows)
           Moves the cursor a relative number of rows, either positive or negative.
 boolean rowDeleted()
           Retrieves whether a row has been deleted.
 boolean rowInserted()
           Retrieves whether the current row has had an insertion.
 boolean rowUpdated()
           Retrieves whether the current row has been updated.
 void setFetchDirection(int direction)
           Gives a hint as to the direction in which the rows in this ResultSet object will be processed.
 void setFetchSize(int rows)
           Gives the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed for this ResultSet object.
 void updateArray(int columnIndex, java.sql.Array x)
           Updates the designated column with a java.sql.Array value.
 void updateArray(java.lang.String columnName, java.sql.Array x)
           Updates the designated column with a java.sql.Array value.
 void updateAsciiStream(int columnIndex, java.io.InputStream x, int length)
           Updates the designated column with an ascii stream value.
 void updateAsciiStream(java.lang.String columnName, java.io.InputStream x, int length)
           Updates the designated column with an ascii stream value.
 void updateBigDecimal(int columnIndex, java.math.BigDecimal x)
           Updates the designated column with a java.math.BigDecimal value.
 void updateBigDecimal(java.lang.String columnName, java.math.BigDecimal x)
           Updates the designated column with a java.sql.BigDecimal value.
 void updateBinaryStream(int columnIndex, java.io.InputStream x, int length)
           Updates the designated column with a binary stream value.
 void updateBinaryStream(java.lang.String columnName, java.io.InputStream x, int length)
           Updates the designated column with a binary stream value.
 void updateBlob(int columnIndex, java.sql.Blob x)
           Updates the designated column with a java.sql.Blob value.
 void updateBlob(java.lang.String columnName, java.sql.Blob x)
           Updates the designated column with a java.sql.Blob value.
 void updateBoolean(int columnIndex, boolean x)
           Updates the designated column with a boolean value.
 void updateBoolean(java.lang.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(java.lang.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(java.lang.String columnName, byte[] x)
           Updates the designated column with a byte array value.
 void updateCharacterStream(int columnIndex, java.io.Reader x, int length)
           Updates the designated column with a character stream value.
 void updateCharacterStream(java.lang.String columnName, java.io.Reader reader, int length)
           Updates the designated column with a character stream value.
 void updateClob(int columnIndex, java.sql.Clob x)
           Updates the designated column with a java.sql.Clob value.
 void updateClob(java.lang.String columnName, java.sql.Clob x)
           Updates the designated column with a java.sql.Clob value.
 void updateDate(int columnIndex, java.sql.Date x)
           Updates the designated column with a java.sql.Date value.
 void updateDate(java.lang.String columnName, java.sql.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(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.String columnName)
           Updates the designated column with a null value.
 void updateObject(int columnIndex, java.lang.Object x)
           Updates the designated column with an Object value.
 void updateObject(int columnIndex, java.lang.Object x, int scale)
           Updates the designated column with an Object value.
 void updateObject(java.lang.String columnName, java.lang.Object x)
           Updates the designated column with an Object value.
 void updateObject(java.lang.String columnName, java.lang.Object x, int scale)
           Updates the designated column with an Object value.
 void updateRef(int columnIndex, java.sql.Ref x)
           Updates the designated column with a java.sql.Ref value.
 void updateRef(java.lang.String columnName, java.sql.Ref x)
           Updates the designated column with a java.sql.Ref 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(java.lang.String columnName, short x)
           Updates the designated column with a short value.
 void updateString(int columnIndex, java.lang.String x)
           Updates the designated column with a String value.
 void updateString(java.lang.String columnName, java.lang.String x)
           Updates the designated column with a String value.
 void updateTime(int columnIndex, java.sql.Time x)
           Updates the designated column with a java.sql.Time value.
 void updateTime(java.lang.String columnName, java.sql.Time x)
           Updates the designated column with a java.sql.Time value.
 void updateTimestamp(int columnIndex, java.sql.Timestamp x)
           Updates the designated column with a java.sql.Timestamp value.
 void updateTimestamp(java.lang.String columnName, java.sql.Timestamp x)
           Updates the designated column with a java.sql.Timestamp value.
 boolean wasNull()
           Reports whether the last column read had a value of SQL NULL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rResult

private Result rResult
The internal representation. Basically, a linked list of records, each containing an Object[] payload representing the data for a row, plus some metadata.


nCurrent

private Record nCurrent
The record containing the data for the row, if any, currently positioned on.


iCurrentRow

private int iCurrentRow
The offset of the row, if any, currently positioned on.


iUpdateCount

private int iUpdateCount
If a result of updating the database, then this is the number of rows updated.


bInit

private boolean bInit
Is current row before the first row?


iColumnCount

private int iColumnCount
How many columns does this ResultSet have?


bWasNull

private boolean bWasNull
Did the last getXXX method encounter a null value?

This is important for methods that return primitive values, since there is no other way to check for this condition in those cases.


getColumnName

private boolean getColumnName
Does getColumnName 55 return the column name (true) or label (false)?


strictMetaData

private boolean strictMetaData
if false, various unsupported ResultSetMetaData methods return the true/false values they used to return in version 1.61. if true they throw an SQLException


connProperties

private HsqlProperties connProperties
Properties for the connectin


sqlStatement

java.sql.Statement sqlStatement
The Statement that generated this result.


rsType

int rsType
The direction of this result.

Constructor Detail

jdbcResultSet

jdbcResultSet(Result r,
              HsqlProperties props)
        throws java.sql.SQLException
Constructs a new jdbcResultSet object using the specified org.hsqldb.Result.

Method Detail

next

public boolean next()
             throws java.sql.SQLException
Moves the cursor down one row from its current position. A ResultSet cursor is initially positioned before the first row; the first call to the method next makes the first row the current row; the second call makes the second row the current row, and so on.

If an input stream is open for the current row, a call to the method next will implicitly close it. A ResultSet object's warning chain is cleared when a new row is read.

Specified by:
next in interface java.sql.ResultSet

close

public void close()
           throws java.sql.SQLException
Releases this ResultSet object's database and JDBC resources immediately instead of waiting for this to happen when it is automatically closed.

Note: A ResultSet object is automatically closed by the Statement object that generated it when that Statement object is closed, re-executed, or is used to retrieve the next result from a sequence of multiple results. A ResultSet object is also automatically closed when it is garbage collected.

Specified by:
close in interface java.sql.ResultSet

wasNull

public boolean wasNull()
                throws java.sql.SQLException
Reports whether the last column read had a value of SQL NULL. Note that you must first call one of the getter methods on a column to try to read its value and then call the method wasNull to see if the value read was SQL NULL.

Specified by:
wasNull in interface java.sql.ResultSet

getString

public java.lang.String getString(int columnIndex)
                           throws java.sql.SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a String in the Java programming language.

Specified by:
getString in interface java.sql.ResultSet

getBoolean

public boolean getBoolean(int columnIndex)
                   throws java.sql.SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a boolean in the Java programming language.

Specified by:
getBoolean in interface java.sql.ResultSet

getByte

public byte getByte(int columnIndex)
             throws java.sql.SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a byte in the Java programming language.

Specified by:
getByte in interface java.sql.ResultSet

getShort

public short getShort(int columnIndex)
               throws java.sql.SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a short in the Java programming language.

Specified by:
getShort in interface java.sql.ResultSet

getInt

public int getInt(int columnIndex)
           throws java.sql.SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as an int in the Java programming language.

Specified by:
getInt in interface java.sql.ResultSet

getLong

public long getLong(int columnIndex)
             throws java.sql.SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a long in the Java programming language.

Specified by:
getLong in interface java.sql.ResultSet

getFloat

public float getFloat(int columnIndex)
               throws java.sql.SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a float in the Java programming language.

Specified by:
getFloat in interface java.sql.ResultSet

getDouble

public double getDouble(int columnIndex)
                 throws java.sql.SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a double in the Java programming language.

Specified by:
getDouble in interface java.sql.ResultSet

getBigDecimal

public java.math.BigDecimal getBigDecimal(int columnIndex,
                                          int scale)
                                   throws java.sql.SQLException
Deprecated.  

Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.BigDecimal in the Java programming language.

HSQLDB-Specific Information:

Beginning with 1.7.0, HSQLDB converts the result and sets the scale with BigDecimal.ROUND_HALF_DOWN

Specified by:
getBigDecimal in interface java.sql.ResultSet

getBytes

public byte[] getBytes(int columnIndex)
                throws java.sql.SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a byte array in the Java programming language. The bytes represent the raw values returned by the driver.

HSQLDB-Specific Information:

Up to and including 1.7.1, HSQLDB returns correct values for columns of type BINARY, CHAR and their variations. For other types, it returns the byte[] for the String representation of the value.

Specified by:
getBytes in interface java.sql.ResultSet

getDate

public java.sql.Date getDate(int columnIndex)
                      throws java.sql.SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Date object in the Java programming language.

Specified by:
getDate in interface java.sql.ResultSet

getTime

public java.sql.Time getTime(int columnIndex)
                      throws java.sql.SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Time object in the Java programming language.