public class DBResultSet extends AbstractTableModel
listenerList| Constructor and Description |
|---|
DBResultSet()
Default constructor, just creates an empty resultset.
|
DBResultSet(ResultSet aRS)
This constructor takes a ResultSet from which the data
is read.
|
DBResultSet(ResultSet aRS,
boolean aNullReplace)
This constructor takes a ResultSet from which the data
is read.
|
| Modifier and Type | Method and Description |
|---|---|
Class |
getColumnClass(int columnIndex)
Returns
Object.class regardless of columnIndex. |
int |
getColumnCount()
This method reports on the number of columns in the resultset.
|
String |
getColumnName(int column)
Returns a default name for the column using spreadsheet conventions:
A, B, C, ...
|
String[] |
getColumnNames()
This method reports on all the columnn ames.
|
Object[][] |
getData()
This method reports on the data stored in the resultset.
|
int |
getRowCount()
This method reports on the number of rows in the resultset.
|
Object |
getValueAt(int rowIndex,
int columnIndex)
Returns the value for the cell at
columnIndex and
rowIndex. |
void |
writeToCSVFile(Writer out,
String aSeparator)
This method allows the caller to write the current dataset to the
specified Writer.
|
void |
writeToHTMLTable(Writer out,
int aBorderstyle)
This method allows the caller to write the current dataset to the
specified Writer.
|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAtpublic DBResultSet()
public DBResultSet(ResultSet aRS) throws SQLException
aRS - ResultSet from which to read the data. Closing the ResultSet
is up to the caller!!SQLException - whenever reading the resultset failed.public DBResultSet(ResultSet aRS, boolean aNullReplace) throws SQLException
aRS - ResultSet from which to read the data. Closing the ResultSet
is up to the caller!!aNullReplace - boolean to indicate whether 'null' values returned by
the DB should be converted into "(null)" Strings ('true')
or not ('false').SQLException - whenever reading the resultset failed.public String[] getColumnNames()
public Object[][] getData()
public int getColumnCount()
public int getRowCount()
public Object getValueAt(int rowIndex, int columnIndex)
columnIndex and
rowIndex.rowIndex - the row whose value is to be queriedcolumnIndex - the column whose value is to be queriedpublic Class getColumnClass(int columnIndex)
Object.class regardless of columnIndex.getColumnClass in interface TableModelgetColumnClass in class AbstractTableModelcolumnIndex - the column being queriedpublic String getColumnName(int column)
column cannot be found,
returns an empty string.getColumnName in interface TableModelgetColumnName in class AbstractTableModelcolumn - the column being queriedcolumnpublic void writeToCSVFile(Writer out, String aSeparator) throws IOException
out - Writer to print to. Note that flushing and closing this
writer is up to the caller.aSeparator - String with the separator character(s) to use.IOException - when something goes wrong.public void writeToHTMLTable(Writer out, int aBorderstyle) throws IOException
out - Writer to print to. Note that flushing and closing this
writer is up to the caller.aBorderstyle - int with the HTML table border tag style for the table.IOException - when something goes wrong.Copyright © 2016. All rights reserved.