Java SQL ResultSet Boolean Read getBoolean(ResultSet res, String name)

Here you can find the source of getBoolean(ResultSet res, String name)

Description

Returns the values of the specified column as a Boolean.

License

MIT License

Parameter

Parameter Description
res a result set.
name a name of the column.

Exception

Parameter Description
SQLException if an error occurs.

Return

the value of the column.

Declaration

public static Boolean getBoolean(ResultSet res, String name) throws SQLException 

Method Source Code

//package com.java2s;
/*//from  w  w  w .  j  a  va 2  s  . co  m
 * Copyright (c) 2015-2016 QuartzDesk.com.
 * Licensed under the MIT license (https://opensource.org/licenses/MIT).
 */

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

public class Main {
    /**
     * Returns the values of the specified column as a Boolean. If the column
     * value is null, this method returns null.
     *
     * @param res  a result set.
     * @param name a name of the column.
     * @return the value of the column.
     * @throws SQLException if an error occurs.
     */
    public static Boolean getBoolean(ResultSet res, String name) throws SQLException {
        boolean v = res.getBoolean(name);
        return res.wasNull() ? null : v;
    }
}

Related

  1. getBoolean(ResultSet resultSet, int columnIndex)
  2. getBoolean(ResultSet rs, int index)
  3. getBoolean(ResultSet rs, String colName)
  4. getBoolean(ResultSet rs, String columnLabel)