|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.workingdogs.village.DataSet
com.workingdogs.village.QueryDataSet
public class QueryDataSet
This class is used for doing SQL select statements on the database. It should not be used for doing modifications via update/delete/insert statements. If you would like to perform those functions, please use a TableDataSet.
Here is some example code for using a QueryDataSet.
QueryDataSet qds = new QueryDataSet ( connection, "SELECT * from my_table" ); qds.fetchRecords(10); // fetch the first 10 records for ( int i = 0; i < qds.size(); i++ ) { Record rec = qds.getRecord(i); int value = rec.getValue("column").asInt(); System.out.println ( "The value is: " + value ); } qds.close();It is important to always remember to close() a QueryDataSet in order to free the allocated resources.
Field Summary |
---|
Fields inherited from class com.workingdogs.village.DataSet |
---|
ALL_RECORDS, conn, records, resultSet, schema, selectString, stmt |
Constructor Summary | |
---|---|
QueryDataSet()
Private...does nothing. |
|
QueryDataSet(Connection conn,
String selectStmt)
Creates a new QueryDataSet based on a connection and a select string |
|
QueryDataSet(ResultSet resultSet)
Create a new QueryDataSet based on an existing resultSet |
Method Summary | |
---|---|
String |
getSelectString()
get the Select String that was used to create this QueryDataSet |
Methods inherited from class com.workingdogs.village.DataSet |
---|
addRecord, addRecord, allRecordsRetrieved, clearRecords, close, connection, containsRecord, fetchRecords, fetchRecords, fetchRecords, getRecord, keydef, lastFetchSize, maxColumnWidths, releaseRecords, removeRecord, reset, resultSet, schema, size, tableName, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public QueryDataSet() throws SQLException, DataSetException
SQLException
DataSetException
public QueryDataSet(Connection conn, String selectStmt) throws SQLException, DataSetException
conn
- selectStmt
-
SQLException
DataSetException
public QueryDataSet(ResultSet resultSet) throws SQLException, DataSetException
resultSet
-
SQLException
DataSetException
Method Detail |
---|
public String getSelectString()
getSelectString
in class DataSet
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |