Package quadbase.reportdesigner.util
Interface IResultSet
- All Superinterfaces:
IRow
- All Known Implementing Classes:
DbData,DbDataCollection,QueryResultSet,StreamResultSet,XMLQueryResultSet,XMLResultSet
This interface is used to read data in a tabular form. This is similar to the java.sql.ResultSet
interface used to read from a JDBC data source. (However, it is much simpler). The interface can
be implemented over data from any data source such as a database, a data file, or data in memory.
The following are some sample implementations :
- The class quadbase.reportdesigner.util.QueryResultSet implements the IResultSet interface over data from a JDBC data source.
- The class quadbase.reportdesigner.util.StreamResultSet implements the IResultSet interface over data from an input stream such as a data file in the *.dat format supported by the chart.
- The class quadbase.ChartAPI.DbData implements the IResultSet interface over data from arrays.
The information about the table structure, such as the number, names, and data types of the columns are provided by the IRSMetaData interface.
import quadbase.reportdesigner.util.*;
...// other code
////// Print the given result set ///////
public void printResultSet(IResultSet rs) throws Exception {
IRSMetaData md = rs.getMetaData();
int nCol = md.getColumnCount();
int nRow = 0;
// Print the column names and data type constants :
for(int i=1; iinvalid input: '<'=nCol; i++) {
System.out.print("\t"
+ md.getColumnName(i) +"["+ md.getColumnType(i) +"]");
}
// Get records :
while(rs.next()) {
System.out.println(++nRow);
for(int i=1; iinvalid input: '<'=nCol; i++)
System.out.print("\t" + rs.getObject(i));
System.out.println("");
}
rs.close();
}
...
- See Also: