mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
Merge branch 'master' of https://github.com/alibaba/druid
This commit is contained in:
@@ -23,6 +23,7 @@ import java.sql.Statement;
|
||||
import com.alibaba.druid.pool.ValidConnectionChecker;
|
||||
import com.alibaba.druid.pool.ValidConnectionCheckerAdapter;
|
||||
import com.alibaba.druid.util.JdbcUtils;
|
||||
import com.alibaba.druid.util.StringUtils;
|
||||
|
||||
/**
|
||||
* A MSSQLValidConnectionChecker.
|
||||
@@ -30,6 +31,7 @@ import com.alibaba.druid.util.JdbcUtils;
|
||||
public class MSSQLValidConnectionChecker extends ValidConnectionCheckerAdapter implements ValidConnectionChecker, Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final String DEFAULT_VALIDATION_QUERY = "SELECT 1";
|
||||
|
||||
public MSSQLValidConnectionChecker(){
|
||||
|
||||
@@ -40,6 +42,10 @@ public class MSSQLValidConnectionChecker extends ValidConnectionCheckerAdapter i
|
||||
return false;
|
||||
}
|
||||
|
||||
if(StringUtils.isEmpty(validateQuery)) {
|
||||
validateQuery = DEFAULT_VALIDATION_QUERY;
|
||||
}
|
||||
|
||||
Statement stmt = null;
|
||||
|
||||
try {
|
||||
|
||||
@@ -26,7 +26,7 @@ public final class SQLOrderBy extends SQLObjectImpl implements SQLReplaceable {
|
||||
protected final List<SQLSelectOrderByItem> items = new ArrayList<SQLSelectOrderByItem>();
|
||||
|
||||
// for postgres
|
||||
private boolean sibings;
|
||||
private boolean siblings;
|
||||
|
||||
public SQLOrderBy(){
|
||||
|
||||
@@ -57,12 +57,12 @@ public final class SQLOrderBy extends SQLObjectImpl implements SQLReplaceable {
|
||||
return this.items;
|
||||
}
|
||||
|
||||
public boolean isSibings() {
|
||||
return this.sibings;
|
||||
public boolean isSiblings() {
|
||||
return this.siblings;
|
||||
}
|
||||
|
||||
public void setSibings(boolean sibings) {
|
||||
this.sibings = sibings;
|
||||
public void setSiblings(boolean siblings) {
|
||||
this.siblings = siblings;
|
||||
}
|
||||
|
||||
protected void accept0(SQLASTVisitor v) {
|
||||
@@ -83,14 +83,14 @@ public final class SQLOrderBy extends SQLObjectImpl implements SQLReplaceable {
|
||||
|
||||
SQLOrderBy order = (SQLOrderBy) o;
|
||||
|
||||
if (sibings != order.sibings) return false;
|
||||
if (siblings != order.siblings) return false;
|
||||
return items.equals(order.items);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = items.hashCode();
|
||||
result = 31 * result + (sibings ? 1 : 0);
|
||||
result = 31 * result + (siblings ? 1 : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ public final class SQLOrderBy extends SQLObjectImpl implements SQLReplaceable {
|
||||
x.items.add(item1);
|
||||
}
|
||||
|
||||
x.sibings = sibings;
|
||||
x.siblings = siblings;
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
@@ -2695,7 +2695,7 @@ public class SQLExprParser extends SQLParser {
|
||||
|
||||
if (lexer.identifierEquals(FnvHash.Constants.SIBLINGS)) {
|
||||
lexer.nextToken();
|
||||
orderBy.setSibings(true);
|
||||
orderBy.setSiblings(true);
|
||||
}
|
||||
|
||||
accept(Token.BY);
|
||||
@@ -2745,7 +2745,7 @@ public class SQLExprParser extends SQLParser {
|
||||
|
||||
if (lexer.identifierEquals(FnvHash.Constants.SIBLINGS)) {
|
||||
lexer.nextToken();
|
||||
orderBy.setSibings(true);
|
||||
orderBy.setSiblings(true);
|
||||
}
|
||||
|
||||
accept(Token.BY);
|
||||
@@ -2770,7 +2770,7 @@ public class SQLExprParser extends SQLParser {
|
||||
|
||||
if (lexer.identifierEquals(FnvHash.Constants.SIBLINGS)) {
|
||||
lexer.nextToken();
|
||||
orderBy.setSibings(true);
|
||||
orderBy.setSiblings(true);
|
||||
}
|
||||
|
||||
accept(Token.BY);
|
||||
@@ -2795,7 +2795,7 @@ public class SQLExprParser extends SQLParser {
|
||||
|
||||
if (lexer.identifierEquals(FnvHash.Constants.SIBLINGS)) {
|
||||
lexer.nextToken();
|
||||
orderBy.setSibings(true);
|
||||
orderBy.setSiblings(true);
|
||||
}
|
||||
|
||||
accept(Token.BY);
|
||||
|
||||
@@ -125,7 +125,7 @@ public final class ExportParameterVisitorUtils {
|
||||
} else if (listItem instanceof SQLNumericLiteralExpr) {
|
||||
Object listValue = ((SQLNumericLiteralExpr) listItem).getNumber();
|
||||
listValues.add(listValue);
|
||||
} else if (param instanceof SQLHexExpr) {
|
||||
} else if (listItem instanceof SQLHexExpr) {
|
||||
Object listValue = ((SQLHexExpr) listItem).toBytes();
|
||||
listValues.add(listValue);
|
||||
}
|
||||
|
||||
@@ -2718,7 +2718,7 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter implements Paramet
|
||||
List<SQLSelectOrderByItem> items = x.getItems();
|
||||
|
||||
if (items.size() > 0) {
|
||||
if (x.isSibings()) {
|
||||
if (x.isSiblings()) {
|
||||
print0(ucase ? "ORDER SIBLINGS BY " : "order siblings by ");
|
||||
} else {
|
||||
print0(ucase ? "ORDER BY " : "order by ");
|
||||
|
||||
@@ -350,11 +350,10 @@ public class SQLEvalVisitorUtils {
|
||||
}
|
||||
|
||||
double doubleValue = castToDouble(paramValue);
|
||||
int result = (int) Math.ceil(doubleValue);
|
||||
|
||||
if (Double.isNaN(result)) {
|
||||
if (Double.isNaN(doubleValue)) {
|
||||
x.putAttribute(EVAL_VALUE, null);
|
||||
} else {
|
||||
int result = (int) Math.ceil(doubleValue);
|
||||
x.putAttribute(EVAL_VALUE, result);
|
||||
}
|
||||
} else if ("cos".equals(methodName)) {
|
||||
|
||||
Reference in New Issue
Block a user