Class 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 Detail

      • CResultSet

        public CResultSet()
    • Method Detail

      • getBooleanOrNull

        public static <T extends ResultSetBoolean getBooleanOrNull​(T t,
                                                                     int columnIndex)
                                                              throws SQLException
        Get the field value and return Null if the value was $null after reading it.
        Parameters:
        columnIndex - the column number.
        Returns:
        Null if the value was $null otherwise 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 ResultSetByte getByteOrNull​(T t,
                                                               int columnIndex)
                                                        throws SQLException
        Get the field value and return Null if the value was $null after reading it.
        Parameters:
        columnIndex - the column number.
        Returns:
        Null if the value was $null otherwise 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 ResultSetShort getShortOrNull​(T t,
                                                                 int columnIndex)
                                                          throws SQLException
        Get the field value and return Null if the value was $null after reading it.
        Parameters:
        columnIndex - the column number.
        Returns:
        Null if the value was $null otherwise 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 ResultSetInteger getIntOrNull​(T t,
                                                                 int columnIndex)
                                                          throws SQLException
        Get the field value and return Null if the value was $null after reading it.
        Parameters:
        columnIndex - the column number.
        Returns:
        Null if the value was $null otherwise 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 ResultSetLong getLongOrNull​(T t,
                                                               int columnIndex)
                                                        throws SQLException
        Get the field value and return Null if the value was $null after reading it.
        Parameters:
        columnIndex - the column number.
        Returns:
        Null if the value was $null otherwise 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 ResultSetFloat getFloatOrNull​(T t,
                                                                 int columnIndex)
                                                          throws SQLException
        Get the field value and return Null if the value was $null after reading it.
        Parameters:
        columnIndex - the column number.
        Returns:
        Null if the value was $null otherwise 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 ResultSetDouble getDoubleOrNull​(T t,
                                                                   int columnIndex)
                                                            throws SQLException
        Get the field value and return Null if the value was $null after reading it.
        Parameters:
        columnIndex - the column number.
        Returns:
        Null if the value was $null otherwise 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 ResultSetBoolean getBooleanOrNull​(T t,
                                                                     String columnLabel)
                                                              throws SQLException
        Get the field value and return Null if the value was $null after reading it.
        Parameters:
        columnLabel - the column name.
        Returns:
        Null if the value was $null otherwise 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 ResultSetByte getByteOrNull​(T t,
                                                               String columnLabel)
                                                        throws SQLException
        Get the field value and return Null if the value was $null after reading it.
        Parameters:
        columnLabel - the column name.
        Returns:
        Null if the value was $null otherwise 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 ResultSetShort getShortOrNull​(T t,
                                                                 String columnLabel)
                                                          throws SQLException
        Get the field value and return Null if the value was $null after reading it.
        Parameters:
        columnLabel - the column name.
        Returns:
        Null if the value was $null otherwise 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 ResultSetInteger getIntOrNull​(T t,
                                                                 String columnLabel)
                                                          throws SQLException
        Get the field value and return Null if the value was $null after reading it.
        Parameters:
        columnLabel - the column name.
        Returns:
        Null if the value was $null otherwise 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 ResultSetLong getLongOrNull​(T t,
                                                               String columnLabel)
                                                        throws SQLException
        Get the field value and return Null if the value was $null after reading it.
        Parameters:
        columnLabel - the column name.
        Returns:
        Null if the value was $null otherwise 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 ResultSetFloat getFloatOrNull​(T t,
                                                                 String columnLabel)
                                                          throws SQLException
        Get the field value and return Null if the value was $null after reading it.
        Parameters:
        columnLabel - the column name.
        Returns:
        Null if the value was $null otherwise 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 ResultSetDouble getDoubleOrNull​(T t,
                                                                   String columnLabel)
                                                            throws SQLException
        Get the field value and return Null if the value was $null after reading it.
        Parameters:
        columnLabel - the column name.
        Returns:
        Null if the value was $null otherwise 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