mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
@@ -37,6 +37,7 @@ public class SQLCreateIndexStatement extends SQLStatementImpl implements SQLCrea
|
||||
protected List<SQLAssignItem> properties = new ArrayList<SQLAssignItem>();
|
||||
protected List<SQLAssignItem> tableProperties = new ArrayList<SQLAssignItem>();
|
||||
protected boolean storing;
|
||||
protected boolean ifNotExists;
|
||||
|
||||
public SQLCreateIndexStatement() {
|
||||
indexDefinition.setParent(this);
|
||||
@@ -162,6 +163,7 @@ public class SQLCreateIndexStatement extends SQLStatementImpl implements SQLCrea
|
||||
public SQLCreateIndexStatement clone() {
|
||||
SQLCreateIndexStatement x = new SQLCreateIndexStatement();
|
||||
indexDefinition.cloneTo(x.indexDefinition);
|
||||
x.setIfNotExists(ifNotExists);
|
||||
return x;
|
||||
}
|
||||
|
||||
@@ -318,4 +320,12 @@ public class SQLCreateIndexStatement extends SQLStatementImpl implements SQLCrea
|
||||
public List<SQLSelectOrderByItem> getColumns() {
|
||||
return indexDefinition.getColumns();
|
||||
}
|
||||
|
||||
public boolean isIfNotExists() {
|
||||
return ifNotExists;
|
||||
}
|
||||
|
||||
public void setIfNotExists(boolean ifNotExists) {
|
||||
this.ifNotExists = ifNotExists;
|
||||
}
|
||||
}
|
||||
|
||||
+7
@@ -608,6 +608,13 @@ public class PGSQLStatementParser extends SQLStatementParser {
|
||||
|
||||
accept(Token.INDEX);
|
||||
|
||||
if (lexer.token() == Token.IF) {
|
||||
lexer.nextToken();
|
||||
accept(Token.NOT);
|
||||
accept(Token.EXISTS);
|
||||
stmt.setIfNotExists(true);
|
||||
}
|
||||
|
||||
if (lexer.identifierEquals(FnvHash.Constants.CONCURRENTLY)) {
|
||||
lexer.nextToken();
|
||||
stmt.setConcurrently(true);
|
||||
|
||||
@@ -2401,6 +2401,10 @@ public class PGOutputVisitor extends SQLASTOutputVisitor implements PGASTVisitor
|
||||
|
||||
print0(ucase ? "INDEX" : "index");
|
||||
|
||||
if (x.isIfNotExists()) {
|
||||
print0(ucase ? " IF NOT EXISTS" : " if not exists");
|
||||
}
|
||||
|
||||
if (x.isConcurrently()) {
|
||||
print0(ucase ? " CONCURRENTLY" : " concurrently");
|
||||
}
|
||||
|
||||
@@ -3738,9 +3738,13 @@ public class SQLExprParser extends SQLParser {
|
||||
|
||||
if (lexer.token == Token.LPAREN) {
|
||||
lexer.nextToken();
|
||||
SQLExpr arg = this.expr();
|
||||
arg.setParent(charType);
|
||||
charType.addArgument(arg);
|
||||
if (typeNameHashCode == FnvHash.Constants.ENUM) {
|
||||
exprList(charType.getArguments(), charType);
|
||||
} else {
|
||||
SQLExpr arg = this.expr();
|
||||
arg.setParent(charType);
|
||||
charType.addArgument(arg);
|
||||
}
|
||||
accept(Token.RPAREN);
|
||||
}
|
||||
|
||||
@@ -3910,6 +3914,7 @@ public class SQLExprParser extends SQLParser {
|
||||
|| hash == FnvHash.Constants.TEXT
|
||||
|| hash == FnvHash.Constants.MEDIUMTEXT
|
||||
|| hash == FnvHash.Constants.LONGTEXT
|
||||
|| hash == FnvHash.Constants.ENUM
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user