Java SQL ResultSet Long Read getLongValue(ResultSet resultSet, int columnIndex)

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

Description

Return any long value.

License

Apache License

Declaration

@SuppressWarnings("UnnecessaryBoxing")
public static Long getLongValue(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 {
    /**//w  w  w  . j a v  a2 s . c  om
     * Return any long value.
     */
    @SuppressWarnings("UnnecessaryBoxing")
    public static Long getLongValue(ResultSet resultSet, int columnIndex) throws SQLException {
        long value = resultSet.getLong(columnIndex);
        if (resultSet.wasNull()) {
            return null;
        }
        return Long.valueOf(value);
    }

    /**
     * Return any long value.
     */
    @SuppressWarnings("UnnecessaryBoxing")
    public static Long getLongValue(ResultSet resultSet, String columnName) throws SQLException {
        long value = resultSet.getLong(columnName);
        if (resultSet.wasNull()) {
            return null;
        }
        return Long.valueOf(value);
    }
}

Related

  1. getLongFromResultSet(ResultSet rs, String db_name)
  2. getLongFromResultSet(ResultSet rs, String field)
  3. getLongList(ResultSet resultSet, String columnName)
  4. getLongOrNull(ResultSet rs, String column)
  5. getLongString(ResultSet rs, int pos)
  6. getLongValue(ResultSet rs, int valueIndex)
  7. readLongFromResultSet(ResultSet rs, String column)