Java SQL ResultSet Read getNullableBooleanFromResultSet(ResultSet rset, Enum field)

Here you can find the source of getNullableBooleanFromResultSet(ResultSet rset, Enum field)

Description

get Nullable Boolean From Result Set

License

Open Source License

Declaration

public static Boolean getNullableBooleanFromResultSet(ResultSet rset, Enum field) throws SQLException 

Method Source Code

//package com.java2s;
/**/*from   w w w .  j a  v a 2 s  . c om*/
 Copyright (c) 2013, Amit Lieberman
All rights reserved.
    
           GNU LESSER GENERAL PUBLIC LICENSE
               Version 3, 29 June 2007
    
 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.
    
    
  This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License
    
 * Created with love
 * User: shpandrak
 * Date: 10/20/12
 * Time: 10:37
 */

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

public class Main {
    public static Boolean getNullableBooleanFromResultSet(ResultSet rset, String fieldName) throws SQLException {
        Boolean retVal = rset.getBoolean(fieldName);
        return rset.wasNull() ? null : retVal;
    }

    public static Boolean getNullableBooleanFromResultSet(ResultSet rset, Enum field) throws SQLException {
        return getNullableBooleanFromResultSet(rset, field.name());
    }
}

Related

  1. getMap(ResultSet resultSet)
  2. getMap(ResultSet resultSet)
  3. getMap(ResultSet rs, ResultSetMetaData metaData, int cols_len)
  4. getMetaData(ResultSet rs)
  5. getNullable(final ResultSet resultSet, final T value)
  6. getNullableByte(ResultSet resultSet, String columnLabel)
  7. getNullableInt(ResultSet resultSet, String column, int fallback)
  8. getNullableLong(ResultSet rs, String columnName)
  9. getNullDate(ResultSet result, String columnName)