mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
Merge branch 'master' of https://wenshao@github.com/AlibabaTech/druid.git
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
package com.alibaba.druid.filter.stat;
|
||||
|
||||
import com.alibaba.druid.logging.Log;
|
||||
import com.alibaba.druid.logging.LogFactory;
|
||||
import com.alibaba.druid.proxy.jdbc.DataSourceProxy;
|
||||
import com.alibaba.druid.sql.visitor.ParameterizedOutputVisitorUtils;
|
||||
import com.alibaba.druid.stat.JdbcSqlStat;
|
||||
|
||||
public class MergeSqlStatFilter extends StatFilter {
|
||||
|
||||
private final static Log LOG = LogFactory.getLog(MergeSqlStatFilter.class);
|
||||
|
||||
private String dbType;
|
||||
|
||||
public String getDbType() {
|
||||
return dbType;
|
||||
}
|
||||
|
||||
public void setDbType(String dbType) {
|
||||
this.dbType = dbType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(DataSourceProxy dataSource) {
|
||||
super.init(dataSource);
|
||||
|
||||
if (this.dbType == null || this.dbType.trim().length() == 0) {
|
||||
this.dbType = dataSource.getDbType();
|
||||
}
|
||||
}
|
||||
|
||||
public JdbcSqlStat getSqlStat(String sql) {
|
||||
try {
|
||||
sql = ParameterizedOutputVisitorUtils.parameterize(sql, sql);
|
||||
} catch (Exception e) {
|
||||
LOG.error("merge sql error", e);
|
||||
}
|
||||
return dataSourceStat.getSqlStat(sql);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user