📄 connectionwrapper.java
字号:
return StatementWrapper.getInstance(this, 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 { checkClosed(); try { return StatementWrapper.getInstance(this, 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 { checkClosed(); try { return StatementWrapper.getInstance(this, 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 { checkClosed(); 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 { checkClosed(); try { return CallableStatementWrapper.getInstance(this, this.mpc, 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 { checkClosed(); try { return CallableStatementWrapper.getInstance(this, this.mpc, 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 { checkClosed(); try { return CallableStatementWrapper.getInstance(this, this.mpc, this.mc .prepareCall(arg0, arg1, arg2, arg3)); } catch (SQLException sqlException) { checkAndFireConnectionError(sqlException); } return null; // we don't reach this code, compiler can't tell } public java.sql.PreparedStatement clientPrepare(String sql) throws SQLException { checkClosed(); try { return new PreparedStatementWrapper(this, this.mpc, this.mc .clientPrepareStatement(sql)); } catch (SQLException sqlException) { checkAndFireConnectionError(sqlException); } return null; } public java.sql.PreparedStatement clientPrepare(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { checkClosed(); try { return new PreparedStatementWrapper(this, this.mpc, this.mc .clientPrepareStatement(sql, resultSetType, resultSetConcurrency)); } catch (SQLException sqlException) { checkAndFireConnectionError(sqlException); } return null; } /** * 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 { checkClosed(); try { return PreparedStatementWrapper.getInstance(this, 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 { checkClosed(); try { return PreparedStatementWrapper .getInstance(this, 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 { checkClosed(); try { return PreparedStatementWrapper.getInstance(this, 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 { checkClosed(); try { return PreparedStatementWrapper.getInstance(this, 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 { checkClosed(); try { return PreparedStatementWrapper.getInstance(this, 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 { checkClosed(); try { return PreparedStatementWrapper.getInstance(this, 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 { checkClosed(); 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 { checkClosed(); if (isInGlobalTx()) { throw SQLError .createSQLException( "Can't call rollback() on an XAConnection associated with a global transaction", SQLError.SQL_STATE_INVALID_TRANSACTION_TERMINATION, MysqlErrorNumbers.ER_XA_RMERR); } try { this.mc.rollback(); } catch (SQLException sqlException) { checkAndFireConnectionError(sqlException); } } /** * @see Connection#rollback(Savepoint) */ public void rollback(Savepoint arg0) throws SQLException { checkClosed(); if (isInGlobalTx()) { throw SQLError .createSQLException( "Can't call rollback() on an XAConnection associated with a global transaction", SQLError.SQL_STATE_INVALID_TRANSACTION_TERMINATION, MysqlErrorNumbers.ER_XA_RMERR); } try { this.mc.rollback(arg0); } catch (SQLException sqlException) { checkAndFireConnectionError(sqlException); } } public boolean isSameResource(Connection c) { if (c instanceof ConnectionWrapper) { return this.mc.isSameResource(((ConnectionWrapper) c).mc); } else if (c instanceof com.mysql.jdbc.Connection) { return this.mc.isSameResource((com.mysql.jdbc.Connection) c); } return false; } protected void close(boolean fireClosedEvent) throws SQLException { synchronized (this.mpc) { if (this.closed) { return; } if (!isInGlobalTx() && this.mc.getRollbackOnPooledClose() && !this.getAutoCommit()) { rollback(); } if (fireClosedEvent) { this.mpc.callConnectionEventListeners( 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; } } protected void checkClosed() throws SQLException { if (this.closed) { throw SQLError.createSQLException(this.invalidHandleStr); } } public boolean isInGlobalTx() { return this.mc.isInGlobalTx(); } public void setInGlobalTx(boolean flag) { this.mc.setInGlobalTx(flag); } public void ping() throws SQLException { if (this.mc != null) { this.mc.ping(); } } public void changeUser(String userName, String newPassword) throws SQLException { checkClosed(); try { this.mc.changeUser(userName, newPassword); } catch (SQLException sqlException) { checkAndFireConnectionError(sqlException); } } public void clearHasTriedMaster() { this.mc.clearHasTriedMaster(); } public java.sql.PreparedStatement clientPrepareStatement(String sql) throws SQLException { checkClosed(); try { return PreparedStatementWrapper.getInstance(this, this.mpc, this.mc .clientPrepareStatement(sql)); } catch (SQLException sqlException) { checkAndFireConnectionError(sqlException); } return null; } public java.sql.PreparedStatement clientPrepareStatement(String sql, int autoGenKeyIndex) throws SQLException { try { return PreparedStatementWrapper.getInstance(this, this.mpc, this.mc .clientPrepareStatement(sql, autoGenKeyIndex)); } catch (SQLException sqlException) { checkAndFireConnectionError(sqlException); } return null; } public java.sql.PreparedStatement clientPrepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { try { return PreparedStatementWrapper.getInstance(this, this.mpc, this.mc .clientPrepareStatement(sql, resultSetType, resultSetConcurrency)); } catch (SQLException sqlException) { checkAndFireConnectionError(sqlException); } return null; } public java.sql.PreparedStatement clientPrepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { try { return PreparedStatementWrapper.getInstance(this, this.mpc, this.mc .clientPrepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability)); } catch (SQLException sqlException) { checkAndFireConnectionError(sqlException); } return null; } public java.sql.PreparedStatement clientPrepareStatement(String sql, int[] autoGenKeyIndexes) throws SQLException { try { return PreparedStatementWrapper.getInstance(this, this.mpc, this.mc .clientPrepareStatement(sql, autoGenKeyIndexes)); } catch (SQLException sqlException) { checkAndFireConnectionError(sqlException); } return null; } public java.sql.PreparedStatement clientPrepareStatement(String sql, String[] autoGenKeyColNames) throws SQLException { try { return PreparedStatementWrapper.getInstance(this, this.mpc, this.mc .clientPrepareStatement(sql, autoGenKeyColNames)); } catch (SQLException sqlException) { checkAndFireConnectionError(sqlException); } return null; } public int getActiveStatementCount() { return this.mc.getActiveStatementCount(); } public Log getLog() throws SQLException { return this.mc.getLog(); } public String getServerCharacterEncoding() { return this.mc.getServerCharacterEncoding(); } public TimeZone getServerTimezoneTZ() { return this.mc.getServerTimezoneTZ(); } public String getStatementComment() { return this.mc.getStatementComment(); } public boolean hasTriedMaster() { return this.mc.hasTriedMaster(); } public boolean isAbonormallyLongQuery(long millisOrNanos) { return this.mc.isAbonormallyLongQuery(millisOrNanos); } public boolean isNoBackslashEscapesSet() { return this.mc.isNoBackslashEscapesSet(); } public boolean lowerCaseTableNames() { return this.mc.lowerCaseTableNames(); } public boolean parserKnowsUnicode() { return this.mc.parserKnowsUnicode(); } public void reportQueryTime(long millisOrNanos) { this.mc.reportQueryTime(millisOrNanos); } public void resetServerState() throws SQLException { checkClosed(); try { this.mc.resetServerState(); } catch (SQLException sqlException) { checkAndFireConnectionError(sqlException);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -