|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.datatools.sqltools.result.ResultSetObject
public class ResultSetObject
A standard implementation of IResultSetObject with cache mechanism. The consumer can use constructor
ResultSetObject(List rows, String[] columnNames, int[] columnTypes, int[] columnDisplaySizes) to
construct an instance of IResultSetObject given meta data and row data. An usage example is given below:
IResultSetRow row1 = new ResultSetRow(new String[]
{
"1", "21", "Jack"
});
IResultSetRow row2 = new ResultSetRow(new String[]
{
"2", "23", "Micheal"
});
ArrayList rows = new ArrayList();
rows.add(row1);
rows.add(row2);
IResultSetObject rs = new ResultSetObject(rows,
new String[]
{
"Id", "Age", "Name"
},
new int[]
{
Types.CHAR, Types.CHAR, Types.CHAR
},
new int[]
{
8, 8, 21
});
ResultSetRow,
Serialized Form| Constructor Summary | |
|---|---|
ResultSetObject(java.util.List rows,
java.lang.String[] columnNames,
int[] columnTypes,
int[] columnDisplaySizes)
Constructs a ResultSetObject instance using a list of ResultSetRow instances. |
|
ResultSetObject(java.util.List rows,
java.lang.String[] columnNames,
int[] columnTypes,
int[] columnDisplaySizes,
java.lang.String[] typeNames,
int maxDisplayRows)
Constructs a ResultSetObject instance using a list of ResultSetRow instances. |
|
ResultSetObject(java.sql.ResultSet resultset,
int maxRowCount,
int maxDisplayRowCount)
Constructs a ResultSetObject instance from a JDBC ResultSet object |
|
ResultSetObject(java.sql.ResultSet resultset,
int maxRowCount,
int maxDisplayRowCount,
boolean showLabels)
Constructs a ResultSetObject instance from a JDBC ResultSet object |
|
| Method Summary | |
|---|---|
void |
dispose()
Disposes resource after resultset is closed; |
java.util.Iterator |
getAllRecords()
Returns all result (In memory and file), each element's type should be IResultSetRow |
int |
getColumnCount()
Returns the column count |
int |
getColumnDisplaySize(int index)
Returns column display size at the given column (based on 1 --- follows the JDBC convention) |
int[] |
getColumnDisplaySizes()
Returns display size of all columns |
java.lang.String |
getColumnName(int index)
Returns the column name at given index (based on 1 --- follows the JDBC convention) |
java.lang.String[] |
getColumnNames()
Returns the column names |
int |
getColumnSQLType(int index)
Returns column SQL data type at the given column (based on 1 --- follows the JDBC convention) |
int[] |
getColumnSQLTypes()
Returns column SQL types. |
java.lang.String[] |
getColumnTypeNames()
Should be called before result set is closed, otherwise there is no guarantee that correct type names can be returned |
java.util.Iterator |
getDisplayRecords()
Returns the records to display (Loaded in memory), each element's type should be IResultSetRow |
int |
getRowCount()
Returns number of rows in result (Loaded in memory) |
IResultSetRow |
getRowData(int row)
Returns row data of given row index (based on 0) |
int |
getTotalRowCount()
Returns total row count (Include cached rows) |
boolean |
isAllResultLoaded()
Checks if some result rows are stored into a temporary file |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ResultSetObject(java.sql.ResultSet resultset,
int maxRowCount,
int maxDisplayRowCount)
throws java.sql.SQLException
resultset - the JDBC result set objectmaxRowCount - to limit the max row countmaxDisplayRowCount - to limit the max display row count
java.sql.SQLException - - if a database access error occurs
public ResultSetObject(java.sql.ResultSet resultset,
int maxRowCount,
int maxDisplayRowCount,
boolean showLabels)
throws java.sql.SQLException
resultset - the JDBC result set objectmaxRowCount - to limit the max row countmaxDisplayRowCount - to limit the max display row countshowLabels - to check if label is required to display as column heading
java.sql.SQLException - - if a database access error occurs
public ResultSetObject(java.util.List rows,
java.lang.String[] columnNames,
int[] columnTypes,
int[] columnDisplaySizes)
rows - a list of IResultSetRow objectscolumnNames - column name arraycolumnTypes - column type array (refer java.sql.Types)columnDisplaySizes - column display size array
public ResultSetObject(java.util.List rows,
java.lang.String[] columnNames,
int[] columnTypes,
int[] columnDisplaySizes,
java.lang.String[] typeNames,
int maxDisplayRows)
rows - a list of IResultSetRow objectscolumnNames - column name arraycolumnTypes - column type array (refer java.sql.Types)columnDisplaySizes - column display size arraytypeNames - the column type names arraymaxDisplayRows - the maximum number of rows to display, 0 means
display all rows in the list| Method Detail |
|---|
public int getColumnCount()
IResultSetObject
getColumnCount in interface IResultSetObjectpublic java.lang.String[] getColumnNames()
IResultSetObject
getColumnNames in interface IResultSetObjectpublic java.lang.String[] getColumnTypeNames()
public java.lang.String getColumnName(int index)
IResultSetObject
getColumnName in interface IResultSetObjectindex - the column index
public int[] getColumnDisplaySizes()
IResultSetObject
getColumnDisplaySizes in interface IResultSetObjectpublic int getColumnDisplaySize(int index)
IResultSetObject
getColumnDisplaySize in interface IResultSetObjectpublic int[] getColumnSQLTypes()
IResultSetObject
getColumnSQLTypes in interface IResultSetObjectpublic int getColumnSQLType(int index)
IResultSetObject
getColumnSQLType in interface IResultSetObjectindex - column index
public int getRowCount()
IResultSetObject
getRowCount in interface IResultSetObjectpublic int getTotalRowCount()
IResultSetObject
getTotalRowCount in interface IResultSetObjectpublic IResultSetRow getRowData(int row)
IResultSetObject
getRowData in interface IResultSetObjectrow - the row index
public java.util.Iterator getAllRecords()
IResultSetObjectIResultSetRow
getAllRecords in interface IResultSetObjectIterator instance over all recordsIResultSetRowpublic java.util.Iterator getDisplayRecords()
IResultSetObjectIResultSetRow
getDisplayRecords in interface IResultSetObjectIterator instance over all display recordIResultSetRowpublic boolean isAllResultLoaded()
IResultSetObject
isAllResultLoaded in interface IResultSetObjecttrue if there are no cached rowspublic void dispose()
IResultSetObject
dispose in interface IResultSetObject
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||