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

📄 connectionwrapper.java

📁 基于java的oa系统
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
            }        }        return null; // we don't reach this code, compiler can't tell    }    /**     * Passes call to method on physical connection instance.   Notifies     * listeners of any caught exceptions before  re-throwing to client.     *     * @throws SQLException if an error occurs     */    public void clearWarnings() throws SQLException {        if (closed) {            throw new SQLException(invalidHandleStr);        } else {            try {                this.mc.clearWarnings();            } catch (SQLException sqlException) {                checkAndFireConnectionError(sqlException);            }        }    }    /**     * The physical connection is not actually closed.  the physical connection     * is closed when the application server calls     * mysqlPooledConnection.close().  this object is  de-referenced by the     * pooled connection each time mysqlPooledConnection.getConnection()  is     * called by app server.     *     * @throws SQLException if an error occurs     */    public void close() throws SQLException {        close(true);    }    /**     * Passes call to method on physical connection instance.  Notifies     * listeners of any caught exceptions before re-throwing to client.     *     * @throws SQLException if an error occurs     */    public void commit() throws SQLException {        if (closed) {            throw new SQLException(invalidHandleStr);        } else {            try {                this.mc.commit();            } catch (SQLException sqlException) {                checkAndFireConnectionError(sqlException);            }        }    }    /**     * Passes call to method on physical connection instance.  Notifies     * listeners of any caught exceptions before re-throwing to client.     *     * @see java.sql.Connection#createStatement()     */    public java.sql.Statement createStatement() throws SQLException {        if (this.closed) {            throw new SQLException(invalidHandleStr);        } else {            try {                return new StatementWrapper(this.mpc, this.mc.createStatement());            } catch (SQLException sqlException) {                checkAndFireConnectionError(sqlException);            }        }        return null; // we don't reach this code, compiler can't tell    }    /**     * Passes call to method on physical connection instance.  Notifies     * listeners of any caught exceptions before re-throwing to client.     *     * @see java.sql.Connection#createStatement()     */    public java.sql.Statement createStatement(int resultSetType,        int resultSetConcurrency) throws SQLException {        if (this.closed) {            throw new SQLException(invalidHandleStr);        } else {            try {                return new StatementWrapper(this.mpc,                    this.mc.createStatement(resultSetType, resultSetConcurrency));            } catch (SQLException sqlException) {                checkAndFireConnectionError(sqlException);            }        }        return null; // we don't reach this code, compiler can't tell    }    /**     * @see Connection#createStatement(int, int, int)     */    public java.sql.Statement createStatement(int arg0, int arg1, int arg2)        throws SQLException {        if (this.closed) {            throw new SQLException(invalidHandleStr);        } else {            try {                return new StatementWrapper(this.mpc,                    this.mc.createStatement(arg0, arg1, arg2));            } catch (SQLException sqlException) {                checkAndFireConnectionError(sqlException);            }        }        return null; // we don't reach this code, compiler can't tell    }    /**     * Passes call to method on physical connection instance.  Notifies     * listeners of any caught exceptions before re-throwing to client.     *     * @see java.sql.Connection#nativeSQL()     */    public String nativeSQL(String sql) throws SQLException {        if (closed) {            throw new SQLException(invalidHandleStr);        } else {            try {                return this.mc.nativeSQL(sql);            } catch (SQLException sqlException) {                checkAndFireConnectionError(sqlException);            }        }        return null; // we don't reach this code, compiler can't tell    }    /**     * Passes call to method on physical connection instance.  Notifies     * listeners of any caught exceptions before re-throwing to client.     *     * @see java.sql.Connection#prepareCall()     */    public java.sql.CallableStatement prepareCall(String sql)        throws SQLException {        if (closed) {            throw new SQLException(invalidHandleStr);        } else {            try {                return this.mc.prepareCall(sql);            } catch (SQLException sqlException) {                checkAndFireConnectionError(sqlException);            }        }        return null; // we don't reach this code, compiler can't tell    }    /**     * Passes call to method on physical connection instance.  Notifies     * listeners of any caught exceptions before re-throwing to client.     *     * @see java.sql.Connection#prepareCall()     */    public java.sql.CallableStatement prepareCall(String sql,        int resultSetType, int resultSetConcurrency) throws SQLException {        if (closed) {            throw new SQLException(invalidHandleStr);        } else {            try {                return this.mc.prepareCall(sql, resultSetType,                    resultSetConcurrency);            } catch (SQLException sqlException) {                checkAndFireConnectionError(sqlException);            }        }        return null; // we don't reach this code, compiler can't tell    }    /**     * @see Connection#prepareCall(String, int, int, int)     */    public java.sql.CallableStatement prepareCall(String arg0, int arg1,        int arg2, int arg3) throws SQLException {        if (closed) {            throw new SQLException(invalidHandleStr);        } else {            try {                return this.mc.prepareCall(arg0, arg1, arg2, arg3);            } catch (SQLException sqlException) {                checkAndFireConnectionError(sqlException);            }        }        return null; // we don't reach this code, compiler can't tell    }    /**     * Passes call to method on physical connection instance.  Notifies     * listeners of any caught exceptions before re-throwing to client.     *     * @see java.sql.Connection#prepareStatement()     */    public java.sql.PreparedStatement prepareStatement(String sql)        throws SQLException {        if (this.closed) {            throw new SQLException(invalidHandleStr);        } else {            try {                return new PreparedStatementWrapper(this.mpc,                    this.mc.prepareStatement(sql));            } catch (SQLException sqlException) {                checkAndFireConnectionError(sqlException);            }        }        return null; // we don't reach this code, compiler can't tell    }    /**     * Passes call to method on physical connection instance.  Notifies     * listeners of any caught exceptions before re-throwing to client.     *     * @see java.sql.Connection#prepareStatement()     */    public java.sql.PreparedStatement prepareStatement(String sql,        int resultSetType, int resultSetConcurrency) throws SQLException {        if (this.closed) {            throw new SQLException(invalidHandleStr);        } else {            try {                return new PreparedStatementWrapper(this.mpc,                    this.mc.prepareStatement(sql, resultSetType,                        resultSetConcurrency));            } catch (SQLException sqlException) {                checkAndFireConnectionError(sqlException);            }        }        return null; // we don't reach this code, compiler can't tell    }    /**     * @see Connection#prepareStatement(String, int, int, int)     */    public java.sql.PreparedStatement prepareStatement(String arg0, int arg1,        int arg2, int arg3) throws SQLException {        if (this.closed) {            throw new SQLException(invalidHandleStr);        } else {            try {                return new PreparedStatementWrapper(this.mpc,                    this.mc.prepareStatement(arg0, arg1, arg2, arg3));            } catch (SQLException sqlException) {                checkAndFireConnectionError(sqlException);            }        }        return null; // we don't reach this code, compiler can't tell    }    /**     * @see Connection#prepareStatement(String, int)     */    public java.sql.PreparedStatement prepareStatement(String arg0, int arg1)        throws SQLException {        if (this.closed) {            throw new SQLException(invalidHandleStr);        } else {            try {                return new PreparedStatementWrapper(this.mpc,                    this.mc.prepareStatement(arg0, arg1));            } catch (SQLException sqlException) {                checkAndFireConnectionError(sqlException);            }        }        return null; // we don't reach this code, compiler can't tell    }    /**     * @see Connection#prepareStatement(String, int[])     */    public java.sql.PreparedStatement prepareStatement(String arg0, int[] arg1)        throws SQLException {        if (this.closed) {            throw new SQLException(invalidHandleStr);        } else {            try {                return new PreparedStatementWrapper(this.mpc,                    this.mc.prepareStatement(arg0, arg1));            } catch (SQLException sqlException) {                checkAndFireConnectionError(sqlException);            }        }        return null; // we don't reach this code, compiler can't tell    }    /**     * @see Connection#prepareStatement(String, String[])     */    public java.sql.PreparedStatement prepareStatement(String arg0,        String[] arg1) throws SQLException {        if (this.closed) {            throw new SQLException(invalidHandleStr);        } else {            try {                return new PreparedStatementWrapper(this.mpc,                    this.mc.prepareStatement(arg0, arg1));            } catch (SQLException sqlException) {                checkAndFireConnectionError(sqlException);            }        }        return null; // we don't reach this code, compiler can't tell    }    /**     * @see Connection#releaseSavepoint(Savepoint)     */    public void releaseSavepoint(Savepoint arg0) throws SQLException {        if (closed) {            throw new SQLException(invalidHandleStr);        } else {            try {                this.mc.releaseSavepoint(arg0);            } catch (SQLException sqlException) {                checkAndFireConnectionError(sqlException);            }        }    }    /**     * Passes call to method on physical connection instance.  Notifies     * listeners of any caught exceptions before re-throwing to client.     *     * @see java.sql.Connection#rollback()     */    public void rollback() throws SQLException {        if (closed) {            throw new SQLException(invalidHandleStr);        } else {            try {                this.mc.rollback();            } catch (SQLException sqlException) {                checkAndFireConnectionError(sqlException);            }        }    }    /**     * @see Connection#rollback(Savepoint)     */    public void rollback(Savepoint arg0) throws SQLException {        if (closed) {            throw new SQLException(invalidHandleStr);        } else {            try {                this.mc.rollback(arg0);            } catch (SQLException sqlException) {                checkAndFireConnectionError(sqlException);            }        }    }    protected void close(boolean fireClosedEvent) throws SQLException {        synchronized (this.mpc) {            if (this.closed) {                return;            }            if (((com.mysql.jdbc.Connection) this.mc).getRollbackOnPooledClose() &&                    !this.getAutoCommit()) {                rollback();            }            if (fireClosedEvent) {                this.mpc.callListener(MysqlPooledConnection.CONNECTION_CLOSED_EVENT,                    null);            }            // set closed status to true so that if application client tries to make additional            // calls a sqlException will be thrown.  The physical connection is            // re-used by the pooled connection each time getConnection is called.            this.closed = true;        }    }}

⌨️ 快捷键说明

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