Java Utililty Methods SQL ResultSet Int Read

List of utility methods to do SQL ResultSet Int Read

Description

The list of methods to do SQL ResultSet Int Read are organized into topic(s).

Method

intgetInt(ResultSet p_rset, int p_col)
static method for handling positional column gets for int values
try {
    return p_rset.getInt(p_col);
} catch (SQLException e_sql) {
    return -1;
IntegergetInt(ResultSet res, String name)
Returns the values of the specified column as an Integer.
int v = res.getInt(name);
return res.wasNull() ? null : v;
IntegergetInt(ResultSet results, int parameterIndex)
get Int
int value = results.getInt(parameterIndex);
if (results.wasNull()) {
    return null;
return value;
IntegergetInt(ResultSet rs, int columnIndex)
get Int
int i = rs.getInt(columnIndex);
return rs.wasNull() ? null : i;
intgetInt(ResultSet rs, String column)
get and integer from ResultSet rs with name 'column'
int i = rs.getInt(column);
if (rs.wasNull())
    i = 0;
return i;
IntegergetInt(ResultSet rs, String columnName)
get Int
int i = rs.getInt(columnName);
return rs.wasNull() ? null : i;
IntegergetInteger(final ResultSet rs, final String field)
This method will return an Integer, functioning like getInt, but with the ability to recognize null values, instead of converting them to zero.
if (rs.getObject(field) == null) {
    return null;
return Integer.valueOf(rs.getInt(field));
IntegergetInteger(ResultSet resultSet, String columnName)
Returns an integer value using a given SQL result set and column name.
Integer value = null;
if (resultSet != null && columnName != null) {
    int columnValue = resultSet.getInt(columnName);
    if (!resultSet.wasNull()) {
        value = new Integer(columnValue);
return value;
...
IntegergetInteger(ResultSet rs, String colName)
get Integer
int res = rs.getInt(colName);
return rs.wasNull() ? null : new Integer(res);
IntegergetInteger(ResultSet rs, String column)
get Integer
int i = rs.getInt(column);
return rs.wasNull() ? null : i;