Package weka.gui.sql
Class ResultSetHelper
java.lang.Object
weka.gui.sql.ResultSetHelper
Represents an extended JTable, containing a table model based on a ResultSet
and the corresponding query.
- Version:
- $Revision: 7043 $
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
-
Constructor Summary
ConstructorsConstructorDescriptioninitializes the helper, with unlimited number of rows.ResultSetHelper
(ResultSet rs, int max) initializes the helper, with the given maximum number of rows (less than 1 means unlimited). -
Method Summary
Modifier and TypeMethodDescriptionObject[][]
getCells()
returns an 2-dimensional array with the content of the resultset, the first dimension is the row, the second the column (i.e., getCells()[y][x]).Class[]
returns the classes for the columns.int
returns the number of columns in the resultset.String[]
returns an array with the names of the columns in the resultset.int
the maximum number of rows to retrieve, less than 1 means unlimited.boolean[]
returns an array that indicates whether a column is numeric or nor.the underlying resultset.int
returns the number of rows in the resultset.boolean
whether a limit on the rows to retrieve was set.static boolean
typeIsNumeric
(int type) returns whether the SQL type is numeric (and therefore the justification should be right).static Class
typeToClass
(int type) Returns the class associated with a SQL type.
-
Constructor Details
-
ResultSetHelper
initializes the helper, with unlimited number of rows.- Parameters:
rs
- the resultset to work on
-
ResultSetHelper
initializes the helper, with the given maximum number of rows (less than 1 means unlimited).- Parameters:
rs
- the resultset to work onmax
- the maximum number of rows to retrieve
-
-
Method Details
-
getResultSet
the underlying resultset.- Returns:
- the resultset
-
getColumnCount
public int getColumnCount()returns the number of columns in the resultset.- Returns:
- the number of columns
-
getRowCount
public int getRowCount()returns the number of rows in the resultset. If -1 then the number of rows couldn't be determined, i.e., the cursors aren't scrollable.- Returns:
- the number of rows, -1 if it wasn't possible to determine
-
getColumnNames
returns an array with the names of the columns in the resultset.- Returns:
- the column names
-
getNumericColumns
public boolean[] getNumericColumns()returns an array that indicates whether a column is numeric or nor.- Returns:
- the numeric columns
-
getColumnClasses
returns the classes for the columns.- Returns:
- the column classes
-
hasMaxRows
public boolean hasMaxRows()whether a limit on the rows to retrieve was set.- Returns:
- true if there's a limit
-
getMaxRows
public int getMaxRows()the maximum number of rows to retrieve, less than 1 means unlimited.- Returns:
- the maximum number of rows
-
getCells
returns an 2-dimensional array with the content of the resultset, the first dimension is the row, the second the column (i.e., getCells()[y][x]). Note: the data is not cached! It is always retrieved anew.- Returns:
- the data
-
typeToClass
Returns the class associated with a SQL type.- Parameters:
type
- the SQL type- Returns:
- the Java class corresponding with the type
-
typeIsNumeric
public static boolean typeIsNumeric(int type) returns whether the SQL type is numeric (and therefore the justification should be right).- Parameters:
type
- the SQL type- Returns:
- whether the given type is numeric
-