statementproxy.java

来自「SAP这个系统的一个转换器」· Java 代码 · 共 687 行 · 第 1/2 页

JAVA
687
字号
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }
    }

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

        try {
            return _statement.getFetchDirection();
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }

        return Integer.MIN_VALUE;
    }

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

        try {
            _statement.setFetchSize(rows);
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }
    }

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

        try {
            return _statement.getFetchSize();
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }

        return Integer.MIN_VALUE;
    }

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

        try {
            return _statement.getResultSetConcurrency();
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }

        return Integer.MIN_VALUE;
    }

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

        try {
            return _statement.getResultSetType();
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }

        return Integer.MIN_VALUE;
    }

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

        try {
            _statement.addBatch(sql);
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }
    }

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

        try {
            _statement.clearBatch();
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }
    }

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

        try {
            return _statement.executeBatch();
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }

        return null;
    }

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

        try {
            return _statement.getConnection();
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }

        return null;
    }

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

        try {
            return _statement.getMoreResults(current);
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }

        return false;
    }

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

        try {
            return _statement.getGeneratedKeys();
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }

        return null;
    }

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

        try {
            return _statement.executeUpdate(sql, autoGeneratedKeys);
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }

        return Integer.MIN_VALUE;
    }

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

        try {
            return _statement.executeUpdate(sql, columnIndexes);
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }

        return Integer.MIN_VALUE;
    }

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

        try {
            return _statement.executeUpdate(sql, columnNames);
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }

        return Integer.MIN_VALUE;
    }

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

        try {
            return _statement.execute(sql, autoGeneratedKeys);
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }

        return false;
    }

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

        try {
            return _statement.execute(sql, columnIndexes);
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }

        return false;
    }

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

        try {
            return _statement.execute(sql, columnNames);
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }

        return false;
    }

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

        try {
            return _statement.getResultSetHoldability();
        } catch (SQLException sqlException) {
            processSQLException(sqlException);
        }

        return Integer.MIN_VALUE;
    }

    /**
     * Validates the connection state.
     */
    protected void validateConnection() throws SQLException {
        if (_connection.isClosed()) {
            throw new SQLException("error.conproxy.noconn");
        }
    }

    /**
     * Processes SQLExceptions.
     */
    protected void processSQLException(SQLException sqlException) throws SQLException {
        _connection.processSQLException(sqlException);

        throw sqlException;
    }
}

⌨️ 快捷键说明

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