callablestatementwrapper.java

来自「在资料浩瀚的互联网中」· Java 代码 · 共 1,416 行 · 第 1/4 页

JAVA
1,416
字号
/*     Copyright (C) 2002-2004 MySQL AB     This program is free software; you can redistribute it and/or modify     it under the terms of version 2 of the GNU General Public License as      published by the Free Software Foundation.     There are special exceptions to the terms and conditions of the GPL      as it is applied to this software. View the full text of the      exception in file EXCEPTIONS-CONNECTOR-J in the directory of this      software distribution.     This program 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 General Public License for more details.     You should have received a copy of the GNU General Public License     along with this program; if not, write to the Free Software     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA*/package com.mysql.jdbc.jdbc2.optional;import java.io.InputStream;import java.io.Reader;import java.math.BigDecimal;import java.net.URL;import java.sql.Array;import java.sql.Blob;import java.sql.CallableStatement;import java.sql.Clob;import java.sql.Date;import java.sql.PreparedStatement;import java.sql.Ref;import java.sql.SQLException;import java.sql.Time;import java.sql.Timestamp;import java.util.Calendar;import java.util.Map;import com.mysql.jdbc.SQLError;/** * Wraps callable statements created by pooled connections. *  * @version $Id: CallableStatementWrapper.java,v 1.1.2.1 2004/12/15 21:59:49 mmatthew Exp $ */public class CallableStatementWrapper extends PreparedStatementWrapper 	implements CallableStatement {		/**	 * @param c	 * @param conn	 * @param toWrap	 */	public CallableStatementWrapper(ConnectionWrapper c,			MysqlPooledConnection conn, CallableStatement toWrap) {		super(c, conn, toWrap);	}	/* (non-Javadoc)	 * @see java.sql.CallableStatement#registerOutParameter(int, int)	 */	public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException {		try {            if (this.wrappedStmt != null) {                ((CallableStatement) this.wrappedStmt).registerOutParameter(parameterIndex, sqlType);            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }	}	/* (non-Javadoc)	 * @see java.sql.CallableStatement#registerOutParameter(int, int, int)	 */	public void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException {		try {            if (this.wrappedStmt != null) {                ((CallableStatement) this.wrappedStmt).registerOutParameter(parameterIndex, sqlType, scale);            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }	}	/* (non-Javadoc)	 * @see java.sql.CallableStatement#wasNull()	 */	public boolean wasNull() throws SQLException {		try {            if (this.wrappedStmt != null) {                return ((CallableStatement) this.wrappedStmt).wasNull();            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }                return false;	}	/* (non-Javadoc)	 * @see java.sql.CallableStatement#getString(int)	 */	public String getString(int parameterIndex) throws SQLException {		try {            if (this.wrappedStmt != null) {                return ((CallableStatement) this.wrappedStmt).getString(parameterIndex);            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }		return null;	}	/* (non-Javadoc)	 * @see java.sql.CallableStatement#getBoolean(int)	 */	public boolean getBoolean(int parameterIndex) throws SQLException {		try {            if (this.wrappedStmt != null) {                return ((CallableStatement) this.wrappedStmt).getBoolean(parameterIndex);            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }		return false;	}	/* (non-Javadoc)	 * @see java.sql.CallableStatement#getByte(int)	 */	public byte getByte(int parameterIndex) throws SQLException {		try {            if (this.wrappedStmt != null) {                return ((CallableStatement) this.wrappedStmt).getByte(parameterIndex);            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }        		return 0;	}	/* (non-Javadoc)	 * @see java.sql.CallableStatement#getShort(int)	 */	public short getShort(int parameterIndex) throws SQLException {		try {            if (this.wrappedStmt != null) {                return ((CallableStatement) this.wrappedStmt).getShort(parameterIndex);            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }        		return 0;	}	/* (non-Javadoc)	 * @see java.sql.CallableStatement#getInt(int)	 */	public int getInt(int parameterIndex) throws SQLException {		try {            if (this.wrappedStmt != null) {                return ((CallableStatement) this.wrappedStmt).getInt(parameterIndex);            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }        		return 0;	}	/* (non-Javadoc)	 * @see java.sql.CallableStatement#getLong(int)	 */	public long getLong(int parameterIndex) throws SQLException {		try {            if (this.wrappedStmt != null) {                return ((CallableStatement) this.wrappedStmt).getLong(parameterIndex);            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }        		return 0;	}	/* (non-Javadoc)	 * @see java.sql.CallableStatement#getFloat(int)	 */	public float getFloat(int parameterIndex) throws SQLException {		try {            if (this.wrappedStmt != null) {                return ((CallableStatement) this.wrappedStmt).getFloat(parameterIndex);            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }        		return 0;	}	/* (non-Javadoc)	 * @see java.sql.CallableStatement#getDouble(int)	 */	public double getDouble(int parameterIndex) throws SQLException {		try {            if (this.wrappedStmt != null) {                return ((CallableStatement) this.wrappedStmt).getDouble(parameterIndex);            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }        		return 0;	}	/* (non-Javadoc)	 * @see java.sql.CallableStatement#getBigDecimal(int, int)	 */	public BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException {		try {            if (this.wrappedStmt != null) {                return ((CallableStatement) this.wrappedStmt).getBigDecimal(parameterIndex, scale);            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }        		return null;	}	/* (non-Javadoc)	 * @see java.sql.CallableStatement#getBytes(int)	 */	public byte[] getBytes(int parameterIndex) throws SQLException {		try {            if (this.wrappedStmt != null) {                return ((CallableStatement) this.wrappedStmt).getBytes(parameterIndex);            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }        		return null;	}	/* (non-Javadoc)	 * @see java.sql.CallableStatement#getDate(int)	 */	public Date getDate(int parameterIndex) throws SQLException {		try {            if (this.wrappedStmt != null) {                return ((CallableStatement) this.wrappedStmt).getDate(parameterIndex);            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }        		return null;	}	/* (non-Javadoc)	 * @see java.sql.CallableStatement#getTime(int)	 */	public Time getTime(int parameterIndex) throws SQLException {		try {            if (this.wrappedStmt != null) {                return ((CallableStatement) this.wrappedStmt).getTime(parameterIndex);            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }        		return null;	}	/* (non-Javadoc)	 * @see java.sql.CallableStatement#getTimestamp(int)	 */	public Timestamp getTimestamp(int parameterIndex) throws SQLException {		try {            if (this.wrappedStmt != null) {                return ((CallableStatement) this.wrappedStmt).getTimestamp(parameterIndex);            } else {                throw new SQLException("No operations allowed after statement closed",                    SQLError.SQL_STATE_GENERAL_ERROR);            }        } catch (SQLException sqlEx) {            checkAndFireConnectionError(sqlEx);        }        		return null;	}	/* (non-Javadoc)	 * @see java.sql.CallableStatement#getObject(int)	 */	public Object getObject(int parameterIndex) throws SQLException {		try {

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?