添加执行次数监控

This commit is contained in:
wenshao
2011-12-27 15:52:26 +08:00
parent 11d3b2c4a1
commit e51fd89ccb
7 changed files with 151 additions and 151 deletions
@@ -166,6 +166,7 @@ public class PoolablePreparedStatement extends PoolableStatement implements Prep
public ResultSet executeQuery() throws SQLException {
checkOpen();
incrementExecuteCount();
transactionRecord(sql);
try {
@@ -184,6 +185,7 @@ public class PoolablePreparedStatement extends PoolableStatement implements Prep
public int executeUpdate() throws SQLException {
checkOpen();
incrementExecuteCount();
transactionRecord(sql);
try {
@@ -418,6 +420,7 @@ public class PoolablePreparedStatement extends PoolableStatement implements Prep
public boolean execute() throws SQLException {
checkOpen();
incrementExecuteCount();
transactionRecord(sql);
try {
@@ -439,9 +442,16 @@ public class PoolablePreparedStatement extends PoolableStatement implements Prep
}
public int[] executeBatch() throws SQLException {
checkOpen();
incrementExecuteCount();
transactionRecord(sql);
return super.executeBatch();
try {
return super.executeBatch();
} catch (Throwable t) {
throw checkException(t);
}
}
@Override
@@ -802,26 +812,29 @@ public class PoolablePreparedStatement extends PoolableStatement implements Prep
public PreparedStatementKey(String sql, String catalog, MethodType methodType) throws SQLException{
this(sql, catalog, methodType, 0, 0, 0, 0, null, null);
}
public PreparedStatementKey(String sql, String catalog, MethodType methodType, int resultSetType,
int resultSetConcurrency) throws SQLException{
this(sql, catalog, methodType, resultSetType, resultSetConcurrency, 0, 0, null, null);
}
public PreparedStatementKey(String sql, String catalog, MethodType methodType, int resultSetType,
int resultSetConcurrency, int resultSetHoldability) throws SQLException{
this(sql, catalog, methodType, resultSetType, resultSetConcurrency, resultSetHoldability, 0, null, null);
}
public PreparedStatementKey(String sql, String catalog, MethodType methodType, int autoGeneratedKeys) throws SQLException{
public PreparedStatementKey(String sql, String catalog, MethodType methodType, int autoGeneratedKeys)
throws SQLException{
this(sql, catalog, methodType, 0, 0, 0, autoGeneratedKeys, null, null);
}
public PreparedStatementKey(String sql, String catalog, MethodType methodType, int[] columnIndexes) throws SQLException{
public PreparedStatementKey(String sql, String catalog, MethodType methodType, int[] columnIndexes)
throws SQLException{
this(sql, catalog, methodType, 0, 0, 0, 0, columnIndexes, null);
}
public PreparedStatementKey(String sql, String catalog, MethodType methodType, String[] columnNames) throws SQLException{
public PreparedStatementKey(String sql, String catalog, MethodType methodType, String[] columnNames)
throws SQLException{
this(sql, catalog, methodType, 0, 0, 0, 0, null, columnNames);
}
@@ -875,51 +888,51 @@ public class PoolablePreparedStatement extends PoolableStatement implements Prep
if (this.methodType != that.methodType) {
return false;
}
if (this.resultSetType != that.resultSetType) {
return false;
}
if (this.resultSetConcurrency != that.resultSetConcurrency) {
return false;
}
if (this.resultSetHoldability != that.resultSetHoldability) {
return false;
}
if (this.autoGeneratedKeys != that.autoGeneratedKeys) {
return false;
}
if (!Arrays.equals(columnIndexes, that.columnIndexes)) {
return false;
}
if (!Arrays.equals(columnNames, that.columnNames)) {
return false;
}
return true;
}
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((sql == null) ? 0 : sql.hashCode());
result = prime * result + ((catalog == null) ? 0 : catalog.hashCode());
result = prime * result + ((methodType == null) ? 0 : methodType.hashCode());
result = prime * result + resultSetConcurrency;
result = prime * result + resultSetHoldability;
result = prime * result + resultSetType;
result = prime * result + autoGeneratedKeys;
result = prime * result + Arrays.hashCode(columnIndexes);
result = prime * result + Arrays.hashCode(columnNames);
return result;
}
@@ -927,6 +940,5 @@ public class PoolablePreparedStatement extends PoolableStatement implements Prep
return sql;
}
}
}