mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improve 'build table tablename force=true';
This commit is contained in:
@@ -24,6 +24,7 @@ public class SQLBuildTableStatement extends SQLStatementImpl {
|
||||
private SQLName table;
|
||||
private SQLIntegerExpr version;
|
||||
private boolean withSplit = false;
|
||||
private boolean force = false;
|
||||
|
||||
@Override
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
@@ -57,4 +58,12 @@ public class SQLBuildTableStatement extends SQLStatementImpl {
|
||||
public void setWithSplit(boolean withSplit) {
|
||||
this.withSplit = withSplit;
|
||||
}
|
||||
|
||||
public boolean isForce() {
|
||||
return force;
|
||||
}
|
||||
|
||||
public void setForce(boolean force) {
|
||||
this.force = force;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1935,6 +1935,20 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
stmt.setWithSplit(true);
|
||||
}
|
||||
|
||||
if (lexer.identifierEquals(FnvHash.Constants.FORCE)) {
|
||||
lexer.nextToken();
|
||||
|
||||
accept(EQ);
|
||||
|
||||
if (lexer.token() == TRUE) {
|
||||
lexer.nextToken();
|
||||
stmt.setForce(true);
|
||||
} else if (lexer.token() == FALSE) {
|
||||
lexer.nextToken();
|
||||
stmt.setForce(false);
|
||||
}
|
||||
}
|
||||
|
||||
return stmt;
|
||||
}
|
||||
|
||||
|
||||
@@ -10666,6 +10666,12 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter implements Paramet
|
||||
print0(ucase ? " WITH SPLIT" : " with split");
|
||||
}
|
||||
|
||||
if (x.isForce()) {
|
||||
print0(ucase ? " FORCE = true" : " force = true");
|
||||
} else {
|
||||
print0(ucase ? " FORCE = false" : " force = false");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user