Package org.catools.sql
Class CResultSet
- java.lang.Object
-
- org.catools.sql.CResultSet
-
public class CResultSet extends Object
For numeric values, if the value is null then sql returns the public value. The value cannot be used in validation so we need set if values to return null in these scenarios for primitive types.
-
-
Constructor Summary
Constructors Constructor Description CResultSet()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends ResultSet>
BooleangetBooleanOrNull(T t, int columnIndex)Get the field value and return Null if the value was $nullafter reading it.static <T extends ResultSet>
BooleangetBooleanOrNull(T t, String columnLabel)Get the field value and return Null if the value was $nullafter reading it.static <T extends ResultSet>
BytegetByteOrNull(T t, int columnIndex)Get the field value and return Null if the value was $nullafter reading it.static <T extends ResultSet>
BytegetByteOrNull(T t, String columnLabel)Get the field value and return Null if the value was $nullafter reading it.static <T extends ResultSet>
DoublegetDoubleOrNull(T t, int columnIndex)Get the field value and return Null if the value was $nullafter reading it.static <T extends ResultSet>
DoublegetDoubleOrNull(T t, String columnLabel)Get the field value and return Null if the value was $nullafter reading it.static <T extends ResultSet>
FloatgetFloatOrNull(T t, int columnIndex)Get the field value and return Null if the value was $nullafter reading it.static <T extends ResultSet>
FloatgetFloatOrNull(T t, String columnLabel)Get the field value and return Null if the value was $nullafter reading it.static <T extends ResultSet>
IntegergetIntOrNull(T t, int columnIndex)Get the field value and return Null if the value was $nullafter reading it.static <T extends ResultSet>
IntegergetIntOrNull(T t, String columnLabel)Get the field value and return Null if the value was $nullafter reading it.static <T extends ResultSet>
LonggetLongOrNull(T t, int columnIndex)Get the field value and return Null if the value was $nullafter reading it.static <T extends ResultSet>
LonggetLongOrNull(T t, String columnLabel)Get the field value and return Null if the value was $nullafter reading it.static <T extends ResultSet>
ShortgetShortOrNull(T t, int columnIndex)Get the field value and return Null if the value was $nullafter reading it.static <T extends ResultSet>
ShortgetShortOrNull(T t, String columnLabel)Get the field value and return Null if the value was $nullafter reading it.
-
-
-
Method Detail
-
getBooleanOrNull
public static <T extends ResultSet> Boolean getBooleanOrNull(T t, int columnIndex) throws SQLException
Get the field value and return Null if the value was $nullafter reading it.- Parameters:
columnIndex- the column number.- Returns:
- Null if the value was $
nullotherwise the value - Throws:
SQLException- if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set
-
getByteOrNull
public static <T extends ResultSet> Byte getByteOrNull(T t, int columnIndex) throws SQLException
Get the field value and return Null if the value was $nullafter reading it.- Parameters:
columnIndex- the column number.- Returns:
- Null if the value was $
nullotherwise the value - Throws:
SQLException- if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set
-
getShortOrNull
public static <T extends ResultSet> Short getShortOrNull(T t, int columnIndex) throws SQLException
Get the field value and return Null if the value was $nullafter reading it.- Parameters:
columnIndex- the column number.- Returns:
- Null if the value was $
nullotherwise the value - Throws:
SQLException- if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set
-
getIntOrNull
public static <T extends ResultSet> Integer getIntOrNull(T t, int columnIndex) throws SQLException
Get the field value and return Null if the value was $nullafter reading it.- Parameters:
columnIndex- the column number.- Returns:
- Null if the value was $
nullotherwise the value - Throws:
SQLException- if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set
-
getLongOrNull
public static <T extends ResultSet> Long getLongOrNull(T t, int columnIndex) throws SQLException
Get the field value and return Null if the value was $nullafter reading it.- Parameters:
columnIndex- the column number.- Returns:
- Null if the value was $
nullotherwise the value - Throws:
SQLException- if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set
-
getFloatOrNull
public static <T extends ResultSet> Float getFloatOrNull(T t, int columnIndex) throws SQLException
Get the field value and return Null if the value was $nullafter reading it.- Parameters:
columnIndex- the column number.- Returns:
- Null if the value was $
nullotherwise the value - Throws:
SQLException- if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set
-
getDoubleOrNull
public static <T extends ResultSet> Double getDoubleOrNull(T t, int columnIndex) throws SQLException
Get the field value and return Null if the value was $nullafter reading it.- Parameters:
columnIndex- the column number.- Returns:
- Null if the value was $
nullotherwise the value - Throws:
SQLException- if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set
-
getBooleanOrNull
public static <T extends ResultSet> Boolean getBooleanOrNull(T t, String columnLabel) throws SQLException
Get the field value and return Null if the value was $nullafter reading it.- Parameters:
columnLabel- the column name.- Returns:
- Null if the value was $
nullotherwise the value - Throws:
SQLException- if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set
-
getByteOrNull
public static <T extends ResultSet> Byte getByteOrNull(T t, String columnLabel) throws SQLException
Get the field value and return Null if the value was $nullafter reading it.- Parameters:
columnLabel- the column name.- Returns:
- Null if the value was $
nullotherwise the value - Throws:
SQLException- if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set
-
getShortOrNull
public static <T extends ResultSet> Short getShortOrNull(T t, String columnLabel) throws SQLException
Get the field value and return Null if the value was $nullafter reading it.- Parameters:
columnLabel- the column name.- Returns:
- Null if the value was $
nullotherwise the value - Throws:
SQLException- if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set
-
getIntOrNull
public static <T extends ResultSet> Integer getIntOrNull(T t, String columnLabel) throws SQLException
Get the field value and return Null if the value was $nullafter reading it.- Parameters:
columnLabel- the column name.- Returns:
- Null if the value was $
nullotherwise the value - Throws:
SQLException- if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set
-
getLongOrNull
public static <T extends ResultSet> Long getLongOrNull(T t, String columnLabel) throws SQLException
Get the field value and return Null if the value was $nullafter reading it.- Parameters:
columnLabel- the column name.- Returns:
- Null if the value was $
nullotherwise the value - Throws:
SQLException- if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set
-
getFloatOrNull
public static <T extends ResultSet> Float getFloatOrNull(T t, String columnLabel) throws SQLException
Get the field value and return Null if the value was $nullafter reading it.- Parameters:
columnLabel- the column name.- Returns:
- Null if the value was $
nullotherwise the value - Throws:
SQLException- if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set
-
getDoubleOrNull
public static <T extends ResultSet> Double getDoubleOrNull(T t, String columnLabel) throws SQLException
Get the field value and return Null if the value was $nullafter reading it.- Parameters:
columnLabel- the column name.- Returns:
- Null if the value was $
nullotherwise the value - Throws:
SQLException- if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set
-
-