change version & dbType

This commit is contained in:
wenshao
2012-07-22 10:38:57 +08:00
parent d8b2798b82
commit 9679dd624f
6 changed files with 19 additions and 3 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ public final class VERSION {
public final static int MajorVersion = 0;
public final static int MinorVersion = 2;
public final static int RevisionVersion = 4;
public final static int RevisionVersion = 5;
public static String getVersionNumber() {
return VERSION.MajorVersion + "." + VERSION.MinorVersion + "." + VERSION.RevisionVersion;
@@ -336,7 +336,7 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
this.exceptionSorter = new MockExceptionSorter();
}
dataSourceStat = new JdbcDataSourceStat(this.name, this.jdbcUrl);
dataSourceStat = new JdbcDataSourceStat(this.name, this.jdbcUrl, this.dbType);
{
String property = System.getProperty("druid.filters");
@@ -68,7 +68,7 @@ public class DataSourceProxyImpl implements DataSourceProxy, DataSourceProxyImpl
this.rawDriver = rawDriver;
this.config = config;
this.dbType = JdbcUtils.getDbType(config.getRawUrl(), config.getRawDriverClassName());
this.dataSourceStat = new JdbcDataSourceStat(config.getName(), config.getUrl());
this.dataSourceStat = new JdbcDataSourceStat(config.getName(), config.getUrl(), dbType);
}
public String getDbType() {
@@ -150,6 +150,11 @@ public class SQLUtils {
if (JdbcUtils.SQL_SERVER.equals(dbType)) {
return new SQLServerOutputVisitor(out);
}
if (JdbcUtils.H2.equals(dbType)) {
return new MySqlOutputVisitor(out);
}
return new SQLASTOutputVisitor(out);
}
@@ -28,6 +28,10 @@ public class SQLParserUtils {
if (JdbcUtils.SQL_SERVER.equals(dbType)) {
return new SQLServerStatementParser(sql);
}
if (JdbcUtils.H2.equals(dbType)) {
return new MySqlStatementParser(sql);
}
return new SQLStatementParser(sql);
}
@@ -38,6 +38,7 @@ public class JdbcDataSourceStat implements JdbcDataSourceStatMBean {
private final String name;
private final String url;
private String dbType;
private final JdbcConnectionStat connectionStat = new JdbcConnectionStat();
private final JdbcResultSetStat resultSetStat = new JdbcResultSetStat();
@@ -63,8 +64,13 @@ public class JdbcDataSourceStat implements JdbcDataSourceStatMBean {
private final ConcurrentMap<Long, JdbcConnectionStat.Entry> connections = new ConcurrentHashMap<Long, JdbcConnectionStat.Entry>();
public JdbcDataSourceStat(String name, String url){
this(name, url, null);
}
public JdbcDataSourceStat(String name, String url, String dbType){
this.name = name;
this.url = url;
this.dbType = dbType;
}
public void reset() {
@@ -211,6 +217,7 @@ public class JdbcDataSourceStat implements JdbcDataSourceStatMBean {
JdbcSqlStat sqlStat = sqlStatMap.get(sql);
if (sqlStat == null) {
sqlStat = new JdbcSqlStat(sql);
sqlStat.setDbType(this.dbType);
sqlStatMap.put(sql, sqlStat);
}