Java SQL ResultSet Short Read getShortValue(ResultSet resultSet, int columnIndex)

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

Description

Return any short value.

License

Apache License

Declaration

@SuppressWarnings("UnnecessaryBoxing")
public static Short getShortValue(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 {
    /**/* ww w.ja v a2s .  c o m*/
     * Return any short value.
     */
    @SuppressWarnings("UnnecessaryBoxing")
    public static Short getShortValue(ResultSet resultSet, int columnIndex) throws SQLException {
        short value = resultSet.getShort(columnIndex);
        if (resultSet.wasNull()) {
            return null;
        }
        return Short.valueOf(value);
    }

    /**
     * Return any short value.
     */
    @SuppressWarnings("UnnecessaryBoxing")
    public static Short getShortValue(ResultSet resultSet, String columnName) throws SQLException {
        short value = resultSet.getShort(columnName);
        if (resultSet.wasNull()) {
            return null;
        }
        return Short.valueOf(value);
    }
}

Related

  1. getShort(ResultSet resultSet, int columnIndex)
  2. getShort(ResultSet resultSet, String columnName)
  3. getShort(ResultSet rs, String column)
  4. getShortList(ResultSet resultSet, String columnName)
  5. getShortOrNull(ResultSet rs, String column)