mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved mariadb alter sequence support, fix #4024
This commit is contained in:
@@ -25,6 +25,9 @@ public class SQLAlterSequenceStatement extends SQLStatementImpl implements SQLAl
|
||||
private Boolean cache;
|
||||
private SQLExpr cacheValue;
|
||||
|
||||
private boolean restart;
|
||||
private SQLExpr restartWith;
|
||||
|
||||
private Boolean order;
|
||||
|
||||
private boolean changeToSimple;
|
||||
@@ -203,4 +206,23 @@ public class SQLAlterSequenceStatement extends SQLStatementImpl implements SQLAl
|
||||
public void setChangeToTime(boolean changeToTime) {
|
||||
this.changeToTime = changeToTime;
|
||||
}
|
||||
|
||||
public boolean isRestart() {
|
||||
return restart;
|
||||
}
|
||||
|
||||
public void setRestart(boolean restart) {
|
||||
this.restart = restart;
|
||||
}
|
||||
|
||||
public SQLExpr getRestartWith() {
|
||||
return restartWith;
|
||||
}
|
||||
|
||||
public void setRestartWith(SQLExpr x) {
|
||||
if (x != null) {
|
||||
x.setParent(this);
|
||||
}
|
||||
this.restartWith = x;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6548,6 +6548,18 @@ public class SQLStatementParser extends SQLParser {
|
||||
} else if (lexer.token() == Token.ORDER) {
|
||||
lexer.nextToken();
|
||||
stmt.setOrder(Boolean.TRUE);
|
||||
continue;
|
||||
} else if (lexer.identifierEquals(FnvHash.Constants.RESTART)) {
|
||||
lexer.nextToken();
|
||||
stmt.setRestart(true);
|
||||
|
||||
if (lexer.token == Token.WITH || lexer.token == Token.EQ) {
|
||||
lexer.nextToken();
|
||||
stmt.setRestartWith(this.exprParser.primary());
|
||||
} else if(lexer.token == LITERAL_INT) {
|
||||
stmt.setRestartWith(this.exprParser.primary());
|
||||
}
|
||||
|
||||
continue;
|
||||
} else if (lexer.identifierEquals("NOORDER")) {
|
||||
lexer.nextToken();
|
||||
|
||||
@@ -7820,6 +7820,16 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter implements Paramet
|
||||
}
|
||||
}
|
||||
|
||||
if (x.isRestart()) {
|
||||
print0(ucase ? " RESTART" : " restart");
|
||||
|
||||
SQLExpr restartWith = x.getRestartWith();
|
||||
if (restartWith != null) {
|
||||
print0(ucase ? " WITH " : " with ");
|
||||
restartWith.accept(this);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user