public class SQLResultSetRowData extends RowData
An SQLResultSetRowData object maintains a position in the list that points to its current row of data. The initial position in the list is set before the first row. The next method moves to the next row in the list.
The getString method is used to retrieve the column value for the current row indexed by the column number. Columns are numbered starting from 0.
The number, types, and properties of the list's columns are provided by the SQLResultSetMetaData object returned by the getMetaData method.
The following example creates an SQLResultSetRowData object and initializes it to an SQL ResultSet.
// Register and get a connection to the database. DriverManager.registerDriver(new com.ibm.as400.access.AS400JDBCDriver()); Connection connection = DriverManager.getConnection("jdbc:as400://mySystem"); // Execute an SQL statement and get the result set. Statement statement = connection.createStatement(); statement.execute("select * from qiws.qcustcdt"); ResultSet resultSet = statement.getResultSet(); // Create the SQLResultSetRowData object and initialize to the result set. SQLResultSetRowData rowData = new SQLResultSetRowData(resultSet);
Modifier and Type | Field and Description |
---|---|
protected java.sql.ResultSet |
resultSet_
The java.sql.ResultSet object associated with this RowData.
|
rowProperties_, rows_
Constructor and Description |
---|
SQLResultSetRowData()
Constructs a default SQLResultSetRowData object.
|
SQLResultSetRowData(java.sql.ResultSet resultSet)
Constructs a SQLResultSetRowData object with the specified resultSet.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the SQL result set.
|
RowMetaData |
getMetaData()
Returns the metadata.
|
java.sql.ResultSet |
getResultSet()
Returns the SQL result set.
|
void |
setResultSet(java.sql.ResultSet resultSet)
Sets the SQL result set.
|
absolute, addPropertyChangeListener, addVetoableChangeListener, afterLast, beforeFirst, first, getCurrentPosition, getObject, getObjectProperties, getRowProperties, isAfterLast, isBeforeFirst, isFirst, isLast, last, length, next, previous, relative, removePropertyChangeListener, removeVetoableChangeListener, setObjectProperties
protected transient java.sql.ResultSet resultSet_
public SQLResultSetRowData()
public SQLResultSetRowData(java.sql.ResultSet resultSet) throws RowDataException
resultSet
- The SQL result set. An empty result set is invalid.RowDataException
- If the cursor state of the result set is invalid or a rowdata error occurs.close()
public void close() throws RowDataException
RowDataException
- If a row data error occurs.public RowMetaData getMetaData() throws RowDataException
getMetaData
in class RowData
RowDataException
- If a row data error occurs.public java.sql.ResultSet getResultSet()
public void setResultSet(java.sql.ResultSet resultSet) throws RowDataException, java.beans.PropertyVetoException
resultSet
- The SQL result set. An empty result set is invalid.RowDataException
- If the cursor state of the result set is invalid or a rowdata error occurs.java.beans.PropertyVetoException
- If a change is vetoed.close()