This is an automated email from the ASF dual-hosted git repository.
panjuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new d99c07735e4 Remove useless PrivilegeType and ACLTypeEnum (#29637)
d99c07735e4 is described below
commit d99c07735e4e71b29220495d87c5d704fda8c2e4
Author: Liang Zhang <[email protected]>
AuthorDate: Wed Jan 3 13:48:31 2024 +0800
Remove useless PrivilegeType and ACLTypeEnum (#29637)
* Remove useless PrivilegeType
* Remove useless ACLTypeEnum
---
.../statement/type/MySQLDCLStatementVisitor.java | 82 +++++++++-----------
.../sql/common/segment/dcl/PrivilegeType.java | 90 ----------------------
.../sql/common/segment/generic/ACLTypeEnum.java | 26 -------
.../statement/mysql/dcl/MySQLGrantStatement.java | 3 +-
.../statement/mysql/dcl/MySQLRevokeStatement.java | 3 +-
.../mysql/segment/MySQLPrivilegeSegment.java | 3 +-
6 files changed, 38 insertions(+), 169 deletions(-)
diff --git
a/parser/sql/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/type/MySQLDCLStatementVisitor.java
b/parser/sql/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/type/MySQLDCLStatementVisitor.java
index f2a1d3b13d4..4a01bed445e 100644
---
a/parser/sql/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/type/MySQLDCLStatementVisitor.java
+++
b/parser/sql/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/type/MySQLDCLStatementVisitor.java
@@ -87,9 +87,7 @@ import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.StaticP
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.TlsOptionContext;
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.UsernameContext;
import
org.apache.shardingsphere.sql.parser.mysql.visitor.statement.MySQLStatementVisitor;
-import
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.ACLTypeEnum;
import
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.GrantLevelSegment;
-import
org.apache.shardingsphere.sql.parser.sql.common.segment.dcl.PrivilegeType;
import
org.apache.shardingsphere.sql.parser.sql.common.value.identifier.IdentifierValue;
import
org.apache.shardingsphere.sql.parser.sql.common.value.literal.impl.NumberLiteralValue;
import
org.apache.shardingsphere.sql.parser.sql.common.value.literal.impl.StringLiteralValue;
@@ -144,17 +142,7 @@ public final class MySQLDCLStatementVisitor extends
MySQLStatementVisitor implem
result.getUsers().add((UserSegment) visit(each));
}
if (null != ctx.aclType()) {
- switch (ctx.aclType().getText().toLowerCase()) {
- case "function":
- result.setAclType(ACLTypeEnum.FUNCTION);
- break;
- case "procedure":
- result.setAclType(ACLTypeEnum.PROCEDURE);
- break;
- default:
- result.setAclType(ACLTypeEnum.TABLE);
- break;
- }
+ result.setAclObject(ctx.aclType().getText().toUpperCase());
}
return result;
}
@@ -162,7 +150,7 @@ public final class MySQLDCLStatementVisitor extends
MySQLStatementVisitor implem
@Override
public ASTNode visitGrantProxy(final GrantProxyContext ctx) {
MySQLGrantStatement result = new MySQLGrantStatement();
- MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.PROXY().getSymbol().getStartIndex(),
ctx.PROXY().getSymbol().getStopIndex(), PrivilegeType.GRANT);
+ MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.PROXY().getSymbol().getStartIndex(),
ctx.PROXY().getSymbol().getStopIndex(), "GRANT");
result.getRoleOrPrivileges().add(new
MySQLRoleOrPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
null, null, privilege));
for (UsernameContext each : ctx.userList().username()) {
result.getUsers().add((UserSegment) visit(each));
@@ -215,7 +203,7 @@ public final class MySQLDCLStatementVisitor extends
MySQLStatementVisitor implem
@Override
public ASTNode visitStaticPrivilegeSelect(final
StaticPrivilegeSelectContext ctx) {
- MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PrivilegeType.SELECT);
+ MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
"SELECT");
if (null != ctx.columnNames()) {
for (ColumnNameContext each : ctx.columnNames().columnName()) {
privilege.getColumns().add(new
IdentifierValue(each.getText()).getValue());
@@ -226,7 +214,7 @@ public final class MySQLDCLStatementVisitor extends
MySQLStatementVisitor implem
@Override
public ASTNode visitStaticPrivilegeInsert(final
StaticPrivilegeInsertContext ctx) {
- MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PrivilegeType.INSERT);
+ MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
"INSERT");
if (null != ctx.columnNames()) {
for (ColumnNameContext each : ctx.columnNames().columnName()) {
privilege.getColumns().add(new
IdentifierValue(each.getText()).getValue());
@@ -237,7 +225,7 @@ public final class MySQLDCLStatementVisitor extends
MySQLStatementVisitor implem
@Override
public ASTNode visitStaticPrivilegeUpdate(final
StaticPrivilegeUpdateContext ctx) {
- MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PrivilegeType.UPDATE);
+ MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
"UPDATE");
if (null != ctx.columnNames()) {
for (ColumnNameContext each : ctx.columnNames().columnName()) {
privilege.getColumns().add(new
IdentifierValue(each.getText()).getValue());
@@ -248,7 +236,7 @@ public final class MySQLDCLStatementVisitor extends
MySQLStatementVisitor implem
@Override
public ASTNode visitStaticPrivilegeReferences(final
StaticPrivilegeReferencesContext ctx) {
- MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PrivilegeType.REFERENCES);
+ MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
"REFERENCES");
if (null != ctx.columnNames()) {
for (ColumnNameContext each : ctx.columnNames().columnName()) {
privilege.getColumns().add(new
IdentifierValue(each.getText()).getValue());
@@ -259,169 +247,169 @@ public final class MySQLDCLStatementVisitor extends
MySQLStatementVisitor implem
@Override
public ASTNode visitStaticPrivilegeDelete(final
StaticPrivilegeDeleteContext ctx) {
- MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PrivilegeType.DELETE);
+ MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
"DELETE");
return new MySQLRoleOrPrivilegeSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), null, null, privilege);
}
@Override
public ASTNode visitStaticPrivilegeUsage(final StaticPrivilegeUsageContext
ctx) {
- MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PrivilegeType.USAGE);
+ MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
"USAGE");
return new MySQLRoleOrPrivilegeSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), null, null, privilege);
}
@Override
public ASTNode visitStaticPrivilegeIndex(final StaticPrivilegeIndexContext
ctx) {
- MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PrivilegeType.INDEX);
+ MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
"INDEX");
return new MySQLRoleOrPrivilegeSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), null, null, privilege);
}
@Override
public ASTNode visitStaticPrivilegeAlter(final StaticPrivilegeAlterContext
ctx) {
- MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PrivilegeType.ALTER);
+ MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
"ALTER");
return new MySQLRoleOrPrivilegeSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), null, null, privilege);
}
@Override
public ASTNode visitStaticPrivilegeCreate(final
StaticPrivilegeCreateContext ctx) {
- MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PrivilegeType.CREATE);
+ MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
"CREATE");
return new MySQLRoleOrPrivilegeSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), null, null, privilege);
}
@Override
public ASTNode visitStaticPrivilegeDrop(final StaticPrivilegeDropContext
ctx) {
- MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PrivilegeType.DROP);
+ MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
"DROP");
return new MySQLRoleOrPrivilegeSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), null, null, privilege);
}
@Override
public ASTNode visitStaticPrivilegeExecute(final
StaticPrivilegeExecuteContext ctx) {
- MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PrivilegeType.EXECUTE);
+ MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
"EXECUTE");
return new MySQLRoleOrPrivilegeSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), null, null, privilege);
}
@Override
public ASTNode visitStaticPrivilegeReload(final
StaticPrivilegeReloadContext ctx) {
- MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PrivilegeType.RELOAD);
+ MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
"RELOAD");
return new MySQLRoleOrPrivilegeSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), null, null, privilege);
}
@Override
public ASTNode visitStaticPrivilegeShutdown(final
StaticPrivilegeShutdownContext ctx) {
- MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PrivilegeType.SHUTDOWN);
+ MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
"SHUTDOWN");
return new MySQLRoleOrPrivilegeSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), null, null, privilege);
}
@Override
public ASTNode visitStaticPrivilegeProcess(final
StaticPrivilegeProcessContext ctx) {
- MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PrivilegeType.PROCESS);
+ MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
"PROCESS");
return new MySQLRoleOrPrivilegeSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), null, null, privilege);
}
@Override
public ASTNode visitStaticPrivilegeFile(final StaticPrivilegeFileContext
ctx) {
- MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PrivilegeType.FILE);
+ MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
"FILE");
return new MySQLRoleOrPrivilegeSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), null, null, privilege);
}
@Override
public ASTNode visitStaticPrivilegeGrant(final StaticPrivilegeGrantContext
ctx) {
- MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PrivilegeType.GRANT);
+ MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
"GRANT");
return new MySQLRoleOrPrivilegeSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), null, null, privilege);
}
@Override
public ASTNode visitStaticPrivilegeShowDatabases(final
StaticPrivilegeShowDatabasesContext ctx) {
- MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PrivilegeType.SHOW_DB);
+ MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
"SHOW_DB");
return new MySQLRoleOrPrivilegeSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), null, null, privilege);
}
@Override
public ASTNode visitStaticPrivilegeSuper(final StaticPrivilegeSuperContext
ctx) {
- MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PrivilegeType.SUPER);
+ MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
"SUPER");
return new MySQLRoleOrPrivilegeSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), null, null, privilege);
}
@Override
public ASTNode visitStaticPrivilegeCreateTemporaryTables(final
StaticPrivilegeCreateTemporaryTablesContext ctx) {
- MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PrivilegeType.CREATE_TMP);
+ MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
"CREATE_TMP");
return new MySQLRoleOrPrivilegeSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), null, null, privilege);
}
@Override
public ASTNode visitStaticPrivilegeLockTables(final
StaticPrivilegeLockTablesContext ctx) {
- MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PrivilegeType.LOCK_TABLES);
+ MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
"LOCK_TABLES");
return new MySQLRoleOrPrivilegeSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), null, null, privilege);
}
@Override
public ASTNode visitStaticPrivilegeReplicationSlave(final
StaticPrivilegeReplicationSlaveContext ctx) {
- MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PrivilegeType.REPL_SLAVE);
+ MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
"REPL_SLAVE");
return new MySQLRoleOrPrivilegeSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), null, null, privilege);
}
@Override
public ASTNode visitStaticPrivilegeReplicationClient(final
StaticPrivilegeReplicationClientContext ctx) {
- MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PrivilegeType.REPL_CLIENT);
+ MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
"REPL_CLIENT");
return new MySQLRoleOrPrivilegeSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), null, null, privilege);
}
@Override
public ASTNode visitStaticPrivilegeCreateView(final
StaticPrivilegeCreateViewContext ctx) {
- MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PrivilegeType.CREATE_VIEW);
+ MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
"CREATE_VIEW");
return new MySQLRoleOrPrivilegeSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), null, null, privilege);
}
@Override
public ASTNode visitStaticPrivilegeShowView(final
StaticPrivilegeShowViewContext ctx) {
- MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PrivilegeType.SHOW_VIEW);
+ MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
"SHOW_VIEW");
return new MySQLRoleOrPrivilegeSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), null, null, privilege);
}
@Override
public ASTNode visitStaticPrivilegeCreateRoutine(final
StaticPrivilegeCreateRoutineContext ctx) {
- MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PrivilegeType.CREATE_PROC);
+ MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
"CREATE_PROC");
return new MySQLRoleOrPrivilegeSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), null, null, privilege);
}
@Override
public ASTNode visitStaticPrivilegeAlterRoutine(final
StaticPrivilegeAlterRoutineContext ctx) {
- MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PrivilegeType.ALTER_PROC);
+ MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
"ALTER_PROC");
return new MySQLRoleOrPrivilegeSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), null, null, privilege);
}
@Override
public ASTNode visitStaticPrivilegeCreateUser(final
StaticPrivilegeCreateUserContext ctx) {
- MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PrivilegeType.CREATE_USER);
+ MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
"CREATE_USER");
return new MySQLRoleOrPrivilegeSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), null, null, privilege);
}
@Override
public ASTNode visitStaticPrivilegeEvent(final StaticPrivilegeEventContext
ctx) {
- MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PrivilegeType.EVENT);
+ MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
"EVENT");
return new MySQLRoleOrPrivilegeSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), null, null, privilege);
}
@Override
public ASTNode visitStaticPrivilegeTrigger(final
StaticPrivilegeTriggerContext ctx) {
- MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PrivilegeType.TRIGGER);
+ MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
"TRIGGER");
return new MySQLRoleOrPrivilegeSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), null, null, privilege);
}
@Override
public ASTNode visitStaticPrivilegeCreateTablespace(final
StaticPrivilegeCreateTablespaceContext ctx) {
- MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PrivilegeType.CREATE_TABLESPACE);
+ MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
"CREATE_TABLESPACE");
return new MySQLRoleOrPrivilegeSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), null, null, privilege);
}
@Override
public ASTNode visitStaticPrivilegeCreateRole(final
StaticPrivilegeCreateRoleContext ctx) {
- MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PrivilegeType.CREATE_ROLE);
+ MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
"CREATE_ROLE");
return new MySQLRoleOrPrivilegeSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), null, null, privilege);
}
@Override
public ASTNode visitStaticPrivilegeDropRole(final
StaticPrivilegeDropRoleContext ctx) {
- MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PrivilegeType.DROP_ROLE);
+ MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
"DROP_ROLE");
return new MySQLRoleOrPrivilegeSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), null, null, privilege);
}
@@ -447,7 +435,7 @@ public final class MySQLDCLStatementVisitor extends
MySQLStatementVisitor implem
} else if (null != ctx.ALL()) {
result.setAllPrivileges(true);
} else if (null != ctx.PROXY()) {
- MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PrivilegeType.DROP_ROLE);
+ MySQLPrivilegeSegment privilege = new
MySQLPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
"DROP_ROLE");
result.getRoleOrPrivileges().add(new
MySQLRoleOrPrivilegeSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
null, null, privilege));
result.setOnUser((UserSegment) visit(ctx.username()));
}
diff --git
a/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/segment/dcl/PrivilegeType.java
b/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/segment/dcl/PrivilegeType.java
deleted file mode 100644
index 5da2f251d4c..00000000000
---
a/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/segment/dcl/PrivilegeType.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sql.parser.sql.common.segment.dcl;
-
-/**
- * Privilege type.
- */
-public enum PrivilegeType {
-
- SELECT,
-
- INSERT,
-
- UPDATE,
-
- DELETE,
-
- USAGE,
-
- CREATE,
-
- DROP,
-
- RELOAD,
-
- SHUTDOWN,
-
- PROCESS,
-
- FILE,
-
- GRANT,
-
- REFERENCES,
-
- INDEX,
-
- ALTER,
-
- SHOW_DB,
-
- SUPER,
-
- CREATE_TMP,
-
- LOCK_TABLES,
-
- EXECUTE,
-
- REPL_SLAVE,
-
- REPL_CLIENT,
-
- CREATE_VIEW,
-
- SHOW_VIEW,
-
- CREATE_PROC,
-
- ALTER_PROC,
-
- CREATE_USER,
-
- DROP_USER,
-
- EVENT,
-
- TRIGGER,
-
- CREATE_TABLESPACE,
-
- CREATE_ROLE,
-
- DROP_ROLE
-}
diff --git
a/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/segment/generic/ACLTypeEnum.java
b/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/segment/generic/ACLTypeEnum.java
deleted file mode 100644
index ebd930ff6fa..00000000000
---
a/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/segment/generic/ACLTypeEnum.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sql.parser.sql.common.segment.generic;
-
-/**
- * ACL type enum.
- */
-public enum ACLTypeEnum {
-
- TABLE, FUNCTION, PROCEDURE
-}
diff --git
a/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/dcl/MySQLGrantStatement.java
b/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/dcl/MySQLGrantStatement.java
index dc65196b33b..2cfa559d865 100644
---
a/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/dcl/MySQLGrantStatement.java
+++
b/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/dcl/MySQLGrantStatement.java
@@ -19,7 +19,6 @@ package
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dcl;
import lombok.Getter;
import lombok.Setter;
-import
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.ACLTypeEnum;
import
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.GrantLevelSegment;
import
org.apache.shardingsphere.sql.parser.sql.common.statement.dcl.GrantStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.MySQLStatement;
@@ -42,7 +41,7 @@ public final class MySQLGrantStatement extends GrantStatement
implements MySQLSt
private final Collection<UserSegment> users = new LinkedList<>();
- private ACLTypeEnum aclType;
+ private String aclObject;
private GrantLevelSegment level;
}
diff --git
a/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/dcl/MySQLRevokeStatement.java
b/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/dcl/MySQLRevokeStatement.java
index 6b819fc23e1..e6a14d0736d 100644
---
a/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/dcl/MySQLRevokeStatement.java
+++
b/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/dcl/MySQLRevokeStatement.java
@@ -19,7 +19,6 @@ package
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dcl;
import lombok.Getter;
import lombok.Setter;
-import
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.ACLTypeEnum;
import
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.GrantLevelSegment;
import
org.apache.shardingsphere.sql.parser.sql.common.statement.dcl.RevokeStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.MySQLStatement;
@@ -44,7 +43,7 @@ public final class MySQLRevokeStatement extends
RevokeStatement implements MySQL
private final Collection<UserSegment> fromUsers = new LinkedList<>();
- private ACLTypeEnum aclType;
+ private String aclObject;
private GrantLevelSegment level;
}
diff --git
a/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/segment/MySQLPrivilegeSegment.java
b/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/segment/MySQLPrivilegeSegment.java
index 557a0c9b3de..1ff5595994d 100644
---
a/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/segment/MySQLPrivilegeSegment.java
+++
b/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/segment/MySQLPrivilegeSegment.java
@@ -20,7 +20,6 @@ package
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.segment
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.sql.parser.sql.common.segment.SQLSegment;
-import
org.apache.shardingsphere.sql.parser.sql.common.segment.dcl.PrivilegeType;
import java.util.Collection;
import java.util.LinkedList;
@@ -36,7 +35,7 @@ public final class MySQLPrivilegeSegment implements
SQLSegment {
private final int stopIndex;
- private final PrivilegeType type;
+ private final String privilegeType;
private final Collection<String> columns = new LinkedList<>();
}