| java.lang.Object com.jamonapi.utils.ResultSetUtils
ResultSetUtils | public class ResultSetUtils extends java.lang.Object (Code) | | Purpose: Provides various methods for obtaining resultset data.
Author: Andy Evans
Date: 3/28/2001
|
Method Summary | |
public String[][] | arrayListToString(ArrayList arrayList) The following method converts an ArrayList, containing string arrays of ResultSet row data,
into a two dimensional string array. | public static ResultSetUtils | createInstance() | public void | fullResultSetToArrayList(ArrayList arrayList, ResultSet resultSet) The following method returns an ArrayList containing the ResultSet column names and data.
The first row of the ArrayList will always contain a string array of the column names.
Subsequent rows contain ResultSet rows as object arrays. | public String[][] | fullResultSetToString(ResultSet resultSet) The following method simply takes the ResultSet and converts it to a two dimensional
array of strings containing the column names and data using calls to
the resultSetToArrayList and arrayListToString methods. | public String[] | getColumnNames(ResultSetMetaData resultSetMetaData) The following method returns an array of strings containing the column names for
a given ResultSetMetaData object. | public String[] | getColumnNames(ResultSetMetaData resultSetMetaData, int[] returnCols) The following method returns an array of strings containing the column names for
a given ResultSetMetaData object. | public void | resultSetMetaDataToArrayList(ArrayList arrayList, ResultSet resultSet) The following method returns an ArrayList containing the ResultSetMetaData column names. | public void | resultSetToArrayList(ArrayList arrayList, ResultSet resultSet) The following method returns an ArrayList containing the ResultSet column names and data.
The first row of the ArrayList will always contain a string array of the column names.
Subsequent rows contain ResultSet rows as object arrays. | public void | resultSetToMap(Map map, ResultSet resultSet) The following method converts ResultSet data to a Map of object keys and values using an instance
of HashMap.
The first column in the ResultSet supplies the key, the second column the value. | public String[][] | resultSetToString(ResultSet resultSet) The following method simply takes the ResultSet and converts it to a two dimensional
array of strings containing the column names and data using calls to
the resultSetToArrayList and arrayListToString methods. |
ResultSetUtils | protected ResultSetUtils()(Code) | | |
arrayListToString | public String[][] arrayListToString(ArrayList arrayList)(Code) | | The following method converts an ArrayList, containing string arrays of ResultSet row data,
into a two dimensional string array. This array must be first initialized before it
can be passed as an argument to the ArrayList toArray() method.
The first dimension represents the number of rows, including the column names, and
can be obtained from the ArrayList size() method which returns the number of elements
in the ArrayList.
The second dimension represents the number of columns. This value is obtained from the
length of the string array in the first element of the ArrayList since:
1. The length of all the string arrays in the ArrayList must be the same.
2. There must also be at least one row in the ArrayList representing the column names.
|
fullResultSetToArrayList | public void fullResultSetToArrayList(ArrayList arrayList, ResultSet resultSet) throws SQLException(Code) | | The following method returns an ArrayList containing the ResultSet column names and data.
The first row of the ArrayList will always contain a string array of the column names.
Subsequent rows contain ResultSet rows as object arrays. The getColumnNames() method is
called to get the column names string array, and the getRowData() to convert ResultSet
row data into an object array.
|
fullResultSetToString | public String[][] fullResultSetToString(ResultSet resultSet) throws SQLException(Code) | | The following method simply takes the ResultSet and converts it to a two dimensional
array of strings containing the column names and data using calls to
the resultSetToArrayList and arrayListToString methods.
|
getColumnNames | public String[] getColumnNames(ResultSetMetaData resultSetMetaData) throws SQLException(Code) | | The following method returns an array of strings containing the column names for
a given ResultSetMetaData object.
|
getColumnNames | public String[] getColumnNames(ResultSetMetaData resultSetMetaData, int[] returnCols) throws SQLException(Code) | | The following method returns an array of strings containing the column names for
a given ResultSetMetaData object. NEW CODE
|
resultSetMetaDataToArrayList | public void resultSetMetaDataToArrayList(ArrayList arrayList, ResultSet resultSet) throws SQLException(Code) | | The following method returns an ArrayList containing the ResultSetMetaData column names.
There is only 1 row in the ArrayList and it will always contain a string array of the column names.
|
resultSetToArrayList | public void resultSetToArrayList(ArrayList arrayList, ResultSet resultSet) throws SQLException(Code) | | The following method returns an ArrayList containing the ResultSet column names and data.
The first row of the ArrayList will always contain a string array of the column names.
Subsequent rows contain ResultSet rows as object arrays. The getColumnNames() method is
called to get the column names string array, and the getRowData() to convert ResultSet
row data into an object array.
|
resultSetToMap | public void resultSetToMap(Map map, ResultSet resultSet) throws SQLException(Code) | | The following method converts ResultSet data to a Map of object keys and values using an instance
of HashMap.
The first column in the ResultSet supplies the key, the second column the value. If the ResultSet
contains more than two columns then subsequent columns are ignored. If the ResultSet supplies
only one column then an SQLException is thrown. The ResultSet values are converted to objects
using the getRowData() method which converts a ResultSet row into an array of objects.
|
resultSetToString | public String[][] resultSetToString(ResultSet resultSet) throws SQLException(Code) | | The following method simply takes the ResultSet and converts it to a two dimensional
array of strings containing the column names and data using calls to
the resultSetToArrayList and arrayListToString methods.
|
|
|