📄 callablestatementproxy.java
字号:
// jTDS JDBC Driver for Microsoft SQL Server and Sybase// Copyright (C) 2004 The jTDS Project//// This library 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 2.1 of the License, or (at your option) any later version.//// This library 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 this library; if not, write to the Free Software// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA//package net.sourceforge.jtds.jdbcx.proxy;import java.math.BigDecimal;import java.sql.*;import java.util.Calendar;import net.sourceforge.jtds.jdbc.*;/** * This class would be better implemented as a java.lang.reflect.Proxy. However, this * feature was not added until 1.3 and reflection performance was not improved until 1.4. * Since the driver still needs to be compatible with 1.2 and 1.3 this class is used * to delegate the calls to a callable statement with minimal overhead. * * @version $Id: CallableStatementProxy.java,v 1.3 2004/08/24 17:45:08 bheineman Exp $ */public class CallableStatementProxyextends PreparedStatementProxyimplements CallableStatement { private JtdsCallableStatement _callableStatement; CallableStatementProxy(ConnectionProxy connection, JtdsCallableStatement callableStatement) { super(connection, callableStatement); _callableStatement = callableStatement; } /** * Delgates calls to the callable statement; SQLExceptions thrown from the * callable statement will cause an event to be fired on the connection * pool listeners. * * @throws SQLException if an error occurs */ public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException { validateConnection(); try { _callableStatement.registerOutParameter(parameterIndex, sqlType); } catch (SQLException sqlException) { processSQLException(sqlException); } } /** * Delgates calls to the callable statement; SQLExceptions thrown from the * callable statement will cause an event to be fired on the connection * pool listeners. * * @throws SQLException if an error occurs */ public void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException { validateConnection(); try { _callableStatement.registerOutParameter(parameterIndex, sqlType, scale); } catch (SQLException sqlException) { processSQLException(sqlException); } } /** * Delgates calls to the callable statement; SQLExceptions thrown from the * callable statement will cause an event to be fired on the connection * pool listeners. * * @throws SQLException if an error occurs */ public boolean wasNull() throws SQLException { validateConnection(); try { return _callableStatement.wasNull(); } catch (SQLException sqlException) { processSQLException(sqlException); } return false; } /** * Delgates calls to the callable statement; SQLExceptions thrown from the * callable statement will cause an event to be fired on the connection * pool listeners. * * @throws SQLException if an error occurs */ public String getString(int parameterIndex) throws SQLException { validateConnection(); try { return _callableStatement.getString(parameterIndex); } catch (SQLException sqlException) { processSQLException(sqlException); } return null; } /** * Delgates calls to the callable statement; SQLExceptions thrown from the * callable statement will cause an event to be fired on the connection * pool listeners. * * @throws SQLException if an error occurs */ public boolean getBoolean(int parameterIndex) throws SQLException { validateConnection(); try { return _callableStatement.getBoolean(parameterIndex); } catch (SQLException sqlException) { processSQLException(sqlException); } return false; } /** * Delgates calls to the callable statement; SQLExceptions thrown from the * callable statement will cause an event to be fired on the connection * pool listeners. * * @throws SQLException if an error occurs */ public byte getByte(int parameterIndex) throws SQLException { validateConnection(); try { return _callableStatement.getByte(parameterIndex); } catch (SQLException sqlException) { processSQLException(sqlException); } return Byte.MIN_VALUE; } /** * Delgates calls to the callable statement; SQLExceptions thrown from the * callable statement will cause an event to be fired on the connection * pool listeners. * * @throws SQLException if an error occurs */ public short getShort(int parameterIndex) throws SQLException { validateConnection(); try { return _callableStatement.getShort(parameterIndex); } catch (SQLException sqlException) { processSQLException(sqlException); } return Short.MIN_VALUE; } /** * Delgates calls to the callable statement; SQLExceptions thrown from the * callable statement will cause an event to be fired on the connection * pool listeners. * * @throws SQLException if an error occurs */ public int getInt(int parameterIndex) throws SQLException { validateConnection(); try { return _callableStatement.getInt(parameterIndex); } catch (SQLException sqlException) { processSQLException(sqlException); } return Integer.MIN_VALUE; } /** * Delgates calls to the callable statement; SQLExceptions thrown from the * callable statement will cause an event to be fired on the connection * pool listeners. * * @throws SQLException if an error occurs */ public long getLong(int parameterIndex) throws SQLException { validateConnection(); try { return _callableStatement.getLong(parameterIndex); } catch (SQLException sqlException) { processSQLException(sqlException); } return Long.MIN_VALUE; } /** * Delgates calls to the callable statement; SQLExceptions thrown from the * callable statement will cause an event to be fired on the connection * pool listeners. * * @throws SQLException if an error occurs */ public float getFloat(int parameterIndex) throws SQLException { validateConnection(); try { return _callableStatement.getFloat(parameterIndex); } catch (SQLException sqlException) { processSQLException(sqlException); } return Float.MIN_VALUE; } /** * Delgates calls to the callable statement; SQLExceptions thrown from the * callable statement will cause an event to be fired on the connection * pool listeners. * * @throws SQLException if an error occurs */ public double getDouble(int parameterIndex) throws SQLException { validateConnection(); try { return _callableStatement.getDouble(parameterIndex); } catch (SQLException sqlException) { processSQLException(sqlException); } return Double.MIN_VALUE; } /** * Delgates calls to the callable statement; SQLExceptions thrown from the * callable statement will cause an event to be fired on the connection * pool listeners. * * @throws SQLException if an error occurs */ public BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException { validateConnection(); try { return _callableStatement.getBigDecimal(parameterIndex, scale); } catch (SQLException sqlException) { processSQLException(sqlException); } return null; } /** * Delgates calls to the callable statement; SQLExceptions thrown from the * callable statement will cause an event to be fired on the connection * pool listeners. * * @throws SQLException if an error occurs */ public byte[] getBytes(int parameterIndex) throws SQLException { validateConnection(); try { return _callableStatement.getBytes(parameterIndex); } catch (SQLException sqlException) { processSQLException(sqlException); } return null; } /** * Delgates calls to the callable statement; SQLExceptions thrown from the * callable statement will cause an event to be fired on the connection * pool listeners. * * @throws SQLException if an error occurs */ public Date getDate(int parameterIndex) throws SQLException { validateConnection(); try { return _callableStatement.getDate(parameterIndex); } catch (SQLException sqlException) { processSQLException(sqlException); } return null; } /** * Delgates calls to the callable statement; SQLExceptions thrown from the * callable statement will cause an event to be fired on the connection * pool listeners. * * @throws SQLException if an error occurs */ public Time getTime(int parameterIndex) throws SQLException { validateConnection(); try { return _callableStatement.getTime(parameterIndex); } catch (SQLException sqlException) { processSQLException(sqlException); } return null; } /** * Delgates calls to the callable statement; SQLExceptions thrown from the * callable statement will cause an event to be fired on the connection * pool listeners. * * @throws SQLException if an error occurs */ public Timestamp getTimestamp(int parameterIndex) throws SQLException { validateConnection(); try { return _callableStatement.getTimestamp(parameterIndex); } catch (SQLException sqlException) { processSQLException(sqlException); } return null; } /** * Delgates calls to the callable statement; SQLExceptions thrown from the * callable statement will cause an event to be fired on the connection * pool listeners. * * @throws SQLException if an error occurs */ public Object getObject(int parameterIndex) throws SQLException { validateConnection(); try { return _callableStatement.getObject(parameterIndex); } catch (SQLException sqlException) { processSQLException(sqlException); } return null; } /** * Delgates calls to the callable statement; SQLExceptions thrown from the * callable statement will cause an event to be fired on the connection * pool listeners. * * @throws SQLException if an error occurs */ public BigDecimal getBigDecimal(int parameterIndex) throws SQLException {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -