fixed sonar rule violations

This commit is contained in:
wenshao
2012-08-29 15:36:45 +08:00
parent c96af1628e
commit 5c6d5fcadc
17 changed files with 206 additions and 211 deletions
@@ -170,9 +170,11 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
print(' ');
}
if (SQLSetQuantifier.ALL == x.getDistionOption()) print("ALL ");
else if (SQLSetQuantifier.DISTINCT == x.getDistionOption()) print("DISTINCT ");
else if (SQLSetQuantifier.DISTINCTROW == x.getDistionOption()) {
if (SQLSetQuantifier.ALL == x.getDistionOption()) {
print("ALL ");
} else if (SQLSetQuantifier.DISTINCT == x.getDistionOption()) {
print("DISTINCT ");
} else if (SQLSetQuantifier.DISTINCTROW == x.getDistionOption()) {
print("DISTINCTROW ");
}
@@ -495,7 +497,8 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
print("@@global.");
} else {
String varName = x.getName();
if ((!varName.startsWith("@")) && (!varName.equals("?")) && (!varName.startsWith("#")) && (!varName.startsWith("$"))) {
if ((!varName.startsWith("@")) && (!varName.equals("?")) && (!varName.startsWith("#"))
&& (!varName.startsWith("$"))) {
print("@@");
}
}
@@ -2568,7 +2571,7 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
public void endVisit(MySqlAlterTableAddIndex x) {
}
@Override
public boolean visit(MySqlAlterTableAddUnique x) {
print("ADD ");
@@ -2576,9 +2579,9 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
print(x.getType());
print(" ");
}
print("UNIQUE ");
if (x.getName() != null) {
x.getName().accept(this);
print(' ');
@@ -2586,17 +2589,17 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
print("(");
printAndAccept(x.getItems(), ", ");
print(")");
if (x.getUsing() != null) {
print(" USING ");
print(x.getUsing());
}
return false;
}
@Override
public void endVisit(MySqlAlterTableAddUnique x) {
}
@Override
@@ -35,8 +35,11 @@ public abstract class OracleConstraint extends OracleSQLObjectImpl {
}
public void setName(String name) {
if (name == null) this.name = null;
else this.name = new SQLIdentifierExpr(name);
if (name == null) {
this.name = null;
} else {
this.name = new SQLIdentifierExpr(name);
}
}
public void setName(SQLName name) {
@@ -30,7 +30,7 @@ public class OracleSelectQueryBlock extends SQLSelectQueryBlock {
private static final long serialVersionUID = 1L;
private final List<SQLCommentHint> hints = new ArrayList<SQLCommentHint>(1);
private final List<SQLCommentHint> hints = new ArrayList<SQLCommentHint>(1);
private OracleSelectHierachicalQueryClause hierachicalQueryClause;
private ModelClause modelClause;
@@ -93,9 +93,11 @@ public class OracleSelectQueryBlock extends SQLSelectQueryBlock {
public void output(StringBuffer buf) {
buf.append("SELECT ");
if (SQLSetQuantifier.ALL == this.distionOption) buf.append("ALL ");
else if (SQLSetQuantifier.DISTINCT == this.distionOption) buf.append("DISTINCT ");
else if (SQLSetQuantifier.UNIQUE == this.distionOption) {
if (SQLSetQuantifier.ALL == this.distionOption) {
buf.append("ALL ");
} else if (SQLSetQuantifier.DISTINCT == this.distionOption) {
buf.append("DISTINCT ");
} else if (SQLSetQuantifier.UNIQUE == this.distionOption) {
buf.append("UNIQUE ");
}
@@ -72,7 +72,7 @@ import com.alibaba.druid.sql.parser.Token;
public class OracleSelectParser extends SQLSelectParser {
public OracleSelectParser(String sql){
super (new OracleExprParser(sql));
super(new OracleExprParser(sql));
}
public OracleSelectParser(SQLExprParser exprParser){
@@ -194,8 +194,9 @@ public class OracleSelectParser extends SQLSelectParser {
if (identifierEquals("READ")) {
lexer.nextToken();
if (identifierEquals("ONLY")) lexer.nextToken();
else {
if (identifierEquals("ONLY")) {
lexer.nextToken();
} else {
throw new ParserException("syntax error");
}
@@ -203,8 +204,9 @@ public class OracleSelectParser extends SQLSelectParser {
} else if (lexer.token() == (Token.CHECK)) {
lexer.nextToken();
if (identifierEquals("OPTION")) lexer.nextToken();
else {
if (identifierEquals("OPTION")) {
lexer.nextToken();
} else {
throw new ParserException("syntax error");
}
@@ -348,7 +350,6 @@ public class OracleSelectParser extends SQLSelectParser {
model.setReturnRowsClause(returnRowsClause);
}
while (identifierEquals("REFERENCE")) {
ReferenceModelClause referenceModelClause = new ReferenceModelClause();
lexer.nextToken();