|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.as400.util.servlet.RowData | +--com.ibm.as400.util.servlet.SQLResultSetRowData
The SQLResultSetRowData class represents an SQL ResultSet as a list of data. The ResultSet object is generated by an executed SQL statement.
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 getObject 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);
Constructor Summary | |
SQLResultSetRowData()
Constructs a default SQLResultSetRowData object. |
|
SQLResultSetRowData(java.sql.ResultSet resultSet)
Constructs a SQLResultSetRowData object with the specified resultSet. |
Method Summary | |
boolean |
absolute(int rowIndex)
Sets the position to the specified rowIndex. |
void |
afterLast()
Sets the position after the last row in the list. |
void |
beforeFirst()
Sets the position before the first row in the list. |
void |
close()
Closes the SQL result set. |
boolean |
first()
Sets the position to the first row in the list. |
int |
getCurrentPosition()
Returns the current row position. |
RowMetaData |
getMetaData()
Returns the metadata. |
java.lang.Object |
getObject(int columnIndex)
Returns the current row's column data specified at columnIndex. |
java.util.Vector |
getObjectProperties(int columnIndex)
Returns the current row's property list for the specified columnIndex. |
java.sql.ResultSet |
getResultSet()
Returns the SQL result set. |
java.util.Vector[] |
getRowProperties()
Returns the current row's property list. |
boolean |
isAfterLast()
Indicates whether the current position is after the last row in the list. |
boolean |
isBeforeFirst()
Indicates whether the current position is before the first row in the list. |
boolean |
isFirst()
Indicates whether the current position is the first row in the list. |
boolean |
isLast()
Indicates whether the current position is the last row in the list. |
boolean |
last()
Sets the position to the last row in the list. |
int |
length()
Returns the length of the result list. |
boolean |
next()
Sets the position to the next row in the list. |
boolean |
previous()
Sets the position to the previous row in the list. |
boolean |
relative(int numberOfRows)
Sets the position a relative numberOfRows based on the current position. |
void |
setObjectProperties(java.util.Vector properties,
int columnIndex)
Sets the column object's properties at the specified columnIndex. |
void |
setResultSet(java.sql.ResultSet resultSet)
Sets the SQL result set. |
Methods inherited from class com.ibm.as400.util.servlet.RowData |
addPropertyChangeListener,
addVetoableChangeListener,
removePropertyChangeListener,
removeVetoableChangeListener |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public SQLResultSetRowData()
public SQLResultSetRowData(java.sql.ResultSet resultSet) throws RowDataException
resultSet
- The SQL result set. An empty result set is invalid.close()
Method Detail |
public boolean absolute(int rowIndex)
rowIndex
- The row index (0-based). The rowIndex must be zero or a
positive integer which is less than the number of rows.public void afterLast()
public void beforeFirst()
public void close() throws RowDataException
public boolean first()
public int getCurrentPosition()
public RowMetaData getMetaData() throws RowDataException
public java.lang.Object getObject(int columnIndex) throws RowDataException
columnIndex
- The column index (0-based).public java.util.Vector getObjectProperties(int columnIndex)
columnIndex
- The column index (0-based).public java.util.Vector[] getRowProperties()
public java.sql.ResultSet getResultSet()
public boolean isAfterLast()
public boolean isBeforeFirst()
public boolean isFirst()
public boolean isLast()
public boolean last()
public int length()
public boolean next()
public boolean previous()
public boolean relative(int numberOfRows)
numberOfRows
- The number of rows to move, either positive or negative.public void setObjectProperties(java.util.Vector properties, int columnIndex)
properties
- The properties.columnIndex
- The column index (0-based).public void setResultSet(java.sql.ResultSet resultSet) throws RowDataException, java.beans.PropertyVetoException
resultSet
- The SQL result set. An empty result set is invalid.close()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |