⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 preparedstatementproxy.java

📁 第三方的SQL Server and Sybase的jdbc dirver,速度更快
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
// 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 prepared statement with minimal overhead. * * @version $Id: PreparedStatementProxy.java,v 1.3 2004/08/24 17:45:08 bheineman Exp $ */public class PreparedStatementProxyextends StatementProxyimplements PreparedStatement {    private JtdsPreparedStatement _preparedStatement;        PreparedStatementProxy(ConnectionProxy connection, JtdsPreparedStatement preparedStatement) {        super(connection, preparedStatement);                _preparedStatement = preparedStatement;    }    /**     * Delgates calls to the prepared statement; SQLExceptions thrown from the     * prepared statement will cause an event to be fired on the connection     * pool listeners.     *     * @throws SQLException if an error occurs     */    public ResultSet executeQuery() throws SQLException {        validateConnection();        try {            return _preparedStatement.executeQuery();        } catch (SQLException sqlException) {            processSQLException(sqlException);        }                return null;    }    /**     * Delgates calls to the prepared statement; SQLExceptions thrown from the     * prepared statement will cause an event to be fired on the connection     * pool listeners.     *     * @throws SQLException if an error occurs     */    public int executeUpdate() throws SQLException {        validateConnection();        try {            return _preparedStatement.executeUpdate();        } catch (SQLException sqlException) {            processSQLException(sqlException);        }                return Integer.MIN_VALUE;    }    /**     * Delgates calls to the prepared statement; SQLExceptions thrown from the     * prepared statement will cause an event to be fired on the connection     * pool listeners.     *     * @throws SQLException if an error occurs     */    public void setNull(int parameterIndex, int sqlType) throws SQLException {        validateConnection();        try {            _preparedStatement.setNull(parameterIndex, sqlType);        } catch (SQLException sqlException) {            processSQLException(sqlException);        }    }    /**     * Delgates calls to the prepared statement; SQLExceptions thrown from the     * prepared statement will cause an event to be fired on the connection     * pool listeners.     *     * @throws SQLException if an error occurs     */    public void setBoolean(int parameterIndex, boolean x) throws SQLException {        validateConnection();        try {            _preparedStatement.setBoolean(parameterIndex, x);        } catch (SQLException sqlException) {            processSQLException(sqlException);        }    }    /**     * Delgates calls to the prepared statement; SQLExceptions thrown from the     * prepared statement will cause an event to be fired on the connection     * pool listeners.     *     * @throws SQLException if an error occurs     */    public void setByte(int parameterIndex, byte x) throws SQLException {        validateConnection();        try {            _preparedStatement.setByte(parameterIndex, x);        } catch (SQLException sqlException) {            processSQLException(sqlException);        }    }    /**     * Delgates calls to the prepared statement; SQLExceptions thrown from the     * prepared statement will cause an event to be fired on the connection     * pool listeners.     *     * @throws SQLException if an error occurs     */    public void setShort(int parameterIndex, short x) throws SQLException {        validateConnection();        try {            _preparedStatement.setShort(parameterIndex, x);        } catch (SQLException sqlException) {            processSQLException(sqlException);        }    }    /**     * Delgates calls to the prepared statement; SQLExceptions thrown from the     * prepared statement will cause an event to be fired on the connection     * pool listeners.     *     * @throws SQLException if an error occurs     */    public void setInt(int parameterIndex, int x) throws SQLException {        validateConnection();        try {            _preparedStatement.setInt(parameterIndex, x);        } catch (SQLException sqlException) {            processSQLException(sqlException);        }    }    /**     * Delgates calls to the prepared statement; SQLExceptions thrown from the     * prepared statement will cause an event to be fired on the connection     * pool listeners.     *     * @throws SQLException if an error occurs     */    public void setLong(int parameterIndex, long x) throws SQLException {        validateConnection();        try {            _preparedStatement.setLong(parameterIndex, x);        } catch (SQLException sqlException) {            processSQLException(sqlException);        }    }    /**     * Delgates calls to the prepared statement; SQLExceptions thrown from the     * prepared statement will cause an event to be fired on the connection     * pool listeners.     *     * @throws SQLException if an error occurs     */    public void setFloat(int parameterIndex, float x) throws SQLException {        validateConnection();        try {            _preparedStatement.setFloat(parameterIndex, x);        } catch (SQLException sqlException) {            processSQLException(sqlException);        }    }    /**     * Delgates calls to the prepared statement; SQLExceptions thrown from the     * prepared statement will cause an event to be fired on the connection     * pool listeners.     *     * @throws SQLException if an error occurs     */    public void setDouble(int parameterIndex, double x) throws SQLException {        validateConnection();        try {            _preparedStatement.setDouble(parameterIndex, x);        } catch (SQLException sqlException) {            processSQLException(sqlException);        }    }    /**     * Delgates calls to the prepared statement; SQLExceptions thrown from the     * prepared statement will cause an event to be fired on the connection     * pool listeners.     *     * @throws SQLException if an error occurs     */    public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException {        validateConnection();        try {            _preparedStatement.setBigDecimal(parameterIndex, x);        } catch (SQLException sqlException) {            processSQLException(sqlException);        }    }    /**     * Delgates calls to the prepared statement; SQLExceptions thrown from the     * prepared statement will cause an event to be fired on the connection     * pool listeners.     *     * @throws SQLException if an error occurs     */    public void setString(int parameterIndex, String x) throws SQLException {        validateConnection();        try {            _preparedStatement.setString(parameterIndex, x);        } catch (SQLException sqlException) {            processSQLException(sqlException);        }    }    /**     * Delgates calls to the prepared statement; SQLExceptions thrown from the     * prepared statement will cause an event to be fired on the connection     * pool listeners.     *     * @throws SQLException if an error occurs     */    public void setBytes(int parameterIndex, byte[] x) throws SQLException {        validateConnection();        try {            _preparedStatement.setBytes(parameterIndex, x);        } catch (SQLException sqlException) {            processSQLException(sqlException);        }    }    /**     * Delgates calls to the prepared statement; SQLExceptions thrown from the     * prepared statement will cause an event to be fired on the connection     * pool listeners.     *     * @throws SQLException if an error occurs     */    public void setDate(int parameterIndex, java.sql.Date x) throws SQLException {        validateConnection();        try {            _preparedStatement.setDate(parameterIndex, x);        } catch (SQLException sqlException) {            processSQLException(sqlException);        }    }    /**     * Delgates calls to the prepared statement; SQLExceptions thrown from the     * prepared statement will cause an event to be fired on the connection     * pool listeners.     *     * @throws SQLException if an error occurs     */    public void setTime(int parameterIndex, java.sql.Time x) throws SQLException {        validateConnection();        try {            _preparedStatement.setTime(parameterIndex, x);        } catch (SQLException sqlException) {            processSQLException(sqlException);        }    }    /**     * Delgates calls to the prepared statement; SQLExceptions thrown from the     * prepared statement will cause an event to be fired on the connection     * pool listeners.     *     * @throws SQLException if an error occurs     */    public void setTimestamp(int parameterIndex, java.sql.Timestamp x) throws SQLException {        validateConnection();        try {            _preparedStatement.setTimestamp(parameterIndex, x);        } catch (SQLException sqlException) {            processSQLException(sqlException);        }    }    /**     * Delgates calls to the prepared statement; SQLExceptions thrown from the     * prepared statement will cause an event to be fired on the connection     * pool listeners.     *     * @throws SQLException if an error occurs     */    public void setAsciiStream(int parameterIndex, java.io.InputStream x, int length) throws SQLException {        validateConnection();        try {            _preparedStatement.setAsciiStream(parameterIndex, x, length);        } catch (SQLException sqlException) {            processSQLException(sqlException);        }    }    /**     * Delgates calls to the prepared statement; SQLExceptions thrown from the     * prepared statement will cause an event to be fired on the connection     * pool listeners.     *

⌨️ 快捷键说明

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