public class DBResultSet
extends javax.swing.table.AbstractTableModel
Constructor and Description |
---|
DBResultSet()
Default constructor, just creates an empty resultset.
|
DBResultSet(java.sql.ResultSet aRS)
This constructor takes a ResultSet from which the data
is read.
|
DBResultSet(java.sql.ResultSet aRS,
boolean aNullReplace)
This constructor takes a ResultSet from which the data
is read.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Class |
getColumnClass(int columnIndex)
Returns
Object.class regardless of columnIndex . |
int |
getColumnCount()
This method reports on the number of columns in the resultset.
|
java.lang.String |
getColumnName(int column)
Returns a default name for the column using spreadsheet conventions:
A, B, C, ...
|
java.lang.String[] |
getColumnNames()
This method reports on all the columnn ames.
|
java.lang.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.
|
java.lang.Object |
getValueAt(int rowIndex,
int columnIndex)
Returns the value for the cell at
columnIndex and
rowIndex . |
void |
writeToCSVFile(java.io.Writer out,
java.lang.String aSeparator)
This method allows the caller to write the current dataset to the
specified Writer.
|
void |
writeToHTMLTable(java.io.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, setValueAt
public DBResultSet()
public DBResultSet(java.sql.ResultSet aRS) throws java.sql.SQLException
aRS
- ResultSet from which to read the data. Closing the ResultSet
is up to the caller!!java.sql.SQLException
- whenever reading the resultset failed.public DBResultSet(java.sql.ResultSet aRS, boolean aNullReplace) throws java.sql.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').java.sql.SQLException
- whenever reading the resultset failed.public java.lang.String[] getColumnNames()
public java.lang.Object[][] getData()
public int getColumnCount()
public int getRowCount()
public java.lang.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 java.lang.Class getColumnClass(int columnIndex)
Object.class
regardless of columnIndex
.getColumnClass
in interface javax.swing.table.TableModel
getColumnClass
in class javax.swing.table.AbstractTableModel
columnIndex
- the column being queriedpublic java.lang.String getColumnName(int column)
column
cannot be found,
returns an empty string.getColumnName
in interface javax.swing.table.TableModel
getColumnName
in class javax.swing.table.AbstractTableModel
column
- the column being queriedcolumn
public void writeToCSVFile(java.io.Writer out, java.lang.String aSeparator) throws java.io.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.java.io.IOException
- when something goes wrong.public void writeToHTMLTable(java.io.Writer out, int aBorderstyle) throws java.io.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.java.io.IOException
- when something goes wrong.Copyright © 2013. All Rights Reserved.