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

📄 connectionproxy.java

📁 jtds的源码 是你学习java的好东西
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
     *
     * @throws SQLException if an error occurs
     */
    public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
        validateConnection();

        try {
            return new CallableStatementProxy(this, (JtdsCallableStatement) _connection.prepareCall(sql, resultSetType, resultSetConcurrency));
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }

        return null;
    }

    /**
     * Delgates calls to the connection; SQLExceptions thrown from the connection
     * will cause an event to be fired on the connection pool listeners.
     *
     * @throws SQLException if an error occurs
     */
    public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
        validateConnection();

        try {
            return new CallableStatementProxy(this, (JtdsCallableStatement) _connection.prepareCall(sql, resultSetType, resultSetConcurrency, resultSetHoldability));
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }

        return null;
    }

    /**
     * Delgates calls to the connection; SQLExceptions thrown from the connection
     * will cause an event to be fired on the connection pool listeners.
     *
     * @throws SQLException if an error occurs
     */
    public PreparedStatement prepareStatement(String sql) throws SQLException {
        validateConnection();

        try {
            return new PreparedStatementProxy(this, (JtdsPreparedStatement) _connection.prepareStatement(sql));
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }

        return null;
    }

    /**
     * Delgates calls to the connection; SQLExceptions thrown from the connection
     * will cause an event to be fired on the connection pool listeners.
     *
     * @throws SQLException if an error occurs
     */
    public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
        validateConnection();

        try {
            return new PreparedStatementProxy(this, (JtdsPreparedStatement) _connection.prepareStatement(sql, autoGeneratedKeys));
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }

        return null;
    }

    /**
     * Delgates calls to the connection; SQLExceptions thrown from the connection
     * will cause an event to be fired on the connection pool listeners.
     *
     * @throws SQLException if an error occurs
     */
    public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
        validateConnection();

        try {
            return new PreparedStatementProxy(this, (JtdsPreparedStatement) _connection.prepareStatement(sql, columnIndexes));
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }

        return null;
    }

    /**
     * Delgates calls to the connection; SQLExceptions thrown from the connection
     * will cause an event to be fired on the connection pool listeners.
     *
     * @throws SQLException if an error occurs
     */
    public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
        validateConnection();

        try {
            return new PreparedStatementProxy(this, (JtdsPreparedStatement) _connection.prepareStatement(sql, columnNames));
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }

        return null;
    }

    /**
     * Delgates calls to the connection; SQLExceptions thrown from the connection
     * will cause an event to be fired on the connection pool listeners.
     *
     * @throws SQLException if an error occurs
     */
    public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
        validateConnection();

        try {
            return new PreparedStatementProxy(this, (JtdsPreparedStatement) _connection.prepareStatement(sql, resultSetType, resultSetConcurrency));
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }

        return null;
    }

    /**
     * Delgates calls to the connection; SQLExceptions thrown from the connection
     * will cause an event to be fired on the connection pool listeners.
     *
     * @throws SQLException if an error occurs
     */
    public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
        validateConnection();

        try {
            return new PreparedStatementProxy(this, (JtdsPreparedStatement) _connection.prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability));
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }

        return null;
    }

    /**
     * Delgates calls to the connection; SQLExceptions thrown from the connection
     * will cause an event to be fired on the connection pool listeners.
     *
     * @throws SQLException if an error occurs
     */
    public void releaseSavepoint(Savepoint savepoint) throws SQLException {
        validateConnection();

        try {
            _connection.releaseSavepoint(savepoint);
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }
    }

    /**
     * Delgates calls to the connection; SQLExceptions thrown from the connection
     * will cause an event to be fired on the connection pool listeners.
     *
     * @throws SQLException if an error occurs
     */
    public void rollback() throws SQLException {
        validateConnection();

        try {
            _connection.rollback();
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }
    }

    /**
     * Delgates calls to the connection; SQLExceptions thrown from the connection
     * will cause an event to be fired on the connection pool listeners.
     *
     * @throws SQLException if an error occurs
     */
    public void rollback(Savepoint savepoint) throws SQLException {
        validateConnection();

        try {
            _connection.rollback(savepoint);
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }
    }

    /**
     * Delgates calls to the connection; SQLExceptions thrown from the connection
     * will cause an event to be fired on the connection pool listeners.
     *
     * @throws SQLException if an error occurs
     */
    public void setAutoCommit(boolean autoCommit) throws SQLException {
        validateConnection();

        try {
            _connection.setAutoCommit(autoCommit);
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }
    }

    /**
     * Delgates calls to the connection; SQLExceptions thrown from the connection
     * will cause an event to be fired on the connection pool listeners.
     *
     * @throws SQLException if an error occurs
     */
    public void setCatalog(String catalog) throws SQLException {
        validateConnection();

        try {
            _connection.setCatalog(catalog);
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }
    }

    /**
     * Delgates calls to the connection; SQLExceptions thrown from the connection
     * will cause an event to be fired on the connection pool listeners.
     *
     * @throws SQLException if an error occurs
     */
    public void setHoldability(int holdability) throws SQLException {
        validateConnection();

        try {
            _connection.setHoldability(holdability);
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }
    }

    /**
     * Delgates calls to the connection; SQLExceptions thrown from the connection
     * will cause an event to be fired on the connection pool listeners.
     *
     * @throws SQLException if an error occurs
     */
    public void setReadOnly(boolean readOnly) throws SQLException {
        validateConnection();

        try {
            _connection.setReadOnly(readOnly);
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }
    }

    /**
     * Delgates calls to the connection; SQLExceptions thrown from the connection
     * will cause an event to be fired on the connection pool listeners.
     *
     * @throws SQLException if an error occurs
     */
    public Savepoint setSavepoint() throws SQLException {
        validateConnection();

        try {
            return _connection.setSavepoint();
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }

        return null;
    }

    /**
     * Delgates calls to the connection; SQLExceptions thrown from the connection
     * will cause an event to be fired on the connection pool listeners.
     *
     * @throws SQLException if an error occurs
     */
    public Savepoint setSavepoint(String name) throws SQLException {
        validateConnection();

        try {
            return _connection.setSavepoint(name);
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }

        return null;
    }

    /**
     * Delgates calls to the connection; SQLExceptions thrown from the connection
     * will cause an event to be fired on the connection pool listeners.
     *
     * @throws SQLException if an error occurs
     */
    public void setTransactionIsolation(int level) throws SQLException {
        validateConnection();

        try {
            _connection.setTransactionIsolation(level);
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }
    }

    /**
     * Delgates calls to the connection; SQLExceptions thrown from the connection
     * will cause an event to be fired on the connection pool listeners.
     *
     * @throws SQLException if an error occurs
     */
    public void setTypeMap(Map map) throws SQLException {
        validateConnection();

        try {
            _connection.setTypeMap(map);
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }
    }

    /**
     * Validates the connection state.
     */
    private void validateConnection() throws SQLException {
        if (_closed) {
            throw new SQLException(Messages.get("error.conproxy.noconn"), "HY010");
        }
    }

    /**
     * Processes SQLExceptions.
     */
    void processSQLException(SQLException sqlException) throws SQLException {
        _pooledConnection.fireConnectionEvent(false, sqlException);

        throw sqlException;
    }

    /**
     * Closes the proxy, releasing the connection.
     */
    protected void finalize() {
        close();
    }
}

⌨️ 快捷键说明

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