This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang 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 a0dc7e3 support parse mysql administration statements sql SHOW
TRIGGERS.(#13143) (#13629)
a0dc7e3 is described below
commit a0dc7e3bc5e79140bd94fdc6fd76143df32a09a3
Author: clbigdata <[email protected]>
AuthorDate: Tue Nov 23 09:08:17 2021 +0800
support parse mysql administration statements sql SHOW TRIGGERS.(#13143)
(#13629)
* support parse mysql administration statements sql SHOW TRIGGERS.(#13143)
* support parse mysql administration statements sql SHOW TRIGGERS(#13143)
* support parse mysql administration statements sql SHOW TRIGGERS(#13143)
* support parse mysql administration statements sql SHOW TRIGGERS(#13143)
* support parse mysql administration statements sql SHOW TRIGGERS(#13143)
* support parse mysql administration statements sql SHOW TRIGGERS(#13143)
* support parse mysql administration statements sql SHOW TRIGGERS(#13143)
* support parse mysql administration statements sql SHOW TRIGGERS(#13143)
* support parse mysql administration statements sql SHOW TRIGGERS(#13143)
* support parse mysql administration statements sql SHOW TRIGGERS(#13143)
* support parse mysql administration statements sql SHOW TRIGGERS(#13143)
---
.../src/main/antlr4/imports/mysql/DALStatement.g4 | 6 +-
.../impl/MySQLDALStatementSQLVisitor.java | 18 +++++-
.../core/database/visitor/SQLVisitorRule.java | 2 +
.../mysql/dal/MySQLShowTriggersStatement.java | 58 +++++++++++++++++++
.../asserts/statement/dal/DALStatementAssert.java | 9 ++-
.../dal/impl/ShowTriggersStatementAssert.java | 65 ++++++++++++++++++++++
.../jaxb/cases/domain/SQLParserTestCases.java | 11 +++-
.../dal/ShowTriggersStatementTestCase.java | 40 +++++++++++++
.../src/main/resources/case/dal/show.xml | 4 ++
.../src/main/resources/sql/supported/dal/show.xml | 1 +
10 files changed, 205 insertions(+), 9 deletions(-)
diff --git
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/DALStatement.g4
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/DALStatement.g4
index 1677321..06d3f75 100644
---
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/DALStatement.g4
+++
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/DALStatement.g4
@@ -230,8 +230,8 @@ showStatus
: SHOW (GLOBAL | SESSION)? STATUS showFilter?
;
-showTrriggers
- : SHOW TRIGGER fromSchema? showFilter?
+showTriggers
+ : SHOW TRIGGERS fromSchema? showFilter?
;
showVariables
@@ -456,7 +456,7 @@ show
| showSlaveStatus
| showRelaylogEvent
| showStatus
- | showTrriggers
+ | showTriggers
| showWarnings
| showVariables
| showReplicas
diff --git
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDALStatementSQLVisitor.java
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDALStatementSQLVisitor.java
index 83d7ecb..834f54a 100644
---
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDALStatementSQLVisitor.java
+++
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDALStatementSQLVisitor.java
@@ -92,6 +92,7 @@ import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.ShowSla
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.ShowStatusContext;
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.ShowTableStatusContext;
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.ShowTablesContext;
+import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.ShowTriggersContext;
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.ShowVariablesContext;
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.ShowWarningsContext;
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.ShowWhereClauseContext;
@@ -168,6 +169,7 @@ import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQ
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLShowStatusStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLShowTableStatusStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLShowTablesStatement;
+import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLShowTriggersStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLShowWarningsStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLShutdownStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLUninstallComponentStatement;
@@ -557,7 +559,21 @@ public final class MySQLDALStatementSQLVisitor extends
MySQLStatementSQLVisitor
}
return result;
}
-
+
+ @Override
+ public ASTNode visitShowTriggers(final ShowTriggersContext ctx) {
+ MySQLShowTriggersStatement result = new MySQLShowTriggersStatement();
+ if (null != ctx.fromSchema()) {
+ result.setFromSchema((FromSchemaSegment) visit(ctx.fromSchema()));
+ }
+ if (null != ctx.showFilter()) {
+ if (null != ctx.showFilter().showLike()) {
+ result.setLike((ShowLikeSegment)
visit(ctx.showFilter().showLike()));
+ }
+ }
+ return result;
+ }
+
@Override
public ASTNode visitShowWhereClause(final ShowWhereClauseContext ctx) {
return new WhereSegment(ctx.getStart().getStartIndex(),
ctx.getStop().getStopIndex(), (ExpressionSegment) visit(ctx.expr()));
diff --git
a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
index 0c33734..27c7be7 100644
---
a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
+++
b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
@@ -256,6 +256,8 @@ public enum SQLVisitorRule {
SHOW_PROCEDURE_CODE("ShowProcedureCodeStatement", SQLStatementType.DAL),
+ SHOW_TRIGGERS("ShowTriggers", SQLStatementType.DAL),
+
SET_VARIABLE("SetVariable", SQLStatementType.DAL),
SET("Set", SQLStatementType.DAL),
diff --git
a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/dal/MySQLShowTriggersStatement.java
b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/dal/MySQLShowTriggersStatement.java
new file mode 100644
index 0000000..88e4194
--- /dev/null
+++
b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/dal/MySQLShowTriggersStatement.java
@@ -0,0 +1,58 @@
+/*
+ * 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.dialect.statement.mysql.dal;
+
+import lombok.Setter;
+import lombok.ToString;
+import
org.apache.shardingsphere.sql.parser.sql.common.segment.dal.FromSchemaSegment;
+import
org.apache.shardingsphere.sql.parser.sql.common.segment.dal.ShowLikeSegment;
+import
org.apache.shardingsphere.sql.parser.sql.common.statement.AbstractSQLStatement;
+import
org.apache.shardingsphere.sql.parser.sql.common.statement.dal.DALStatement;
+import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.MySQLStatement;
+
+import java.util.Optional;
+
+/**
+ * MySQL show triggers status statement.
+ */
+@Setter
+@ToString
+public final class MySQLShowTriggersStatement extends AbstractSQLStatement
implements DALStatement, MySQLStatement {
+
+ private FromSchemaSegment fromSchema;
+
+ private ShowLikeSegment like;
+
+ /**
+ * Get from schema segment.
+ *
+ * @return from schema segment
+ */
+ public Optional<FromSchemaSegment> getFromSchema() {
+ return Optional.ofNullable(fromSchema);
+ }
+
+ /**
+ * Get like segment.
+ *
+ * @return like segment
+ */
+ public Optional<ShowLikeSegment> getLike() {
+ return Optional.ofNullable(like);
+ }
+}
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dal/DALStatementAssert.java
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dal/DALStatementAssert.java
index 334c0cb..040a42c 100644
---
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dal/DALStatementAssert.java
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dal/DALStatementAssert.java
@@ -54,6 +54,7 @@ import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQ
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLShowTableStatusStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLShowTablesStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLShutdownStatement;
+import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLShowTriggersStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLUninstallComponentStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLUninstallPluginStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLUseStatement;
@@ -82,6 +83,7 @@ import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dal.impl.ShowCreateTriggerStatementAssert;
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dal.impl.ShowCreateUserStatementAssert;
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dal.impl.ShowDatabasesStatementAssert;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dal.impl.ShutdownStatementAssert;
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dal.impl.ShowFunctionStatusStatementAssert;
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dal.impl.ShowIndexStatementAssert;
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dal.impl.ShowProcedureCodeStatementAssert;
@@ -94,7 +96,7 @@ import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dal.impl.ShowStatementAssert;
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dal.impl.ShowTableStatusStatementAssert;
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dal.impl.ShowTablesStatementAssert;
-import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dal.impl.ShutdownStatementAssert;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dal.impl.ShowTriggersStatementAssert;
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dal.impl.UninstallComponentStatementAssert;
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dal.impl.UninstallPluginStatementAssert;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;
@@ -120,6 +122,7 @@ import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.ShowCreateTriggerStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.ShowCreateUserStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.ShowDatabasesStatementTestCase;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.ShutdownStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.ShowFunctionStatusStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.ShowIndexStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.ShowProcedureCodeStatementTestCase;
@@ -132,7 +135,7 @@ import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.ShowStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.ShowTableStatusStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.ShowTablesStatementTestCase;
-import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.ShutdownStatementTestCase;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.ShowTriggersStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.UninstallComponentStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.UninstallPluginStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.UseStatementTestCase;
@@ -227,6 +230,8 @@ public final class DALStatementAssert {
LoadIndexInfoStatementAssert.assertIs(assertContext,
(MySQLLoadIndexInfoStatement) actual, (LoadIndexInfoStatementTestCase)
expected);
} else if (actual instanceof MySQLShutdownStatement) {
ShutdownStatementAssert.assertIs(assertContext,
(MySQLShutdownStatement) actual, (ShutdownStatementTestCase) expected);
+ } else if (actual instanceof MySQLShowTriggersStatement) {
+ ShowTriggersStatementAssert.assertIs(assertContext,
(MySQLShowTriggersStatement) actual, (ShowTriggersStatementTestCase) expected);
}
}
}
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dal/impl/ShowTriggersStatementAssert.java
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dal/impl/ShowTriggersStatementAssert.java
new file mode 100644
index 0000000..fe59907
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dal/impl/ShowTriggersStatementAssert.java
@@ -0,0 +1,65 @@
+/*
+ * 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.test.sql.parser.parameterized.asserts.statement.dal.impl;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLShowTriggersStatement;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.segment.SQLSegmentAssert;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.ShowTriggersStatementTestCase;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Show triggers statement assert.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class ShowTriggersStatementAssert {
+
+ /**
+ * Assert show triggers statement is correct with expected parser result.
+ *
+ * @param assertContext assert context
+ * @param actual actual show triggers statement
+ * @param expected expected show tables statement test case
+ */
+ public static void assertIs(final SQLCaseAssertContext assertContext,
final MySQLShowTriggersStatement actual, final ShowTriggersStatementTestCase
expected) {
+ assertSchema(assertContext, actual, expected);
+ assertLike(assertContext, actual, expected);
+ }
+
+ private static void assertSchema(final SQLCaseAssertContext assertContext,
final MySQLShowTriggersStatement actual, final ShowTriggersStatementTestCase
expected) {
+ if (null != expected.getSchema()) {
+ assertTrue(assertContext.getText("Actual schema should exist."),
actual.getFromSchema().isPresent());
+ SQLSegmentAssert.assertIs(assertContext,
actual.getFromSchema().get(), expected.getSchema());
+ } else {
+ assertFalse(assertContext.getText("Actual schema should not
exist."), actual.getFromSchema().isPresent());
+ }
+ }
+
+ private static void assertLike(final SQLCaseAssertContext assertContext,
final MySQLShowTriggersStatement actual, final ShowTriggersStatementTestCase
expected) {
+ if (null != expected.getLike()) {
+ assertTrue(assertContext.getText("Actual like should exist."),
actual.getLike().isPresent());
+ SQLSegmentAssert.assertIs(assertContext, actual.getLike().get(),
expected.getLike());
+ } else {
+ assertFalse(assertContext.getText("Actual like should not
exist."), actual.getLike().isPresent());
+ }
+ }
+}
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
index d7b5a65..64240f8 100644
---
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
@@ -54,6 +54,7 @@ import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.ShowStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.ShowTableStatusStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.ShowTablesStatementTestCase;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.ShowTriggersStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.ShutdownStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.UninstallComponentStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.UninstallPluginStatementTestCase;
@@ -433,7 +434,10 @@ public final class SQLParserTestCases {
@XmlElement(name = "drop-trigger")
private final List<DropTriggerStatementTestCase> dropTriggerTestCase = new
LinkedList<>();
-
+
+ @XmlElement(name = "show-triggers")
+ private final List<ShowTriggersStatementTestCase> showTriggerTestCase =
new LinkedList<>();
+
@XmlElement(name = "drop-view")
private final List<DropViewStatementTestCase> dropViewTestCase = new
LinkedList<>();
@@ -697,7 +701,7 @@ public final class SQLParserTestCases {
@XmlElement(name = "uninstall-component")
private final List<UninstallComponentStatementTestCase>
uninstallComponentStatementTestCases = new LinkedList<>();
-
+
@XmlElement(name = "uninstall-plugin")
private final List<UninstallPluginStatementTestCase>
uninstallPluginStatementTestCases = new LinkedList<>();
@@ -754,7 +758,7 @@ public final class SQLParserTestCases {
@XmlElement(name = "shutdown")
private final List<ShutdownStatementTestCase> shutdownStatementTestCases =
new LinkedList<>();
-
+
@XmlElement(name = "create-default-single-table")
private final List<CreateDefaultSingleTableRuleStatementTestCase>
createDefaultSingleTableRuleStatementTestCases = new LinkedList<>();
@@ -839,6 +843,7 @@ public final class SQLParserTestCases {
putAll(createDatabaseTestCase, result);
putAll(dropViewTestCase, result);
putAll(dropTriggerTestCase, result);
+ putAll(showTriggerTestCase, result);
putAll(dropServerTestCase, result);
putAll(dropProcedureTestCase, result);
putAll(dropFunctionTestCase, result);
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/ShowTriggersStatementTestCase.java
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/ShowTriggersStatementTestCase.java
new file mode 100644
index 0000000..4fa2acf
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/ShowTriggersStatementTestCase.java
@@ -0,0 +1,40 @@
+/*
+ * 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.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal;
+
+import lombok.Getter;
+import lombok.Setter;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.like.ExpectedLikeClause;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.schema.ExpectedSchema;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;
+
+import javax.xml.bind.annotation.XmlElement;
+
+/**
+ * show triggers statement test case.
+ */
+@Getter
+@Setter
+public final class ShowTriggersStatementTestCase extends SQLParserTestCase {
+
+ @XmlElement
+ private ExpectedSchema schema;
+
+ @XmlElement
+ private ExpectedLikeClause like;
+}
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dal/show.xml
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dal/show.xml
index 006c37a..9cdfa4f 100644
---
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dal/show.xml
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dal/show.xml
@@ -269,4 +269,8 @@
<show-replica-status sql-case-id="show_replica_status_with_channel"
channel="TEST_CHANNEL"/>
<show-slave-status sql-case-id="show_slave_status" />
<show-slave-status sql-case-id="show_slave_status_with_channel"
channel="TEST_CHANNEL" />
+ <show-triggers sql-case-id="show_triggers_with_filter">
+ <schema name="sharding_db" start-delimiter="`" end-delimiter="`"
start-index="14" stop-index="31" />
+ <like pattern="acc%" start-index="33" stop-index="43"/>
+ </show-triggers>
</sql-parser-test-cases>
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/dal/show.xml
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/dal/show.xml
index 861416b..b479426 100644
---
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/dal/show.xml
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/dal/show.xml
@@ -60,4 +60,5 @@
<sql-case id="show_replica_status_with_channel" value="SHOW REPLICA STATUS
FOR CHANNEL TEST_CHANNEL" db-types="MySQL" />
<sql-case id="show_slave_status" value="SHOW SLAVE STATUS"
db-types="MySQL" />
<sql-case id="show_slave_status_with_channel" value="SHOW SLAVE STATUS FOR
CHANNEL TEST_CHANNEL" db-types="MySQL" />
+ <sql-case id="show_triggers_with_filter" value="SHOW TRIGGERS FROM
`sharding_db` LIKE 'acc%'" db-types="MySQL"/>
</sql-cases>