Here you can find the source of getNullableByte(ResultSet resultSet, String columnLabel)
Parameter | Description |
---|---|
resultSet | The ResultSet from which to retrieve the column. |
columnLabel | The label of the column. |
Parameter | Description |
---|---|
SQLException | If the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set. |
public static Byte getNullableByte(ResultSet resultSet, String columnLabel) throws SQLException
//package com.java2s; //License from project: Open Source License import java.sql.ResultSet; import java.sql.SQLException; public class Main { /**/*from w w w . j a va 2 s. co m*/ * Returns the value of the specified column from the ResultSet or null if the value is nullable and was null. * @param resultSet The ResultSet from which to retrieve the column. * @param columnLabel The label of the column. * @return The value for the column or null if it was null. * @throws SQLException If the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set. */ public static Byte getNullableByte(ResultSet resultSet, String columnLabel) throws SQLException { byte value = resultSet.getByte(columnLabel); return resultSet.wasNull() ? null : value; } /** * Returns the value of the specified column from the ResultSet or null if the value is nullable and was null. * @param resultSet The ResultSet from which to retrieve the column. * @param columnIndex The numerical index of the column (starting with 1 for the first column). * @return The value for the column or null if it was null. * @throws SQLException If the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set. */ public static Byte getNullableByte(ResultSet resultSet, int columnIndex) throws SQLException { byte value = resultSet.getByte(columnIndex); return resultSet.wasNull() ? null : value; } }