|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.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(java.sql.Connection conn,
java.lang.String selectStmt)
Creates a new QueryDataSet based on a connection and a select string |
|
QueryDataSet(java.sql.ResultSet resultSet)
Create a new QueryDataSet based on an existing resultSet |
Method Summary | |
---|---|
java.lang.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, 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 java.sql.SQLException, DataSetException
java.sql.SQLException
DataSetException
public QueryDataSet(java.sql.Connection conn, java.lang.String selectStmt) throws java.sql.SQLException, DataSetException
conn
- selectStmt
-
java.sql.SQLException
DataSetException
public QueryDataSet(java.sql.ResultSet resultSet) throws java.sql.SQLException, DataSetException
resultSet
-
java.sql.SQLException
DataSetException
Method Detail |
---|
public java.lang.String getSelectString()
getSelectString
in class DataSet
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |