Here you can find the source of setByte(PreparedStatement statement, int index, Byte value)
Parameter | Description |
---|---|
statement | - Prepared SQL statement. |
index | - Parameter index. |
value | - Parameter value. |
public static void setByte(PreparedStatement statement, int index, Byte value) throws SQLException
//package com.java2s; /*//from w ww. ja v a 2 s. c o m * Copyright (C) 2015 Bryan W. Snipes * * This file is part of the JDistil web application framework. * * JDistil is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * JDistil is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with JDistil. If not, see <http://www.gnu.org/licenses/>. */ import java.sql.PreparedStatement; import java.sql.SQLException; import java.sql.Types; public class Main { /** Sets a SQL parameter of type byte using a prepared SQL statement, an index and a value. @param statement - Prepared SQL statement. @param index - Parameter index. @param value - Parameter value. */ public static void setByte(PreparedStatement statement, int index, Byte value) throws SQLException { if (statement != null) { // Set parameter if (value == null) { statement.setNull(index, Types.TINYINT); } else { statement.setByte(index, value.byteValue()); } } } }