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

📄 connectioninpool.java

📁 国外的一套开源CRM
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
            con.commit();
        } catch (SQLException e) {
            setCatastrophicError(e);
            throw e;
        }
    }

    public void rollback() throws SQLException {
        if (con == null) throw new SQLException(CLOSED);
        try {
            con.rollback();
        } catch (SQLException e) {
            setCatastrophicError(e);
            throw e;
        }
    }

    public void close() throws SQLException {
        if (con == null) throw new SQLException(CLOSED);
        firePoolEvent(new PoolEvent(this, PoolEvent.OBJECT_CLOSED));
        shutdown();
    }

    public boolean isClosed() throws SQLException {
        if (con == null) return true;
        try {
            return con.isClosed();
        } catch (SQLException e) {
            setError(e);
            throw e;
        }
    }

    public DatabaseMetaData getMetaData() throws SQLException {
        if (con == null) throw new SQLException(CLOSED);
        try {
            return con.getMetaData();
        } catch (SQLException e) {
            setError(e);
            throw e;
        }
    }

    public void setReadOnly(boolean readOnly) throws SQLException {
        if (con == null) throw new SQLException(CLOSED);
        try {
            con.setReadOnly(readOnly);
        } catch (SQLException e) {
            setError(e);
            throw e;
        }
    }

    public boolean isReadOnly() throws SQLException {
        if (con == null) throw new SQLException(CLOSED);
        try {
            return con.isReadOnly();
        } catch (SQLException e) {
            setError(e);
            throw e;
        }
    }

    public void setCatalog(String catalog) throws SQLException {
        if (con == null) throw new SQLException(CLOSED);
        try {
            con.setCatalog(catalog);
        } catch (SQLException e) {
            setError(e);
            throw e;
        }
    }

    public String getCatalog() throws SQLException {
        if (con == null) throw new SQLException(CLOSED);
        try {
            return con.getCatalog();
        } catch (SQLException e) {
            setError(e);
            throw e;
        }
    }

    public void setTransactionIsolation(int level) throws SQLException {
        if (con == null) throw new SQLException(CLOSED);
        try {
            con.setTransactionIsolation(level);
        } catch (SQLException e) {
            setError(e);
            throw e;
        }
    }

    public int getTransactionIsolation() throws SQLException {
        if (con == null) throw new SQLException(CLOSED);
        try {
            return con.getTransactionIsolation();
        } catch (SQLException e) {
            setError(e);
            throw e;
        }
    }

    public SQLWarning getWarnings() throws SQLException {
        if (con == null) throw new SQLException(CLOSED);
        try {
            return con.getWarnings();
        } catch (SQLException e) {
            setError(e);
            throw e;
        }
    }

    public void clearWarnings() throws SQLException {
        if (con == null) throw new SQLException(CLOSED);
        try {
            con.clearWarnings();
        } catch (SQLException e) {
            setError(e);
            throw e;
        }
    }

    public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
        if (con == null) throw new SQLException(CLOSED);
        try {
            StatementInPool st = new StatementInPool(con.createStatement(resultSetType, resultSetConcurrency), this);
            statements.add(st);
            return st;
        } catch (SQLException e) {
            setError(e);
            throw e;
        }
    }


    public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
        if (con == null) throw new SQLException(CLOSED);
        try {
            PreparedStatementInPool wrapper = null;
            if (preparedStatementCacheSize >= 0) {
                PreparedStatement ps = (PreparedStatement) preparedStatementCache.useObject(sql);
                if (ps == null)
                    throw new SQLException("Unable to create PreparedStatement!");
                wrapper = new PreparedStatementInPool(ps, this, sql);
            } else {
                wrapper = new PreparedStatementInPool(con.prepareStatement(sql, resultSetType, resultSetConcurrency), this, sql);
            }
            statements.add(wrapper);
            return wrapper;
        } catch (SQLException e) {
            setError(e);
            throw e;
        }
    }

    /*
      public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
      return prepareStatement(sql);
      }
    */

    public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
        if (con == null) throw new SQLException(CLOSED);
        try {
            return con.prepareCall(sql, resultSetType, resultSetConcurrency);
        } catch (SQLException e) {
            setError(e);
            throw e;
        }
    }

    public Map getTypeMap() throws SQLException {
        if (con == null) throw new SQLException(CLOSED);
        try {
            return con.getTypeMap();
        } catch (SQLException e) {
            setError(e);
            throw e;
        }
    }

    public void setTypeMap(Map map) throws SQLException {
        if (con == null) throw new SQLException(CLOSED);
        try {
            con.setTypeMap(map);
        } catch (SQLException e) {
            setError(e);
            throw e;
        }
    }


    // ------- J2SE 1.4 methods comment; needed to compile -------

    /* (non-Javadoc)
     * @see java.sql.Connection#setHoldability(int)
     */
    public void setHoldability(int arg0) throws SQLException {
        // TODO Auto-generated method stub

    }

    /* (non-Javadoc)
     * @see java.sql.Connection#getHoldability()
     */
    public int getHoldability() throws SQLException {
        // TODO Auto-generated method stub
        return 0;
    }

    /* (non-Javadoc)
     * @see java.sql.Connection#setSavepoint()
     */
    public Savepoint setSavepoint() throws SQLException {
        // TODO Auto-generated method stub
        return null;
    }

    /* (non-Javadoc)
     * @see java.sql.Connection#setSavepoint(java.lang.String)
     */
    public Savepoint setSavepoint(String arg0) throws SQLException {
        // TODO Auto-generated method stub
        return null;
    }

    /* (non-Javadoc)
     * @see java.sql.Connection#rollback(java.sql.Savepoint)
     */
    public void rollback(Savepoint arg0) throws SQLException {
        // TODO Auto-generated method stub

    }

    /* (non-Javadoc)
     * @see java.sql.Connection#releaseSavepoint(java.sql.Savepoint)
     */
    public void releaseSavepoint(Savepoint arg0) throws SQLException {
        // TODO Auto-generated method stub

    }

    /* (non-Javadoc)
     * @see java.sql.Connection#createStatement(int, int, int)
     */
    public Statement createStatement(int arg0, int arg1, int arg2) throws SQLException {
        // TODO Auto-generated method stub
        return null;
    }

    /* (non-Javadoc)
     * @see java.sql.Connection#prepareStatement(java.lang.String, int, int, int)
     */
    public PreparedStatement prepareStatement(String arg0, int arg1, int arg2, int arg3) throws SQLException {
        // TODO Auto-generated method stub
        return null;
    }

    /* (non-Javadoc)
     * @see java.sql.Connection#prepareCall(java.lang.String, int, int, int)
     */
    public CallableStatement prepareCall(String arg0, int arg1, int arg2, int arg3) throws SQLException {
        // TODO Auto-generated method stub
        return null;
    }

    /* (non-Javadoc)
     * @see java.sql.Connection#prepareStatement(java.lang.String, int)
     */
    public PreparedStatement prepareStatement(String arg0, int arg1) throws SQLException {
        // TODO Auto-generated method stub
        return null;
    }

    /* (non-Javadoc)
     * @see java.sql.Connection#prepareStatement(java.lang.String, int[])
     */
    public PreparedStatement prepareStatement(String arg0, int[] arg1) throws SQLException {
        // TODO Auto-generated method stub
        return null;
    }

    /* (non-Javadoc)
     * @see java.sql.Connection#prepareStatement(java.lang.String, java.lang.String[])
     */
    public PreparedStatement prepareStatement(String arg0, String[] arg1) throws SQLException {
        // TODO Auto-generated method stub
        return null;
    }
}

⌨️ 快捷键说明

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