Java Utililty Methods SQL ResultSet Boolean Read

List of utility methods to do SQL ResultSet Boolean Read

Description

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

Method

BooleangetBoolean(ResultSet res, String name)
Returns the values of the specified column as a Boolean.
boolean v = res.getBoolean(name);
return res.wasNull() ? null : v;
BooleangetBoolean(ResultSet resultSet, int columnIndex)
get Boolean
boolean value = resultSet.getBoolean(columnIndex);
return resultSet.wasNull() ? null : value;
booleangetBoolean(ResultSet rs, int index)
get Boolean
if (rs.getObject(index) != null) {
    return rs.getBoolean(index);
throw new RuntimeException("Null value in non-Nullable column");
BooleangetBoolean(ResultSet rs, String colName)
get Boolean
boolean res = rs.getBoolean(colName);
return rs.wasNull() ? null : new Boolean(res);
BooleangetBoolean(ResultSet rs, String columnLabel)
get Boolean
String booleanString = getTrimmedString(rs, columnLabel);
if ("1".equals(booleanString)) {
    return Boolean.TRUE;
} else if ("0".equals(booleanString)) {
    return Boolean.FALSE;
} else {
    return null;
BooleangetBoolean(ResultSet rs, String columnName)
get a Boolean object from a result set column with given name
boolean value = rs.getBoolean(columnName);
if (rs.wasNull()) {
    return null;
return value;
ObjectgetBoolean(ResultSet rs, String name)
get Boolean
try {
    return "\"" + name + "\":" + rs.getBoolean(name) + "";
} catch (SQLException ex) {
    return "\"" + name + "\":\"error\"";
booleangetBooleanFromResultSet(ResultSet rset, String field)
get Boolean From Result Set
return rset.getBoolean(field);
BooleangetBooleanOrNull(ResultSet rs, String column)
get Boolean Or Null
boolean bVal = rs.getBoolean(column);
if (!bVal && rs.wasNull()) {
    return null;
return new Boolean(bVal);
booleangetBooleanSuppressSQLException(final ResultSet rs, final String columnLabel)
Retrieves the value of the designated column in the current row of this ResultSet object as a boolean in the Java programming language suppressing SQLException
boolean columnValue = false;
try {
    columnValue = rs.getBoolean(columnLabel);
} catch (SQLException ex) {
return columnValue;