mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
code format
This commit is contained in:
@@ -17,7 +17,6 @@ package com.alibaba.druid;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
|
||||
public class TransactionTimeoutException extends SQLException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -79,7 +79,8 @@ public abstract class FilterEventAdapter extends FilterAdapter {
|
||||
@Override
|
||||
public StatementProxy connection_createStatement(FilterChain chain, ConnectionProxy connection, int resultSetType,
|
||||
int resultSetConcurrency) throws SQLException {
|
||||
StatementProxy statement = super.connection_createStatement(chain, connection, resultSetType, resultSetConcurrency);
|
||||
StatementProxy statement = super.connection_createStatement(chain, connection, resultSetType,
|
||||
resultSetConcurrency);
|
||||
|
||||
statementCreateAfter(statement);
|
||||
|
||||
@@ -90,8 +91,8 @@ public abstract class FilterEventAdapter extends FilterAdapter {
|
||||
public StatementProxy connection_createStatement(FilterChain chain, ConnectionProxy connection, int resultSetType,
|
||||
int resultSetConcurrency, int resultSetHoldability)
|
||||
throws SQLException {
|
||||
StatementProxy statement = super.connection_createStatement(chain, connection, resultSetType, resultSetConcurrency,
|
||||
resultSetHoldability);
|
||||
StatementProxy statement = super.connection_createStatement(chain, connection, resultSetType,
|
||||
resultSetConcurrency, resultSetHoldability);
|
||||
|
||||
statementCreateAfter(statement);
|
||||
|
||||
|
||||
@@ -325,7 +325,7 @@ public class StatFilter extends FilterEventAdapter implements StatFilterMBean {
|
||||
if (sqlStat != null) {
|
||||
sqlStat.addExecuteBatchCount(batchSize);
|
||||
}
|
||||
|
||||
|
||||
internalBeforeStatementExecute(statement, sql);
|
||||
|
||||
// super.statementExecuteBatchBefore(statement);
|
||||
|
||||
@@ -85,6 +85,6 @@ public interface StatFilterMBean {
|
||||
TabularData getSqlList() throws JMException;
|
||||
|
||||
TabularData getConnectionList() throws JMException;
|
||||
|
||||
|
||||
long getResetCount();
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class MockCallableStatement extends MockPreparedStatement implements Call
|
||||
if (parameterIndex < 1) {
|
||||
throw new SQLException();
|
||||
}
|
||||
|
||||
|
||||
if (parameters.size() >= parameterIndex - 1) {
|
||||
parameters.add(null);
|
||||
} else {
|
||||
@@ -74,7 +74,7 @@ public class MockCallableStatement extends MockPreparedStatement implements Call
|
||||
if (closed) {
|
||||
throw new SQLException();
|
||||
}
|
||||
|
||||
|
||||
return wasNull;
|
||||
}
|
||||
|
||||
|
||||
@@ -281,7 +281,7 @@ public class MockConnection implements Connection {
|
||||
|
||||
stmt.setResultSetType(resultSetType);
|
||||
stmt.setResultSetConcurrency(resultSetConcurrency);
|
||||
|
||||
|
||||
return stmt;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ public class MockConnectionClosedException extends SQLException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public MockConnectionClosedException() {
|
||||
public MockConnectionClosedException(){
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class MockPreparedStatement extends MockStatement implements PreparedStat
|
||||
if (closed) {
|
||||
throw new SQLException();
|
||||
}
|
||||
|
||||
|
||||
if (mockConnection != null && mockConnection.getDriver() != null) {
|
||||
return mockConnection.getDriver().createResultSet(this);
|
||||
}
|
||||
@@ -80,7 +80,7 @@ public class MockPreparedStatement extends MockStatement implements PreparedStat
|
||||
if (closed) {
|
||||
throw new SQLException();
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ public class MockPreparedStatement extends MockStatement implements PreparedStat
|
||||
if (closed) {
|
||||
throw new SQLException();
|
||||
}
|
||||
|
||||
|
||||
parameters.clear();
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ public class MockPreparedStatement extends MockStatement implements PreparedStat
|
||||
if (closed) {
|
||||
throw new SQLException();
|
||||
}
|
||||
|
||||
|
||||
return resultSetMetaData;
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ public class MockPreparedStatement extends MockStatement implements PreparedStat
|
||||
if (closed) {
|
||||
throw new SQLException();
|
||||
}
|
||||
|
||||
|
||||
return metadata;
|
||||
}
|
||||
|
||||
|
||||
@@ -315,7 +315,7 @@ public class MockResultSet implements ResultSet {
|
||||
if (closed) {
|
||||
throw new SQLException();
|
||||
}
|
||||
|
||||
|
||||
return warning;
|
||||
}
|
||||
|
||||
@@ -324,7 +324,7 @@ public class MockResultSet implements ResultSet {
|
||||
if (closed) {
|
||||
throw new SQLException();
|
||||
}
|
||||
|
||||
|
||||
warning = null;
|
||||
}
|
||||
|
||||
@@ -337,7 +337,7 @@ public class MockResultSet implements ResultSet {
|
||||
if (closed) {
|
||||
throw new SQLException();
|
||||
}
|
||||
|
||||
|
||||
return cursorName;
|
||||
}
|
||||
|
||||
@@ -350,7 +350,7 @@ public class MockResultSet implements ResultSet {
|
||||
if (closed) {
|
||||
throw new SQLException("resultSet closed");
|
||||
}
|
||||
|
||||
|
||||
return metaData;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ public class MockResultSetMetaData implements ResultSetMetaData {
|
||||
if (iface == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
if (iface.isAssignableFrom(MockResultSetMetaData.class)) {
|
||||
return (T) this;
|
||||
}
|
||||
@@ -50,7 +50,7 @@ public class MockResultSetMetaData implements ResultSetMetaData {
|
||||
if (iface == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return MockResultSetMetaData.class.isAssignableFrom(iface);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,9 +45,9 @@ public class DataSourceAdapter extends WrapperAdapter implements DataSource {
|
||||
public Connection getConnection(String username, String password) throws SQLException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
public Logger getParentLogger() throws SQLFeatureNotSupportedException {
|
||||
throw new SQLFeatureNotSupportedException();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -195,15 +195,15 @@ public abstract class DruidAbstractDataSource extends WrapperAdapter implements
|
||||
public Histogram getTransactionHistogram() {
|
||||
return transactionHistogram;
|
||||
}
|
||||
|
||||
|
||||
public void incrementCachedPreparedStatementCount() {
|
||||
cachedPreparedStatementCount.incrementAndGet();
|
||||
}
|
||||
|
||||
|
||||
public void decrementCachedPreparedStatementCount() {
|
||||
cachedPreparedStatementCount.decrementAndGet();
|
||||
}
|
||||
|
||||
|
||||
public long getCachedPreparedStatementCount() {
|
||||
return cachedPreparedStatementCount.get();
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public interface DruidAbstractDataSourceMBean {
|
||||
|
||||
int getLoginTimeout();
|
||||
|
||||
String getDbType();
|
||||
@@ -35,11 +36,11 @@ public interface DruidAbstractDataSourceMBean {
|
||||
long getDestroyCount();
|
||||
|
||||
long getCreateTimespanMillis();
|
||||
|
||||
|
||||
long getCommitCount();
|
||||
|
||||
|
||||
long getRollbackCount();
|
||||
|
||||
|
||||
long getStartTransactionCount();
|
||||
|
||||
int getQueryTimeout();
|
||||
@@ -55,7 +56,7 @@ public interface DruidAbstractDataSourceMBean {
|
||||
long getMinEvictableIdleTimeMillis();
|
||||
|
||||
boolean isRemoveAbandoned();
|
||||
|
||||
|
||||
long getRemoveAbandonedTimeoutMillis();
|
||||
|
||||
List<String> getActiveConnectionStackTrace();
|
||||
@@ -91,19 +92,19 @@ public interface DruidAbstractDataSourceMBean {
|
||||
int getMaxOpenPreparedStatements();
|
||||
|
||||
long getRemoveAbandonedCount();
|
||||
|
||||
|
||||
boolean isLogAbandoned();
|
||||
|
||||
|
||||
long getDupCloseCount();
|
||||
|
||||
|
||||
boolean isBreakAfterAcquireFailure();
|
||||
|
||||
|
||||
int getConnectionErrorRetryAttempts();
|
||||
|
||||
|
||||
int getMaxPoolPreparedStatementPerConnectionSize();
|
||||
|
||||
|
||||
void setMaxPoolPreparedStatementPerConnectionSize(int maxPoolPreparedStatementPerConnectionSize);
|
||||
|
||||
|
||||
String getProperties();
|
||||
|
||||
int getRawDriverMinorVersion();
|
||||
@@ -111,20 +112,20 @@ public interface DruidAbstractDataSourceMBean {
|
||||
int getRawDriverMajorVersion();
|
||||
|
||||
Date getCreatedTime();
|
||||
|
||||
|
||||
String getValidConnectionCheckerClassName();
|
||||
|
||||
|
||||
long[] getTransactionHistogramValues();
|
||||
|
||||
|
||||
void setTransactionThresholdMillis(long transactionThresholdMillis);
|
||||
|
||||
|
||||
long getTransactionThresholdMillis();
|
||||
|
||||
|
||||
long getReusePreparedStatementCount();
|
||||
|
||||
|
||||
long getPreparedStatementCount();
|
||||
|
||||
|
||||
long getClosedPreparedStatementCount();
|
||||
|
||||
|
||||
long getCachedPreparedStatementCount();
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
closePreapredStatement(holder);
|
||||
decrementCachedPreparedStatementCount();
|
||||
}
|
||||
|
||||
|
||||
connection.getStatementPool().getMap().clear();
|
||||
}
|
||||
}
|
||||
@@ -392,7 +392,7 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
new ActiveConnectionTraceInfo(poolalbeConnection, System.currentTimeMillis(),
|
||||
stackTrace));
|
||||
}
|
||||
|
||||
|
||||
if (!this.isDefaultAutoCommit()) {
|
||||
poolalbeConnection.setAutoCommit(false);
|
||||
}
|
||||
|
||||
@@ -98,11 +98,11 @@ public class DruidDataSourceC3P0Adapter implements DataSource, DruidDataSourceC3
|
||||
public String getJdbcUrl() {
|
||||
return dataSource.getUrl();
|
||||
}
|
||||
|
||||
|
||||
public Driver getDriver() {
|
||||
return dataSource.getDriver();
|
||||
}
|
||||
|
||||
|
||||
public void setDriver(Driver driver) {
|
||||
dataSource.setDriver(driver);
|
||||
}
|
||||
@@ -214,11 +214,11 @@ public class DruidDataSourceC3P0Adapter implements DataSource, DruidDataSourceC3
|
||||
public void setPreferredTestQuery(String preferredTestQuery) {
|
||||
dataSource.setValidationQuery(preferredTestQuery);
|
||||
}
|
||||
|
||||
|
||||
public void setFilters(String filters) throws SQLException {
|
||||
dataSource.setFilters(filters);
|
||||
}
|
||||
|
||||
|
||||
public List<Filter> getProxyFilters() {
|
||||
return dataSource.getProxyFilters();
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ package com.alibaba.druid.pool;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* @author wenshao<szujobs@hotmail.com>
|
||||
*/
|
||||
@@ -36,7 +35,7 @@ public interface DruidDataSourceMBean extends DruidAbstractDataSourceMBean {
|
||||
int getLockQueueLength();
|
||||
|
||||
long getNotEmptyWaitCount();
|
||||
|
||||
|
||||
int getNotEmptyWaitThreadCount();
|
||||
|
||||
long getNotEmptySignalCount();
|
||||
@@ -52,24 +51,26 @@ public interface DruidDataSourceMBean extends DruidAbstractDataSourceMBean {
|
||||
void setResetStatEnable(boolean resetStatEnable);
|
||||
|
||||
String getVersion();
|
||||
|
||||
|
||||
void setPoolPreparedStatements(boolean poolPreparedStatements);
|
||||
|
||||
/**
|
||||
* ActiveCount峰值
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int getActivePeak();
|
||||
|
||||
|
||||
/**
|
||||
* PoolingCount峰值
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int getPoolingPeak();
|
||||
|
||||
|
||||
Date getActivePeakTime();
|
||||
|
||||
|
||||
Date getPoolingPeakTime();
|
||||
|
||||
|
||||
long getErrorCount();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.alibaba.druid.pool;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
|
||||
public class GetConnectionTimeoutException extends SQLException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -19,4 +18,4 @@ public class GetConnectionTimeoutException extends SQLException {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class PoolableConnection implements PooledConnection, Connection {
|
||||
protected ConnectionHolder holder;
|
||||
protected TransactionInfo transactionInfo;
|
||||
|
||||
public PoolableConnection(ConnectionHolder holder) {
|
||||
public PoolableConnection(ConnectionHolder holder){
|
||||
this.conn = holder.getConnection();
|
||||
this.holder = holder;
|
||||
}
|
||||
|
||||
@@ -786,8 +786,8 @@ public class PoolablePreparedStatement extends PoolableStatement implements Prep
|
||||
|
||||
public static class PreparedStatementKey {
|
||||
|
||||
private final String sql;
|
||||
private final String catalog;
|
||||
private final String sql;
|
||||
private final String catalog;
|
||||
|
||||
protected final MethodType methodType;
|
||||
|
||||
|
||||
@@ -1743,7 +1743,7 @@ public final class PoolableResultSet extends PoolableWrapper implements ResultSe
|
||||
public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException();
|
||||
}
|
||||
|
||||
|
||||
public <T> T getObject(String columnLabel, Class<T> type) throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException();
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ public class PoolableStatement extends PoolableWrapper implements Statement {
|
||||
@Override
|
||||
public final ResultSet executeQuery(String sql) throws SQLException {
|
||||
checkOpen();
|
||||
|
||||
|
||||
transactionRecord(sql);
|
||||
|
||||
try {
|
||||
@@ -105,7 +105,7 @@ public class PoolableStatement extends PoolableWrapper implements Statement {
|
||||
@Override
|
||||
public final int executeUpdate(String sql) throws SQLException {
|
||||
checkOpen();
|
||||
|
||||
|
||||
transactionRecord(sql);
|
||||
|
||||
try {
|
||||
@@ -249,7 +249,7 @@ public class PoolableStatement extends PoolableWrapper implements Statement {
|
||||
@Override
|
||||
public final boolean execute(String sql) throws SQLException {
|
||||
checkOpen();
|
||||
|
||||
|
||||
transactionRecord(sql);
|
||||
|
||||
try {
|
||||
@@ -366,7 +366,7 @@ public class PoolableStatement extends PoolableWrapper implements Statement {
|
||||
@Override
|
||||
public final void addBatch(String sql) throws SQLException {
|
||||
checkOpen();
|
||||
|
||||
|
||||
transactionRecord(sql);
|
||||
|
||||
try {
|
||||
@@ -436,7 +436,7 @@ public class PoolableStatement extends PoolableWrapper implements Statement {
|
||||
@Override
|
||||
public final int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
|
||||
checkOpen();
|
||||
|
||||
|
||||
transactionRecord(sql);
|
||||
|
||||
try {
|
||||
@@ -449,7 +449,7 @@ public class PoolableStatement extends PoolableWrapper implements Statement {
|
||||
@Override
|
||||
public final int executeUpdate(String sql, int columnIndexes[]) throws SQLException {
|
||||
checkOpen();
|
||||
|
||||
|
||||
transactionRecord(sql);
|
||||
|
||||
try {
|
||||
@@ -462,7 +462,7 @@ public class PoolableStatement extends PoolableWrapper implements Statement {
|
||||
@Override
|
||||
public final int executeUpdate(String sql, String columnNames[]) throws SQLException {
|
||||
checkOpen();
|
||||
|
||||
|
||||
transactionRecord(sql);
|
||||
|
||||
try {
|
||||
@@ -475,7 +475,7 @@ public class PoolableStatement extends PoolableWrapper implements Statement {
|
||||
@Override
|
||||
public final boolean execute(String sql, int autoGeneratedKeys) throws SQLException {
|
||||
checkOpen();
|
||||
|
||||
|
||||
transactionRecord(sql);
|
||||
|
||||
try {
|
||||
@@ -488,7 +488,7 @@ public class PoolableStatement extends PoolableWrapper implements Statement {
|
||||
@Override
|
||||
public final boolean execute(String sql, int columnIndexes[]) throws SQLException {
|
||||
checkOpen();
|
||||
|
||||
|
||||
transactionRecord(sql);
|
||||
|
||||
try {
|
||||
@@ -501,7 +501,7 @@ public class PoolableStatement extends PoolableWrapper implements Statement {
|
||||
@Override
|
||||
public final boolean execute(String sql, String columnNames[]) throws SQLException {
|
||||
checkOpen();
|
||||
|
||||
|
||||
transactionRecord(sql);
|
||||
|
||||
try {
|
||||
@@ -544,11 +544,11 @@ public class PoolableStatement extends PoolableWrapper implements Statement {
|
||||
public String toString() {
|
||||
return stmt.toString();
|
||||
}
|
||||
|
||||
|
||||
public void closeOnCompletion() throws SQLException {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public boolean isCloseOnCompletion() throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -55,12 +55,12 @@ public class PreparedStatementPool {
|
||||
}
|
||||
|
||||
public void put(PreparedStatementHolder holder) throws SQLException {
|
||||
PreparedStatement stmt = holder.getStatement();
|
||||
|
||||
PreparedStatement stmt = holder.getStatement();
|
||||
|
||||
if (stmt.isClosed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
PreparedStatementKey key = holder.getKey();
|
||||
PreparedStatementHolder oldHolder = map.put(key, holder);
|
||||
if (oldHolder != null) {
|
||||
|
||||
@@ -81,7 +81,7 @@ public class HADataSource extends MultiDataSource implements DataSource {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("HADataSource closed");
|
||||
}
|
||||
|
||||
|
||||
JdbcUtils.close(master);
|
||||
}
|
||||
|
||||
|
||||
@@ -452,7 +452,7 @@ public class MultiDataSourceStatement extends WrapperAdapter implements Statemen
|
||||
}
|
||||
|
||||
public void closeOnCompletion() throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException();
|
||||
throw new SQLFeatureNotSupportedException();
|
||||
}
|
||||
|
||||
public boolean isCloseOnCompletion() throws SQLException {
|
||||
|
||||
@@ -322,7 +322,7 @@ public class ConnectionProxyImpl extends WrapperProxyImpl implements ConnectionP
|
||||
}
|
||||
|
||||
public void setSchema(String schema) throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException();
|
||||
throw new SQLFeatureNotSupportedException();
|
||||
}
|
||||
|
||||
public String getSchema() throws SQLException {
|
||||
|
||||
@@ -42,6 +42,6 @@ public interface DataSourceProxy {
|
||||
long createStatementId();
|
||||
|
||||
long createResultSetId();
|
||||
|
||||
|
||||
long createTransactionId();
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class DataSourceProxyImpl implements DataSourceProxy, DataSourceProxyImpl
|
||||
private final AtomicLong connectionIdSeed = new AtomicLong(10000);
|
||||
private final AtomicLong statementIdSeed = new AtomicLong(20000);
|
||||
private final AtomicLong resultSetIdSeed = new AtomicLong(50000);
|
||||
private final AtomicLong transactionIdSeed = new AtomicLong(0);
|
||||
private final AtomicLong transactionIdSeed = new AtomicLong(0);
|
||||
|
||||
public DataSourceProxyImpl(Driver rawDriver, DataSourceProxyConfig config){
|
||||
super();
|
||||
|
||||
@@ -308,7 +308,7 @@ public class StatementProxyImpl extends WrapperProxyImpl implements StatementPro
|
||||
}
|
||||
|
||||
public void closeOnCompletion() throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException();
|
||||
throw new SQLFeatureNotSupportedException();
|
||||
}
|
||||
|
||||
public boolean isCloseOnCompletion() throws SQLException {
|
||||
|
||||
@@ -22,7 +22,7 @@ public abstract class SQLExprImpl extends SQLObjectImpl implements SQLExpr {
|
||||
public SQLExprImpl(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
public abstract boolean equals(Object o);
|
||||
|
||||
public abstract int hashCode();
|
||||
|
||||
@@ -21,7 +21,7 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
public class SQLAllColumnExpr extends SQLExprImpl {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
public SQLAllColumnExpr(){
|
||||
|
||||
}
|
||||
@@ -34,11 +34,11 @@ public class SQLAllColumnExpr extends SQLExprImpl {
|
||||
visitor.visit(this);
|
||||
visitor.endVisit(this);
|
||||
}
|
||||
|
||||
|
||||
public int hashCode() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
public boolean equals(Object o) {
|
||||
return o instanceof SQLAllColumnExpr;
|
||||
}
|
||||
|
||||
@@ -83,5 +83,5 @@ public class SQLAllExpr extends SQLExprImpl {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -128,6 +128,5 @@ public class SQLBinaryOpExpr extends SQLExprImpl implements Serializable {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -180,6 +180,5 @@ public class SQLCaseExpr extends SQLExprImpl implements Serializable {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -100,5 +100,5 @@ public class SQLCastExpr extends SQLExprImpl {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -81,6 +81,5 @@ public class SQLIdentifierExpr extends SQLExprImpl implements SQLName {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -54,5 +54,5 @@ public class SQLListExpr extends SQLExprImpl {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -34,11 +34,11 @@ public class SQLNullExpr extends SQLLiteralExpr {
|
||||
|
||||
visitor.endVisit(this);
|
||||
}
|
||||
|
||||
|
||||
public int hashCode() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
public boolean equals(Object o) {
|
||||
return o instanceof SQLNullExpr;
|
||||
}
|
||||
|
||||
@@ -104,6 +104,5 @@ public class SQLPropertyExpr extends SQLExprImpl implements SQLName {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -81,6 +81,5 @@ public class SQLVariantRefExpr extends SQLExprImpl {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -88,6 +88,5 @@ public class MySqlBinaryExpr extends SQLLiteralExpr implements MySqlExpr {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -82,6 +82,5 @@ public class MySqlBooleanExpr extends SQLLiteralExpr implements MySqlExpr {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -124,5 +124,5 @@ public class MySqlMatchAgainstExpr extends SQLExprImpl implements MySqlExpr {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -76,7 +76,7 @@ public class MySqlParameterizedOutputVisitor extends MySqlOutputVisitor {
|
||||
}
|
||||
x = new SQLBinaryOpExpr(x.getLeft(), x.getOperator(), merge((SQLBinaryOpExpr) x.getRight()));
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.alibaba.druid.sql.dialect.oracle.ast;
|
||||
import com.alibaba.druid.sql.ast.SQLObject;
|
||||
import com.alibaba.druid.sql.dialect.oracle.visitor.OracleASTVisitor;
|
||||
|
||||
|
||||
public interface OracleSQLObject extends SQLObject {
|
||||
|
||||
void accept0(OracleASTVisitor visitor);
|
||||
}
|
||||
|
||||
@@ -59,5 +59,4 @@ public class GroupingSetExpr extends SQLExprImpl {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.alibaba.druid.sql.dialect.oracle.ast.expr;
|
||||
import com.alibaba.druid.sql.ast.SQLExpr;
|
||||
import com.alibaba.druid.sql.dialect.oracle.ast.OracleSQLObject;
|
||||
|
||||
|
||||
public interface OracleExpr extends SQLExpr, OracleSQLObject {
|
||||
|
||||
}
|
||||
|
||||
@@ -100,5 +100,5 @@ public class OracleExtractExpr extends SQLExprImpl implements OracleExpr {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -153,5 +153,5 @@ public class OracleIntervalExpr extends SQLLiteralExpr implements OracleExpr {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -93,5 +93,5 @@ public class OracleTimestampExpr extends SQLLiteralExpr implements OracleExpr {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ public class OracleDeleteStatement extends SQLDeleteStatement {
|
||||
public List<OracleHint> getHints() {
|
||||
return this.hints;
|
||||
}
|
||||
|
||||
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
accept0((OracleASTVisitor) visitor);
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ import com.alibaba.druid.sql.parser.Token;
|
||||
public class OracleExprParser extends SQLExprParser {
|
||||
|
||||
|
||||
|
||||
public boolean allowStringAdditive = false;
|
||||
|
||||
/**
|
||||
|
||||
@@ -93,9 +93,9 @@ public class OracleLexer extends Lexer {
|
||||
map.put("EXTRACT", Token.EXTRACT);
|
||||
map.put("DATE", Token.DATE);
|
||||
map.put("TIMESTAMP", Token.TIMESTAMP);
|
||||
|
||||
|
||||
map.put("CURSOR", Token.CURSOR);
|
||||
|
||||
|
||||
map.put("DAY", Token.DAY);
|
||||
map.put("YEAR", Token.YEAR);
|
||||
map.put("MONTH", Token.MONTH);
|
||||
|
||||
@@ -372,7 +372,7 @@ public class OracleSelectParser extends SQLSelectParser {
|
||||
ModelColumnClause modelColumnClause = new ModelColumnClause();
|
||||
parseQueryPartitionClause(modelColumnClause);
|
||||
mainModel.setModelColumnClause(modelColumnClause);
|
||||
|
||||
|
||||
acceptIdentifier("DIMENSION");
|
||||
accept(Token.BY);
|
||||
accept(Token.LPAREN);
|
||||
@@ -381,18 +381,18 @@ public class OracleSelectParser extends SQLSelectParser {
|
||||
lexer.nextToken();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
ModelColumn column = new ModelColumn();
|
||||
column.setExpr(expr());
|
||||
column.setAlias(as());
|
||||
modelColumnClause.getDimensionByColumns().add(column);
|
||||
|
||||
|
||||
if (lexer.token() == Token.COMMA) {
|
||||
lexer.nextToken();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
acceptIdentifier("MEASURES");
|
||||
accept(Token.LPAREN);
|
||||
for (;;) {
|
||||
@@ -400,28 +400,28 @@ public class OracleSelectParser extends SQLSelectParser {
|
||||
lexer.nextToken();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
ModelColumn column = new ModelColumn();
|
||||
column.setExpr(expr());
|
||||
column.setAlias(as());
|
||||
modelColumnClause.getMeasuresColumns().add(column);
|
||||
|
||||
|
||||
if (lexer.token() == Token.COMMA) {
|
||||
lexer.nextToken();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
mainModel.setModelColumnClause(modelColumnClause);
|
||||
|
||||
|
||||
parseCellReferenceOptions(mainModel.getCellReferenceOptions());
|
||||
|
||||
|
||||
parseModelRulesClause(mainModel);
|
||||
|
||||
modelClause.setMainModel(mainModel);
|
||||
}
|
||||
|
||||
|
||||
private void parseModelRulesClause(MainModelClause mainModel) {
|
||||
ModelRulesClause modelRulesClause = new ModelRulesClause();
|
||||
ModelRulesClause modelRulesClause = new ModelRulesClause();
|
||||
if (identifierEquals("RULES")) {
|
||||
lexer.nextToken();
|
||||
if (lexer.token() == Token.UPDATE) {
|
||||
@@ -431,7 +431,7 @@ public class OracleSelectParser extends SQLSelectParser {
|
||||
modelRulesClause.getOptions().add(ModelRuleOption.UPSERT);
|
||||
lexer.nextToken();
|
||||
}
|
||||
|
||||
|
||||
if (identifierEquals("AUTOMATIC")) {
|
||||
lexer.nextToken();
|
||||
accept(Token.ORDER);
|
||||
@@ -442,54 +442,54 @@ public class OracleSelectParser extends SQLSelectParser {
|
||||
modelRulesClause.getOptions().add(ModelRuleOption.SEQUENTIAL_ORDER);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (identifierEquals("ITERATE")) {
|
||||
lexer.nextToken();
|
||||
accept(Token.LPAREN);
|
||||
modelRulesClause.setIterate(expr());
|
||||
accept(Token.RPAREN);
|
||||
|
||||
|
||||
if (identifierEquals("UNTIL")) {
|
||||
lexer.nextToken();
|
||||
accept(Token.LPAREN);
|
||||
modelRulesClause.setUntil(expr());
|
||||
accept(Token.RPAREN);
|
||||
accept(Token.RPAREN);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
accept(Token.LPAREN);
|
||||
for (;;) {
|
||||
if (lexer.token() == Token.RPAREN) {
|
||||
lexer.nextToken();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
CellAssignmentItem item = new CellAssignmentItem();
|
||||
if (lexer.token() == Token.UPDATE) {
|
||||
item.setOption(ModelRuleOption.UPDATE);
|
||||
} else if (identifierEquals("UPSERT")) {
|
||||
item.setOption(ModelRuleOption.UPSERT);
|
||||
}
|
||||
|
||||
|
||||
item.setCellAssignment(parseCellAssignment());
|
||||
item.setOrderBy(this.parseOrderBy());
|
||||
accept(Token.EQ);
|
||||
item.setExpr(expr());
|
||||
|
||||
|
||||
modelRulesClause.getCellAssignmentItems().add(item);
|
||||
}
|
||||
|
||||
|
||||
mainModel.setModelRulesClause(modelRulesClause);
|
||||
}
|
||||
|
||||
|
||||
private CellAssignment parseCellAssignment() {
|
||||
CellAssignment cellAssignment = new CellAssignment();
|
||||
|
||||
|
||||
cellAssignment.setMeasureColumn(expr());
|
||||
accept(Token.LBRACKET);
|
||||
this.createExprParser().exprList(cellAssignment.getConditions());
|
||||
accept(Token.RBRACKET);
|
||||
|
||||
|
||||
return cellAssignment;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -41,7 +41,7 @@ public class OracleParameterizedOutputVisitor extends OracleOutputVisitor {
|
||||
|
||||
return super.visit(x);
|
||||
}
|
||||
|
||||
|
||||
public boolean visit(SQLNullExpr x) {
|
||||
print('?');
|
||||
return false;
|
||||
@@ -75,7 +75,7 @@ public class OracleParameterizedOutputVisitor extends OracleOutputVisitor {
|
||||
}
|
||||
x = new SQLBinaryOpExpr(x.getLeft(), x.getOperator(), merge((SQLBinaryOpExpr) x.getRight()));
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.alibaba.druid.sql.dialect.sqlserver.ast;
|
||||
|
||||
import com.alibaba.druid.sql.ast.statement.SQLSelect;
|
||||
|
||||
|
||||
public class SQLServerSelect extends SQLSelect {
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ public class SQLServerSelectQueryBlock extends SQLSelectQueryBlock {
|
||||
public void setTop(Top top) {
|
||||
this.top = top;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
accept0((SQLServerASTVisitor) visitor);
|
||||
|
||||
@@ -9,10 +9,10 @@ public class Top extends SQLServerObjectImpl {
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private SQLExpr expr;
|
||||
private boolean percent;
|
||||
private boolean withTies;
|
||||
|
||||
private SQLExpr expr;
|
||||
private boolean percent;
|
||||
private boolean withTies;
|
||||
|
||||
public SQLExpr getExpr() {
|
||||
return expr;
|
||||
@@ -41,7 +41,7 @@ public class Top extends SQLServerObjectImpl {
|
||||
@Override
|
||||
public void accept0(SQLServerASTVisitor visitor) {
|
||||
if (visitor.visit(this)) {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.alibaba.druid.sql.parser.Keywords;
|
||||
import com.alibaba.druid.sql.parser.Lexer;
|
||||
import com.alibaba.druid.sql.parser.Token;
|
||||
|
||||
|
||||
public class SQLServerLexer extends Lexer {
|
||||
|
||||
public final static Keywords DEFAULT_SQL_SERVER_KEYWORDS;
|
||||
|
||||
+2
-2
@@ -34,7 +34,7 @@ public class SQLServerSelectParser extends SQLSelectParser {
|
||||
|
||||
return select;
|
||||
}
|
||||
|
||||
|
||||
protected SQLSelectQuery query() throws ParserException {
|
||||
if (lexer.token() == Token.LPAREN) {
|
||||
lexer.nextToken();
|
||||
@@ -56,7 +56,7 @@ public class SQLServerSelectParser extends SQLSelectParser {
|
||||
queryBlock.setDistionOption(SQLSetQuantifier.ALL);
|
||||
lexer.nextToken();
|
||||
}
|
||||
|
||||
|
||||
if (lexer.token() == Token.TOP) {
|
||||
Top top = new Top();
|
||||
lexer.nextToken();
|
||||
|
||||
+3
-2
@@ -5,11 +5,12 @@ import com.alibaba.druid.sql.dialect.sqlserver.ast.Top;
|
||||
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public interface SQLServerASTVisitor extends SQLASTVisitor {
|
||||
|
||||
boolean visit(SQLServerSelectQueryBlock x);
|
||||
|
||||
void endVisit(SQLServerSelectQueryBlock x);
|
||||
|
||||
|
||||
boolean visit(Top x);
|
||||
|
||||
|
||||
void endVisit(Top x);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.alibaba.druid.sql.dialect.transact.ast;
|
||||
|
||||
import com.alibaba.druid.sql.ast.SQLObject;
|
||||
|
||||
|
||||
public interface TransactSQLObject extends SQLObject {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.alibaba.druid.sql.dialect.transact.ast;
|
||||
|
||||
|
||||
public class TransactSQLSelect {
|
||||
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public class Lexer {
|
||||
int bp;
|
||||
int sp;
|
||||
int np;
|
||||
char ch;
|
||||
char ch;
|
||||
Token token;
|
||||
}
|
||||
|
||||
|
||||
@@ -211,7 +211,6 @@ public class SQLASTVisitorAdapter implements SQLASTVisitor {
|
||||
public void endVisit(SQLCastExpr x) {
|
||||
}
|
||||
|
||||
|
||||
public boolean visit(SQLSelectStatement astNode) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ public class DruidDataSourceStatManager implements DruidDataSourceStatManagerMBe
|
||||
|
||||
public synchronized static void remove(DruidDataSource dataSource) {
|
||||
ObjectName objectName = dataSources.remove(dataSource);
|
||||
|
||||
|
||||
if (objectName == null) {
|
||||
return;
|
||||
}
|
||||
@@ -188,7 +188,7 @@ public class DruidDataSourceStatManager implements DruidDataSourceStatManagerMBe
|
||||
map.put("ErrorCount", dataSource.getErrorCount());
|
||||
map.put("ReusePreparedStatementCount", dataSource.getReusePreparedStatementCount());
|
||||
map.put("StartTransactionCount", dataSource.getStartTransactionCount());
|
||||
|
||||
|
||||
map.put("CommitCount", dataSource.getCommitCount());
|
||||
map.put("RollbackCount", dataSource.getRollbackCount());
|
||||
|
||||
@@ -217,12 +217,18 @@ public class DruidDataSourceStatManager implements DruidDataSourceStatManagerMBe
|
||||
|
||||
String[] indexNames = {
|
||||
//
|
||||
"Name", "URL", "CreateCount", "DestroyCount", "ConnectCount", //
|
||||
"CloseCount", "ActiveCount", "PoolingCount", "LockQueueLength", "WaitThreadCount", //
|
||||
"InitialSize", "MaxActive", "MinIdle", "PoolPreparedStatements", "TestOnBorrow", //
|
||||
"TestOnReturn", "MinEvictableIdleTimeMillis", "ConnectErrorCount", "CreateTimespanMillis", "DbType", //
|
||||
"ValidationQuery", "ValidationQueryTimeout", "DriverClassName", "Username", "RemoveAbandonedCount", //
|
||||
"NotEmptyWaitCount", "NotEmptyWaitNanos", "ErrorCount", "ReusePreparedStatementCount", "StartTransactionCount", //
|
||||
"Name", "URL", "CreateCount", "DestroyCount",
|
||||
"ConnectCount", //
|
||||
"CloseCount", "ActiveCount", "PoolingCount", "LockQueueLength",
|
||||
"WaitThreadCount", //
|
||||
"InitialSize", "MaxActive", "MinIdle", "PoolPreparedStatements",
|
||||
"TestOnBorrow", //
|
||||
"TestOnReturn", "MinEvictableIdleTimeMillis", "ConnectErrorCount", "CreateTimespanMillis",
|
||||
"DbType", //
|
||||
"ValidationQuery", "ValidationQueryTimeout", "DriverClassName", "Username",
|
||||
"RemoveAbandonedCount", //
|
||||
"NotEmptyWaitCount", "NotEmptyWaitNanos", "ErrorCount", "ReusePreparedStatementCount",
|
||||
"StartTransactionCount", //
|
||||
"CommitCount", "RollbackCount"
|
||||
//
|
||||
};
|
||||
|
||||
@@ -64,9 +64,8 @@ public final class JdbcSqlStat implements JdbcSqlStatMBean {
|
||||
|
||||
private final Histogram histogram = new Histogram(new long[] { //
|
||||
//
|
||||
4, 15, 60, 250, //
|
||||
1000, 4 * 1000, 15 * 1000, 60 * 1000, 250 * 1000
|
||||
});
|
||||
4, 15, 60, 250, //
|
||||
1000, 4 * 1000, 15 * 1000, 60 * 1000, 250 * 1000 });
|
||||
|
||||
public JdbcSqlStat(String sql){
|
||||
this.sql = sql;
|
||||
@@ -335,40 +334,15 @@ public final class JdbcSqlStat implements JdbcSqlStatMBean {
|
||||
SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.DATE,
|
||||
SimpleType.STRING, SimpleType.STRING //
|
||||
|
||||
, new ArrayType<Long>(SimpleType.LONG, true)
|
||||
};
|
||||
, new ArrayType<Long>(SimpleType.LONG, true) };
|
||||
|
||||
String[] indexNames = {
|
||||
"ID",
|
||||
"DataSource",
|
||||
"SQL",
|
||||
"ExecuteCount",
|
||||
"ErrorCount" //
|
||||
,
|
||||
"TotalTime",
|
||||
"LastTime",
|
||||
"MaxTimespan",
|
||||
"LastError",
|
||||
"EffectedRowCount" //
|
||||
,
|
||||
"FetchRowCount",
|
||||
"MaxTimespanOccurTime",
|
||||
"BatchSizeMax",
|
||||
"BatchSizeTotal",
|
||||
"ConcurrentMax" //
|
||||
,
|
||||
"RunningCount",
|
||||
"Name",
|
||||
"File",
|
||||
"LastErrorMessage",
|
||||
"LastErrorClass" //
|
||||
,
|
||||
"LastErrorStackTrace",
|
||||
"LastErrorTime",
|
||||
"DbType",
|
||||
"URL" //
|
||||
String[] indexNames = { "ID", "DataSource", "SQL", "ExecuteCount", "ErrorCount" //
|
||||
, "TotalTime", "LastTime", "MaxTimespan", "LastError", "EffectedRowCount" //
|
||||
, "FetchRowCount", "MaxTimespanOccurTime", "BatchSizeMax", "BatchSizeTotal", "ConcurrentMax" //
|
||||
, "RunningCount", "Name", "File", "LastErrorMessage", "LastErrorClass" //
|
||||
, "LastErrorStackTrace", "LastErrorTime", "DbType", "URL" //
|
||||
|
||||
, "Histogram"};
|
||||
, "Histogram" };
|
||||
String[] indexDescriptions = indexNames;
|
||||
COMPOSITE_TYPE = new CompositeType("SqlStatistic", "Sql Statistic", indexNames, indexDescriptions, indexTypes);
|
||||
|
||||
|
||||
@@ -1100,9 +1100,9 @@ public final class ConcurrentIdentityHashMap<K, V> extends AbstractMap<K, V> imp
|
||||
*/
|
||||
static class SimpleEntry<K, V> implements Entry<K, V> {
|
||||
|
||||
private final K key;
|
||||
private final K key;
|
||||
|
||||
private V value;
|
||||
private V value;
|
||||
|
||||
public SimpleEntry(K key, V value){
|
||||
this.key = key;
|
||||
|
||||
@@ -81,7 +81,7 @@ public class Histogram {
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
|
||||
public long[] getRanges() {
|
||||
return ranges;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user