Package org.kiwiproject.beta.jdbc
Class KiwiJdbc2
- java.lang.Object
-
- org.kiwiproject.beta.jdbc.KiwiJdbc2
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> T[]array(ResultSet rs, String columnLabel, Class<T> type)Get an ARRAY column as an array of th specified reference type.static <T> List<T>arrayAsList(ResultSet rs, String columnLabel, Class<T> type)Get an ARRAY column as a List of the specified type.static <T> Set<T>arrayAsSet(ResultSet rs, String columnLabel, Class<T> type)Get an ARRAY column as a Set of the specified type.static double[]doubleArray(ResultSet rs, String columnLabel)Get an ARRAY column as a double array.static int[]intArray(ResultSet rs, String columnLabel)Get an ARRAY column as an int array.static long[]longArray(ResultSet rs, String columnLabel)Get an ARRAY column as a long array.
-
-
-
Method Detail
-
arrayAsList
public static <T> List<T> arrayAsList(ResultSet rs, String columnLabel, Class<T> type) throws SQLException
Get an ARRAY column as a List of the specified type.- Type Parameters:
T- type parameter for the data type- Parameters:
rs- the ResultSetcolumnLabel- the name of the array column in the ResultSettype- the data type- Returns:
- a list containing the values from the array, or an empty list if the database value is null or empty
- Throws:
SQLException- if a database error occurred, e.g. the column doesn't exist- See Also:
Array,ResultSet.getArray(String)
-
arrayAsSet
public static <T> Set<T> arrayAsSet(ResultSet rs, String columnLabel, Class<T> type) throws SQLException
Get an ARRAY column as a Set of the specified type.- Type Parameters:
T- type parameter for the data type- Parameters:
rs- the ResultSetcolumnLabel- the name of the array column in the ResultSettype- the data type- Returns:
- a set containing the values from the array, or an empty set if the database value is null or empty
- Throws:
SQLException- if a database error occurred, e.g. the column doesn't exist- See Also:
Array,ResultSet.getArray(String)
-
doubleArray
public static double[] doubleArray(ResultSet rs, String columnLabel) throws SQLException
Get an ARRAY column as a double array.- Parameters:
rs- the ResultSetcolumnLabel- the name of the array column in the ResultSet- Returns:
- an array of double containing the values from the array, or an empty array if the database value is null or empty
- Throws:
SQLException- if a database error occurred, e.g. the column doesn't exist- See Also:
Array,ResultSet.getArray(String)
-
intArray
public static int[] intArray(ResultSet rs, String columnLabel) throws SQLException
Get an ARRAY column as an int array.- Parameters:
rs- the ResultSetcolumnLabel- the name of the array column in the ResultSet- Returns:
- an array of int containing the values from the array, or an empty array if the database value is null or empty
- Throws:
SQLException- if a database error occurred, e.g. the column doesn't exist- See Also:
Array,ResultSet.getArray(String)
-
longArray
public static long[] longArray(ResultSet rs, String columnLabel) throws SQLException
Get an ARRAY column as a long array.- Parameters:
rs- the ResultSetcolumnLabel- the name of the array column in the ResultSet- Returns:
- an array of long containing the values from the array, or an empty array if the database value is null or empty
- Throws:
SQLException- if a database error occurred, e.g. the column doesn't exist- See Also:
Array,ResultSet.getArray(String)
-
array
public static <T> T[] array(ResultSet rs, String columnLabel, Class<T> type) throws SQLException
Get an ARRAY column as an array of th specified reference type.If the target type is a primitive double, int, or long, you can specify the wrapper type, or you can instead use one of the specialized primitive methods, e.g.
doubleArray(ResultSet, String). Note that if the array returned byArray.getArray()is of a primitive type such aschar[], then this method must convert that array to an array of wrapper objects which adds additional overhead. In those cases, using the specialized primitive methods will result in better performance (for the supported primitive types).- Type Parameters:
T- type parameter for the data type- Parameters:
rs- the ResultSetcolumnLabel- the name of the array column in the ResultSettype- the data type (must be a reference type)- Returns:
- an array of objects of type T containing the values from the array, or an empty array if the database value is null or empty
- Throws:
SQLException- if a database error occurred, e.g. the column doesn't exist- See Also:
Array,ResultSet.getArray(String)
-
-