Java SQL ResultSet Float Read getFloatValue(ResultSet resultSet, int columnIndex)

Here you can find the source of getFloatValue(ResultSet resultSet, int columnIndex)

Description

Return any float value.

License

Apache License

Declaration

@SuppressWarnings("UnnecessaryBoxing")
public static Float getFloatValue(ResultSet resultSet, int columnIndex) throws SQLException 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.sql.ResultSet;
import java.sql.SQLException;

public class Main {
    /**/*from  w w w .  j  a  v a  2  s .c  o  m*/
     * Return any float value.
     */
    @SuppressWarnings("UnnecessaryBoxing")
    public static Float getFloatValue(ResultSet resultSet, int columnIndex) throws SQLException {
        float value = resultSet.getFloat(columnIndex);
        if (resultSet.wasNull()) {
            return null;
        }
        return Float.valueOf(value);
    }

    /**
     * Return any float value.
     */
    @SuppressWarnings("UnnecessaryBoxing")
    public static Float getFloatValue(ResultSet resultSet, String columnName) throws SQLException {
        float value = resultSet.getFloat(columnName);
        if (resultSet.wasNull()) {
            return null;
        }
        return Float.valueOf(value);
    }
}

Related

  1. getFloat(ResultSet resultSet, String columnName)
  2. getFloat(ResultSet rs, String colName)
  3. getFloat(ResultSet rs, String column)
  4. getFloatList(ResultSet resultSet, String columnName)
  5. getFloatOfNull(ResultSet rs, String columnName)