|
BEA Systems, Inc. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--weblogic.db.jdbc.DataSet | +--weblogic.db.jdbc.QueryDataSet
A QueryDataSet holds the results of an arbitrary SQL query. The results are available as a collection of Records accessible by an integer index. You can add new records and modify existing records of a QueryDataSet, but the additions and changes cannot be saved to the database. If you wish to save such changes, use a TableDataSet instead.
A QueryDataSet is constructed in the context of a Connection or a ResultSet.
The following example retrieves the query results into ds.
QueryDataSet ds = new QueryDataSet(conn, "select * from tableA where f1 = 34"); ds.fetchRecords(); ds.close() // This must be calledPass an argument to fetchRecords() to set the size of the fetch. This example retrieves no more than the first 20 records of the query into ds and discards the remaining records by closing the DataSet.
QueryDataSet ds = new QueryDataSet(conn, "select * from tableA where f1 = 34"); ds.fetchRecords(20) ds.close() // This must be calledThe last example retrieves 100 records at a time into ds, does something, and then removes the records from the DataSet. This approach is useful for dealing with large query results.
QueryDataSet ds = new QueryDataSet(conn, "select * from tableA, tableB where " + "tableA.f1 = tableB.f1"); while (!ds.allRecordsRetrieved()) { ds.fetchRecords(100); // Do something with the 100 records... ds.clearRecords(); } ds.close() // This must be called
For more implementation and usage, see the Developers Guide.
DataSet
,
SelectStmt
,
TableDataSet
, Serialized FormFields inherited from class weblogic.db.jdbc.DataSet |
cached,
resetable,
resultval,
stmt |
Constructor Summary | |
QueryDataSet()
Private - used for serialization |
|
QueryDataSet(java.sql.Connection conn,
SelectStmt stmt)
QueryDataSet constructor. |
|
QueryDataSet(java.sql.Connection conn,
java.lang.String sqlstr)
QueryDataSet constructor. |
|
QueryDataSet(java.sql.ResultSet results)
QueryDataSet constructor. |
Method Summary | |
java.lang.String |
getSelectString()
Returns the SQL SELECT statement used to populate a QueryDataSet. |
java.sql.ResultSet |
resultSet()
Returns the JDBC ResultSet associated with a QueryDataSet. |
Methods inherited from class weblogic.db.jdbc.DataSet |
addRecord,
allRecordsRetrieved,
clearRecords,
close,
connection,
containsRecord,
destroy,
fetchRecords,
fetchRecords,
fetchRecords,
getRecord,
getResultSet,
initialize,
lastFetchSize,
maxColumnWidths,
readExternal,
releaseRecords,
removeRecord,
reset,
schema,
size,
toString,
writeExternal |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public QueryDataSet(java.sql.ResultSet results) throws java.sql.SQLException, DataSetException
results
- JDBC ResultSetsqlstr
- SQL query string to specify datapublic QueryDataSet(java.sql.Connection conn, java.lang.String sqlstr) throws java.sql.SQLException, DataSetException
conn
- Connection objectsqlstr
- SQL query string to specify datapublic QueryDataSet(java.sql.Connection conn, SelectStmt stmt) throws java.sql.SQLException, DataSetException
db
- Connection objectstmt
- SelectStmt object to specify datapublic QueryDataSet()
Method Detail |
public java.lang.String getSelectString()
public java.sql.ResultSet resultSet() throws java.sql.SQLException, DataSetException
|
Documentation is available at http://download.oracle.com/docs/cd/E13222_01/wls/docs61 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |