mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
skip mysql algorithm key at partition and subpartition
This commit is contained in:
+10
@@ -26,7 +26,16 @@ import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlASTVisitor;
|
||||
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class MySqlPartitionByKey extends SQLPartitionBy implements MySqlObject {
|
||||
private short algorithm = 2;
|
||||
|
||||
public short getAlgorithm() {
|
||||
return algorithm;
|
||||
}
|
||||
|
||||
public void setAlgorithm(short algorithm) {
|
||||
this.algorithm = algorithm;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
if (visitor instanceof MySqlASTVisitor) {
|
||||
@@ -54,6 +63,7 @@ public class MySqlPartitionByKey extends SQLPartitionBy implements MySqlObject {
|
||||
c2.setParent(x);
|
||||
x.columns.add(c2);
|
||||
}
|
||||
x.setAlgorithm(algorithm);
|
||||
}
|
||||
|
||||
public MySqlPartitionByKey clone() {
|
||||
|
||||
+10
@@ -27,6 +27,15 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
public class MySqlSubPartitionByKey extends SQLSubPartitionBy implements MySqlObject {
|
||||
|
||||
private List<SQLName> columns = new ArrayList<SQLName>();
|
||||
private short algorithm = 2;
|
||||
|
||||
public short getAlgorithm() {
|
||||
return algorithm;
|
||||
}
|
||||
|
||||
public void setAlgorithm(short algorithm) {
|
||||
this.algorithm = algorithm;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
@@ -64,6 +73,7 @@ public class MySqlSubPartitionByKey extends SQLSubPartitionBy implements MySqlOb
|
||||
c2.setParent(x);
|
||||
x.columns.add(c2);
|
||||
}
|
||||
x.setAlgorithm(algorithm);
|
||||
}
|
||||
|
||||
public MySqlSubPartitionByKey clone() {
|
||||
|
||||
@@ -454,6 +454,13 @@ public class MySqlCreateTableParser extends SQLCreateTableParser {
|
||||
clause.setLinear(true);
|
||||
}
|
||||
|
||||
if (lexer.token() == Token.ALGORITHM) {
|
||||
lexer.nextToken();
|
||||
accept(Token.EQ);
|
||||
clause.setAlgorithm(lexer.integerValue().shortValue());
|
||||
lexer.nextToken();
|
||||
}
|
||||
|
||||
accept(Token.LPAREN);
|
||||
if (lexer.token() != Token.RPAREN) {
|
||||
for (;;) {
|
||||
@@ -635,6 +642,13 @@ public class MySqlCreateTableParser extends SQLCreateTableParser {
|
||||
clause.setLinear(true);
|
||||
}
|
||||
|
||||
if (lexer.token() == Token.ALGORITHM) {
|
||||
lexer.nextToken();
|
||||
accept(Token.EQ);
|
||||
subPartitionKey.setAlgorithm(lexer.integerValue().shortValue());
|
||||
lexer.nextToken();
|
||||
}
|
||||
|
||||
accept(Token.LPAREN);
|
||||
for (;;) {
|
||||
subPartitionKey.addColumn(this.exprParser.name());
|
||||
|
||||
@@ -35,6 +35,7 @@ public class MySqlLexer extends Lexer {
|
||||
|
||||
map.putAll(Keywords.DEFAULT_KEYWORDS.getKeywords());
|
||||
|
||||
map.put("ALGORITHM", Token.ALGORITHM);
|
||||
map.put("DUAL", Token.DUAL);
|
||||
map.put("FALSE", Token.FALSE);
|
||||
map.put("IDENTIFIED", Token.IDENTIFIED);
|
||||
|
||||
@@ -125,6 +125,7 @@ public enum Token {
|
||||
KILL("KILL"),
|
||||
IDENTIFIED("IDENTIFIED"),
|
||||
PASSWORD("PASSWORD"),
|
||||
ALGORITHM("ALGORITHM"),
|
||||
DUAL("DUAL"),
|
||||
BINARY("BINARY"),
|
||||
SHOW("SHOW"),
|
||||
|
||||
Reference in New Issue
Block a user