support mysql invisible index

This commit is contained in:
高铁
2021-06-04 17:35:40 +08:00
parent 23a65caeda
commit e61b2cb925
5 changed files with 35 additions and 0 deletions
@@ -20,8 +20,13 @@ public class SQLIndexOptions extends SQLObjectImpl {
private SQLExpr comment;
private String algorithm;
private String lock;
private boolean invisible;
private List<SQLAssignItem> otherOptions = new ArrayList<SQLAssignItem>();
public SQLIndexOptions() {
}
public String getIndexType() {
return indexType;
}
@@ -120,6 +125,14 @@ public class SQLIndexOptions extends SQLObjectImpl {
}
}
public boolean isInvisible() {
return invisible;
}
public void setInvisible(boolean invisible) {
this.invisible = invisible;
}
public List<SQLAssignItem> getOtherOptions() {
return otherOptions;
}
@@ -154,5 +167,7 @@ public class SQLIndexOptions extends SQLObjectImpl {
item1.setParent(parent);
options.otherOptions.add(item1);
}
options.invisible = invisible;
}
}
@@ -348,6 +348,10 @@ public class MySqlCreateTableParser extends SQLCreateTableParser {
stmt.getTableElementList().add(column);
}
if (lexer.token() == Token.HINT) {
lexer.nextToken();
}
if (lexer.token() != Token.COMMA) {
break;
} else {
@@ -701,6 +701,10 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
}
print(')');
if (x.getIndexDefinition().hasOptions()) {
x.getIndexDefinition().getOptions().accept(this);
}
SQLExpr comment = x.getComment();
if (comment != null) {
print0(ucase ? " COMMENT " : " comment ");
@@ -4776,6 +4776,14 @@ public class SQLExprParser extends SQLParser {
if (lexer.token() == Token.COMMENT) {
lexer.nextToken();
indexDefinition.getOptions().setComment(primary());
} else if ((DbType.mysql == dbType) &&
lexer.identifierEquals("INVISIBLE")) {
lexer.nextToken();
indexDefinition.getOptions().setInvisible(true);
} else if ((DbType.mysql == dbType) &&
lexer.token == Token.HINT && lexer.stringVal().trim().equals("!80000 INVISIBLE")) {
lexer.nextToken();
indexDefinition.getOptions().setInvisible(true);
} else if (DbType.mysql == dbType) {
switch (lexer.token()) {
case WITH:
@@ -6033,6 +6033,10 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter implements Paramet
}
*/
if (x.isInvisible()) {
print0(ucase ? " INVISIBLE" : " invisible");
}
SQLExpr keyBlockSize = x.getKeyBlockSize();
if (keyBlockSize != null) {
print0(ucase ? " KEY_BLOCK_SIZE = " : " key_block_size = ");