mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improve LogFilter
This commit is contained in:
@@ -39,7 +39,9 @@ public class StatementProxyImpl extends WrapperProxyImpl implements StatementPro
|
||||
private final Statement statement;
|
||||
|
||||
protected String lastExecuteSql;
|
||||
private long lastExecuteStartNano;
|
||||
private long lastExecuteTimeNano;
|
||||
|
||||
protected JdbcSqlStat sqlStat;
|
||||
protected boolean firstResultSet;
|
||||
|
||||
@@ -144,11 +146,11 @@ public class StatementProxyImpl extends WrapperProxyImpl implements StatementPro
|
||||
firstResultSet = false;
|
||||
lastExecuteType = StatementExecuteType.ExecuteBatch;
|
||||
int[] updateCounts = createChain().statement_executeBatch(this);
|
||||
|
||||
|
||||
if (updateCounts != null && updateCounts.length == 1) {
|
||||
updateCount = updateCounts[0];
|
||||
}
|
||||
|
||||
|
||||
return updateCounts;
|
||||
}
|
||||
|
||||
@@ -264,13 +266,13 @@ public class StatementProxyImpl extends WrapperProxyImpl implements StatementPro
|
||||
return createChain().statement_getResultSetType(this);
|
||||
}
|
||||
|
||||
//bug fixed for oracle
|
||||
// bug fixed for oracle
|
||||
@Override
|
||||
public int getUpdateCount() throws SQLException {
|
||||
if (updateCount == null) {
|
||||
updateCount = createChain().statement_getUpdateCount(this);
|
||||
}
|
||||
return updateCount;
|
||||
return updateCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -391,6 +393,27 @@ public class StatementProxyImpl extends WrapperProxyImpl implements StatementPro
|
||||
public void setLastExecuteTimeNano(long lastExecuteTimeNano) {
|
||||
this.lastExecuteTimeNano = lastExecuteTimeNano;
|
||||
}
|
||||
|
||||
public void setLastExecuteTimeNano() {
|
||||
if (this.lastExecuteTimeNano <= 0 && this.lastExecuteStartNano > 0) {
|
||||
this.lastExecuteTimeNano = System.nanoTime() - this.lastExecuteStartNano;
|
||||
}
|
||||
}
|
||||
|
||||
public long getLastExecuteStartNano() {
|
||||
return lastExecuteStartNano;
|
||||
}
|
||||
|
||||
public void setLastExecuteStartNano(long lastExecuteStartNano) {
|
||||
this.lastExecuteStartNano = lastExecuteStartNano;
|
||||
this.lastExecuteTimeNano = -1L;
|
||||
}
|
||||
|
||||
public void setLastExecuteStartNano() {
|
||||
if (lastExecuteStartNano <= 0) {
|
||||
setLastExecuteStartNano(System.nanoTime());
|
||||
}
|
||||
}
|
||||
|
||||
public StatementExecuteType getLastExecuteType() {
|
||||
return lastExecuteType;
|
||||
|
||||
Reference in New Issue
Block a user