This is an automated email from the ASF dual-hosted git repository. zhangliang 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 177b9215a63 Rename and move MySQLShowCreateTableStatement (#35787) 177b9215a63 is described below commit 177b9215a6377302c7e79556784225f2773327f2 Author: Liang Zhang <zhangli...@apache.org> AuthorDate: Wed Jun 25 15:26:42 2025 +0800 Rename and move MySQLShowCreateTableStatement (#35787) --- .../merge/mysql/MySQLShardingDALResultMerger.java | 6 +- .../mysql/MySQLShardingDALResultMergerTest.java | 6 +- .../MySQLSQLStatementContextWarpProvider.java | 8 +- .../binder/mysql/bind/MySQLSQLBindEngine.java | 6 +- .../type/MySQLShowCreateTableStatementBinder.java | 10 +- .../statement/type/DorisDALStatementVisitor.java | 12 +-- .../statement/type/MySQLDALStatementVisitor.java | 102 ++++++++++----------- .../show/table/MySQLShowCreateTableStatement.java} | 7 +- .../binary/prepare/MySQLComStmtPrepareChecker.java | 48 +++++----- .../prepare/MySQLComStmtPrepareCheckerTest.java | 32 +++---- .../asserts/statement/dal/DALStatementAssert.java | 14 +-- .../dal/impl/ShowCreateTableStatementAssert.java | 4 +- 12 files changed, 128 insertions(+), 127 deletions(-) diff --git a/features/sharding/dialect/mysql/src/main/java/org/apache/shardingsphere/sharding/merge/mysql/MySQLShardingDALResultMerger.java b/features/sharding/dialect/mysql/src/main/java/org/apache/shardingsphere/sharding/merge/mysql/MySQLShardingDALResultMerger.java index e2b86e04504..bccb23c4458 100644 --- a/features/sharding/dialect/mysql/src/main/java/org/apache/shardingsphere/sharding/merge/mysql/MySQLShardingDALResultMerger.java +++ b/features/sharding/dialect/mysql/src/main/java/org/apache/shardingsphere/sharding/merge/mysql/MySQLShardingDALResultMerger.java @@ -30,11 +30,11 @@ import org.apache.shardingsphere.sharding.merge.mysql.type.MySQLShardingShowInde import org.apache.shardingsphere.sharding.merge.mysql.type.MySQLShardingShowTableStatusMergedResult; import org.apache.shardingsphere.sharding.rule.ShardingRule; import org.apache.shardingsphere.sql.parser.statement.core.statement.SQLStatement; -import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ShowCreateTableStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ShowDatabasesStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.index.MySQLShowIndexStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ShowTableStatusStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ShowTablesStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.index.MySQLShowIndexStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.table.MySQLShowCreateTableStatement; import java.sql.SQLException; import java.util.Collections; @@ -62,7 +62,7 @@ public final class MySQLShardingDALResultMerger implements DialectShardingDALRes if (dalStatement instanceof MySQLShowIndexStatement) { return Optional.of(new MySQLShardingShowIndexMergedResult(rule, sqlStatementContext, schema, queryResults)); } - if (dalStatement instanceof ShowCreateTableStatement) { + if (dalStatement instanceof MySQLShowCreateTableStatement) { return Optional.of(new MySQLShardingShowCreateTableMergedResult(rule, sqlStatementContext, schema, queryResults)); } return Optional.empty(); diff --git a/features/sharding/dialect/mysql/src/test/java/org/apache/shardingsphere/sharding/merge/mysql/MySQLShardingDALResultMergerTest.java b/features/sharding/dialect/mysql/src/test/java/org/apache/shardingsphere/sharding/merge/mysql/MySQLShardingDALResultMergerTest.java index 2cdf125da60..9971322d696 100644 --- a/features/sharding/dialect/mysql/src/test/java/org/apache/shardingsphere/sharding/merge/mysql/MySQLShardingDALResultMergerTest.java +++ b/features/sharding/dialect/mysql/src/test/java/org/apache/shardingsphere/sharding/merge/mysql/MySQLShardingDALResultMergerTest.java @@ -30,11 +30,11 @@ import org.apache.shardingsphere.sharding.merge.mysql.type.MySQLShardingShowCrea import org.apache.shardingsphere.sharding.merge.mysql.type.MySQLShardingShowIndexMergedResult; import org.apache.shardingsphere.sharding.merge.mysql.type.MySQLShardingShowTableStatusMergedResult; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.DALStatement; -import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ShowCreateTableStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ShowDatabasesStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.index.MySQLShowIndexStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ShowTableStatusStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ShowTablesStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.index.MySQLShowIndexStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.table.MySQLShowCreateTableStatement; import org.junit.jupiter.api.Test; import java.sql.SQLException; @@ -91,7 +91,7 @@ class MySQLShardingDALResultMergerTest { @Test void assertMergeForShowCreateTableStatement() throws SQLException { - SQLStatementContext sqlStatementContext = mockSQLStatementContext(mock(ShowCreateTableStatement.class)); + SQLStatementContext sqlStatementContext = mockSQLStatementContext(mock(MySQLShowCreateTableStatement.class)); Optional<MergedResult> actual = resultMerger.merge("foo_db", mock(), sqlStatementContext, mock(), queryResults); assertTrue(actual.isPresent()); assertThat(actual.get(), instanceOf(MySQLShardingShowCreateTableMergedResult.class)); diff --git a/infra/binder/dialect/mysql/src/main/java/org/apache/shardingsphere/infra/binder/mysql/MySQLSQLStatementContextWarpProvider.java b/infra/binder/dialect/mysql/src/main/java/org/apache/shardingsphere/infra/binder/mysql/MySQLSQLStatementContextWarpProvider.java index 429af25737c..e55256ba2fc 100644 --- a/infra/binder/dialect/mysql/src/main/java/org/apache/shardingsphere/infra/binder/mysql/MySQLSQLStatementContextWarpProvider.java +++ b/infra/binder/dialect/mysql/src/main/java/org/apache/shardingsphere/infra/binder/mysql/MySQLSQLStatementContextWarpProvider.java @@ -19,12 +19,12 @@ package org.apache.shardingsphere.infra.binder.mysql; import org.apache.shardingsphere.infra.binder.context.DialectCommonSQLStatementContextWarpProvider; import org.apache.shardingsphere.sql.parser.statement.core.statement.SQLStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLOptimizeTableStatement; -import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ShowCreateTableStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dml.LoadDataStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dml.LoadXMLStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.column.MySQLDescribeStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLFlushStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLOptimizeTableStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.column.MySQLDescribeStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.table.MySQLShowCreateTableStatement; import java.util.Arrays; import java.util.Collection; @@ -35,7 +35,7 @@ import java.util.Collection; public final class MySQLSQLStatementContextWarpProvider implements DialectCommonSQLStatementContextWarpProvider { private static final Collection<Class<? extends SQLStatement>> NEED_TO_WARP_SQL_STATEMENT_TYPES = Arrays.asList( - ShowCreateTableStatement.class, MySQLFlushStatement.class, MySQLOptimizeTableStatement.class, MySQLDescribeStatement.class, LoadDataStatement.class, LoadXMLStatement.class); + MySQLShowCreateTableStatement.class, MySQLFlushStatement.class, MySQLOptimizeTableStatement.class, MySQLDescribeStatement.class, LoadDataStatement.class, LoadXMLStatement.class); @Override public Collection<Class<? extends SQLStatement>> getNeedToWarpSQLStatementTypes() { diff --git a/infra/binder/dialect/mysql/src/main/java/org/apache/shardingsphere/infra/binder/mysql/bind/MySQLSQLBindEngine.java b/infra/binder/dialect/mysql/src/main/java/org/apache/shardingsphere/infra/binder/mysql/bind/MySQLSQLBindEngine.java index fa5ef0f34b9..82a276f75c4 100644 --- a/infra/binder/dialect/mysql/src/main/java/org/apache/shardingsphere/infra/binder/mysql/bind/MySQLSQLBindEngine.java +++ b/infra/binder/dialect/mysql/src/main/java/org/apache/shardingsphere/infra/binder/mysql/bind/MySQLSQLBindEngine.java @@ -26,8 +26,8 @@ import org.apache.shardingsphere.infra.binder.mysql.bind.type.MySQLShowIndexStat import org.apache.shardingsphere.sql.parser.statement.core.statement.SQLStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLOptimizeTableStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.column.MySQLShowColumnsStatement; -import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ShowCreateTableStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.index.MySQLShowIndexStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.table.MySQLShowCreateTableStatement; import java.util.Optional; @@ -41,8 +41,8 @@ public final class MySQLSQLBindEngine implements DialectSQLBindEngine { if (sqlStatement instanceof MySQLOptimizeTableStatement) { return Optional.of(new MySQLOptimizeTableStatementBinder().bind((MySQLOptimizeTableStatement) sqlStatement, binderContext)); } - if (sqlStatement instanceof ShowCreateTableStatement) { - return Optional.of(new MySQLShowCreateTableStatementBinder().bind((ShowCreateTableStatement) sqlStatement, binderContext)); + if (sqlStatement instanceof MySQLShowCreateTableStatement) { + return Optional.of(new MySQLShowCreateTableStatementBinder().bind((MySQLShowCreateTableStatement) sqlStatement, binderContext)); } if (sqlStatement instanceof MySQLShowColumnsStatement) { return Optional.of(new MySQLShowColumnsStatementBinder().bind((MySQLShowColumnsStatement) sqlStatement, binderContext)); diff --git a/infra/binder/dialect/mysql/src/main/java/org/apache/shardingsphere/infra/binder/mysql/bind/type/MySQLShowCreateTableStatementBinder.java b/infra/binder/dialect/mysql/src/main/java/org/apache/shardingsphere/infra/binder/mysql/bind/type/MySQLShowCreateTableStatementBinder.java index 4f74830ffd1..8bdb290a75d 100644 --- a/infra/binder/dialect/mysql/src/main/java/org/apache/shardingsphere/infra/binder/mysql/bind/type/MySQLShowCreateTableStatementBinder.java +++ b/infra/binder/dialect/mysql/src/main/java/org/apache/shardingsphere/infra/binder/mysql/bind/type/MySQLShowCreateTableStatementBinder.java @@ -23,20 +23,20 @@ import org.apache.shardingsphere.infra.binder.engine.statement.SQLStatementBinde import org.apache.shardingsphere.infra.binder.engine.statement.SQLStatementBinderContext; import org.apache.shardingsphere.infra.binder.engine.statement.SQLStatementCopyUtils; import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.SimpleTableSegment; -import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ShowCreateTableStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.table.MySQLShowCreateTableStatement; /** * Show create table statement binder for MySQL. */ -public final class MySQLShowCreateTableStatementBinder implements SQLStatementBinder<ShowCreateTableStatement> { +public final class MySQLShowCreateTableStatementBinder implements SQLStatementBinder<MySQLShowCreateTableStatement> { @Override - public ShowCreateTableStatement bind(final ShowCreateTableStatement sqlStatement, final SQLStatementBinderContext binderContext) { + public MySQLShowCreateTableStatement bind(final MySQLShowCreateTableStatement sqlStatement, final SQLStatementBinderContext binderContext) { return copy(sqlStatement, SimpleTableSegmentBinder.bind(sqlStatement.getTable(), binderContext, LinkedHashMultimap.create())); } - private ShowCreateTableStatement copy(final ShowCreateTableStatement sqlStatement, final SimpleTableSegment boundTable) { - ShowCreateTableStatement result = new ShowCreateTableStatement(boundTable); + private MySQLShowCreateTableStatement copy(final MySQLShowCreateTableStatement sqlStatement, final SimpleTableSegment boundTable) { + MySQLShowCreateTableStatement result = new MySQLShowCreateTableStatement(boundTable); SQLStatementCopyUtils.copyAttributes(sqlStatement, result); return result; } diff --git a/parser/sql/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/doris/visitor/statement/type/DorisDALStatementVisitor.java b/parser/sql/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/doris/visitor/statement/type/DorisDALStatementVisitor.java index a207d45f1b3..4d4898fddad 100644 --- a/parser/sql/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/doris/visitor/statement/type/DorisDALStatementVisitor.java +++ b/parser/sql/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/doris/visitor/statement/type/DorisDALStatementVisitor.java @@ -144,14 +144,9 @@ import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.Datab import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.SimpleTableSegment; import org.apache.shardingsphere.sql.parser.statement.core.statement.SQLStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.AnalyzeTableStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.column.MySQLDescribeStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ExplainStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLOptimizeTableStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.SetStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.column.MySQLShowColumnsStatement; -import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ShowCreateTableStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ShowDatabasesStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.index.MySQLShowIndexStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ShowTableStatusStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ShowTablesStatement; import org.apache.shardingsphere.sql.parser.statement.core.value.collection.CollectionValue; @@ -164,6 +159,7 @@ import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLDelimiterSt import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLFlushStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLHelpStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLKillStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLOptimizeTableStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLResetPersistStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLResetStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLRestartStatement; @@ -198,6 +194,8 @@ import org.apache.shardingsphere.sql.parser.statement.mysql.dal.resource.MySQLSe import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.MySQLShowOtherStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.character.MySQLShowCharacterSetStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.character.MySQLShowCollationStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.column.MySQLDescribeStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.column.MySQLShowColumnsStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.database.MySQLShowCreateDatabaseStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.engine.MySQLShowEngineStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.error.MySQLShowErrorsStatement; @@ -207,6 +205,7 @@ import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.event.MySQL import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.function.MySQLShowCreateFunctionStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.function.MySQLShowFunctionCodeStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.function.MySQLShowFunctionStatusStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.index.MySQLShowIndexStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.privilege.MySQLShowCreateUserStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.privilege.MySQLShowGrantsStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.privilege.MySQLShowPrivilegesStatement; @@ -216,6 +215,7 @@ import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.procedure.M import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.process.MySQLShowProcessListStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.profile.MySQLShowProfileStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.profile.MySQLShowProfilesStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.table.MySQLShowCreateTableStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.table.MySQLShowOpenTablesStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.trigger.MySQLShowCreateTriggerStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.trigger.MySQLShowTriggersStatement; @@ -630,7 +630,7 @@ public final class DorisDALStatementVisitor extends DorisStatementVisitor implem @Override public ASTNode visitShowCreateTable(final ShowCreateTableContext ctx) { - return new ShowCreateTableStatement((SimpleTableSegment) visit(ctx.tableName())); + return new MySQLShowCreateTableStatement((SimpleTableSegment) visit(ctx.tableName())); } @Override diff --git a/parser/sql/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/type/MySQLDALStatementVisitor.java b/parser/sql/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/type/MySQLDALStatementVisitor.java index af0afcaa62f..b2f0dcacedf 100644 --- a/parser/sql/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/type/MySQLDALStatementVisitor.java +++ b/parser/sql/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/type/MySQLDALStatementVisitor.java @@ -143,87 +143,87 @@ import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.predicate import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.DatabaseSegment; import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.SimpleTableSegment; import org.apache.shardingsphere.sql.parser.statement.core.statement.SQLStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.column.MySQLDescribeStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.resource.MySQLAlterResourceGroupStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.AnalyzeTableStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.binlog.MySQLBinlogStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.index.MySQLCacheIndexStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.opertation.MySQLChangeMasterStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.opertation.MySQLChangeReplicationSourceToStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.table.MySQLCheckTableStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.table.MySQLChecksumTableStatement; +import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ExplainStatement; +import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.SetStatement; +import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ShowDatabasesStatement; +import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ShowTableStatusStatement; +import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ShowTablesStatement; +import org.apache.shardingsphere.sql.parser.statement.core.value.collection.CollectionValue; +import org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue; +import org.apache.shardingsphere.sql.parser.statement.core.value.literal.impl.NumberLiteralValue; +import org.apache.shardingsphere.sql.parser.statement.core.value.literal.impl.StringLiteralValue; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLCloneStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLCreateLoadableFunctionStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.resource.MySQLCreateResourceGroupStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLDelimiterStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.resource.MySQLDropResourceGroupStatement; -import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ExplainStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLFlushStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLHelpStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.component.MySQLInstallComponentStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.plugin.MySQLInstallPluginStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLKillStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.index.MySQLLoadIndexInfoStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLOptimizeTableStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.table.MySQLRepairTableStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLResetPersistStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLResetStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLRestartStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.resource.MySQLSetResourceGroupStatement; -import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.SetStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLShutdownStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLUseStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.component.MySQLInstallComponentStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.component.MySQLUninstallComponentStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.index.MySQLCacheIndexStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.index.MySQLLoadIndexInfoStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.plugin.MySQLInstallPluginStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.plugin.MySQLShowPluginsStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.plugin.MySQLUninstallPluginStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.binlog.MySQLBinlogStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.binlog.MySQLShowBinaryLogsStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.binlog.MySQLShowBinlogEventsStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.opertation.MySQLChangeMasterStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.opertation.MySQLChangeReplicationSourceToStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.opertation.MySQLStartReplicaStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.opertation.MySQLStartSlaveStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.opertation.MySQLStopSlaveStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.show.MySQLShowMasterStatusStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.show.MySQLShowRelayLogEventsStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.show.MySQLShowReplicaStatusStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.show.MySQLShowReplicasStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.show.MySQLShowSlaveHostsStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.show.MySQLShowSlaveStatusStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.show.MySQLShowStatusStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.resource.MySQLAlterResourceGroupStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.resource.MySQLCreateResourceGroupStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.resource.MySQLDropResourceGroupStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.resource.MySQLSetResourceGroupStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.MySQLShowOtherStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.character.MySQLShowCharacterSetStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.character.MySQLShowCollationStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.column.MySQLDescribeStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.column.MySQLShowColumnsStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.database.MySQLShowCreateDatabaseStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.event.MySQLShowCreateEventStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.function.MySQLShowCreateFunctionStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.procedure.MySQLShowCreateProcedureStatement; -import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ShowCreateTableStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.trigger.MySQLShowCreateTriggerStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.privilege.MySQLShowCreateUserStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.view.MySQLShowCreateViewStatement; -import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ShowDatabasesStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.engine.MySQLShowEngineStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.error.MySQLShowErrorsStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.error.MySQLShowWarningsStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.event.MySQLShowCreateEventStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.event.MySQLShowEventsStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.function.MySQLShowCreateFunctionStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.function.MySQLShowFunctionCodeStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.function.MySQLShowFunctionStatusStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.privilege.MySQLShowGrantsStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.index.MySQLShowIndexStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.show.MySQLShowMasterStatusStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.table.MySQLShowOpenTablesStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.MySQLShowOtherStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.plugin.MySQLShowPluginsStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.privilege.MySQLShowCreateUserStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.privilege.MySQLShowGrantsStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.privilege.MySQLShowPrivilegesStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.procedure.MySQLShowCreateProcedureStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.procedure.MySQLShowProcedureCodeStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.procedure.MySQLShowProcedureStatusStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.process.MySQLShowProcessListStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.profile.MySQLShowProfileStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.profile.MySQLShowProfilesStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.show.MySQLShowRelayLogEventsStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.show.MySQLShowReplicaStatusStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.show.MySQLShowReplicasStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.show.MySQLShowSlaveHostsStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.show.MySQLShowSlaveStatusStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.show.MySQLShowStatusStatement; -import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ShowTableStatusStatement; -import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ShowTablesStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.table.MySQLShowCreateTableStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.table.MySQLShowOpenTablesStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.trigger.MySQLShowCreateTriggerStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.trigger.MySQLShowTriggersStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.variable.MySQLShowVariablesStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.error.MySQLShowWarningsStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLShutdownStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.opertation.MySQLStartReplicaStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.opertation.MySQLStartSlaveStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.opertation.MySQLStopSlaveStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.component.MySQLUninstallComponentStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.plugin.MySQLUninstallPluginStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLUseStatement; -import org.apache.shardingsphere.sql.parser.statement.core.value.collection.CollectionValue; -import org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue; -import org.apache.shardingsphere.sql.parser.statement.core.value.literal.impl.NumberLiteralValue; -import org.apache.shardingsphere.sql.parser.statement.core.value.literal.impl.StringLiteralValue; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.view.MySQLShowCreateViewStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.table.MySQLCheckTableStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.table.MySQLChecksumTableStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.table.MySQLRepairTableStatement; import java.util.Collection; import java.util.Collections; @@ -643,7 +643,7 @@ public final class MySQLDALStatementVisitor extends MySQLStatementVisitor implem @Override public ASTNode visitShowCreateTable(final ShowCreateTableContext ctx) { - return new ShowCreateTableStatement((SimpleTableSegment) visit(ctx.tableName())); + return new MySQLShowCreateTableStatement((SimpleTableSegment) visit(ctx.tableName())); } @Override diff --git a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/type/dal/ShowCreateTableStatement.java b/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/dal/show/table/MySQLShowCreateTableStatement.java similarity index 86% rename from parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/type/dal/ShowCreateTableStatement.java rename to parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/dal/show/table/MySQLShowCreateTableStatement.java index 15cf73590c5..1292271507b 100644 --- a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/type/dal/ShowCreateTableStatement.java +++ b/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/dal/show/table/MySQLShowCreateTableStatement.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal; +package org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.table; import lombok.Getter; import lombok.RequiredArgsConstructor; @@ -24,13 +24,14 @@ import org.apache.shardingsphere.sql.parser.statement.core.statement.attribute.S import org.apache.shardingsphere.sql.parser.statement.core.statement.attribute.type.DatabaseSelectRequiredSQLStatementAttribute; import org.apache.shardingsphere.sql.parser.statement.core.statement.attribute.type.TableInResultSetSQLStatementAttribute; import org.apache.shardingsphere.sql.parser.statement.core.statement.attribute.type.TableSQLStatementAttribute; +import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.DALStatement; /** - * Show create table statement. + * Show create table statement for MySQL. */ @RequiredArgsConstructor @Getter -public final class ShowCreateTableStatement extends DALStatement { +public final class MySQLShowCreateTableStatement extends DALStatement { private final SimpleTableSegment table; diff --git a/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareChecker.java b/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareChecker.java index a78967880d8..3e7c3eec3cb 100644 --- a/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareChecker.java +++ b/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareChecker.java @@ -21,27 +21,7 @@ import lombok.AccessLevel; import lombok.NoArgsConstructor; import org.apache.shardingsphere.sql.parser.statement.core.statement.SQLStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.AnalyzeTableStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.index.MySQLCacheIndexStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.table.MySQLChecksumTableStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLFlushStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.plugin.MySQLInstallPluginStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLKillStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.index.MySQLLoadIndexInfoStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLOptimizeTableStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.table.MySQLRepairTableStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLResetStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.SetStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.binlog.MySQLShowBinaryLogsStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.binlog.MySQLShowBinlogEventsStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.event.MySQLShowCreateEventStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.function.MySQLShowCreateFunctionStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.procedure.MySQLShowCreateProcedureStatement; -import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ShowCreateTableStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.view.MySQLShowCreateViewStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.error.MySQLShowErrorsStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.show.MySQLShowStatusStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.error.MySQLShowWarningsStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.plugin.MySQLUninstallPluginStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dcl.AlterUserStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dcl.DropUserStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dcl.RenameUserStatement; @@ -62,9 +42,6 @@ import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dml.Do import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dml.InsertStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dml.SelectStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dml.UpdateStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.opertation.MySQLChangeMasterStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.opertation.MySQLStartSlaveStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.opertation.MySQLStopSlaveStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.tcl.CommitStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.tcl.xa.XABeginStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.tcl.xa.XACommitStatement; @@ -72,6 +49,29 @@ import org.apache.shardingsphere.sql.parser.statement.core.statement.type.tcl.xa import org.apache.shardingsphere.sql.parser.statement.core.statement.type.tcl.xa.XAPrepareStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.tcl.xa.XARecoveryStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.tcl.xa.XARollbackStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLFlushStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLKillStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLOptimizeTableStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLResetStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.index.MySQLCacheIndexStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.index.MySQLLoadIndexInfoStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.plugin.MySQLInstallPluginStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.plugin.MySQLUninstallPluginStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.binlog.MySQLShowBinaryLogsStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.binlog.MySQLShowBinlogEventsStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.opertation.MySQLChangeMasterStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.opertation.MySQLStartSlaveStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.opertation.MySQLStopSlaveStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.show.MySQLShowStatusStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.error.MySQLShowErrorsStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.error.MySQLShowWarningsStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.event.MySQLShowCreateEventStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.function.MySQLShowCreateFunctionStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.procedure.MySQLShowCreateProcedureStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.table.MySQLShowCreateTableStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.view.MySQLShowCreateViewStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.table.MySQLChecksumTableStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.table.MySQLRepairTableStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dcl.MySQLCreateUserStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dcl.MySQLGrantStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dcl.MySQLRevokeStatement; @@ -100,7 +100,7 @@ public final class MySQLComStmtPrepareChecker { MySQLOptimizeTableStatement.class, RenameTableStatement.class, MySQLRepairTableStatement.class, MySQLResetStatement.class, MySQLRevokeStatement.class, SelectStatement.class, SetStatement.class, MySQLShowWarningsStatement.class, MySQLShowErrorsStatement.class, MySQLShowBinlogEventsStatement.class, MySQLShowCreateProcedureStatement.class, MySQLShowCreateFunctionStatement.class, MySQLShowCreateEventStatement.class, - ShowCreateTableStatement.class, MySQLShowCreateViewStatement.class, MySQLShowBinaryLogsStatement.class, MySQLShowStatusStatement.class, + MySQLShowCreateTableStatement.class, MySQLShowCreateViewStatement.class, MySQLShowBinaryLogsStatement.class, MySQLShowStatusStatement.class, MySQLStartSlaveStatement.class, MySQLStopSlaveStatement.class, TruncateStatement.class, MySQLUninstallPluginStatement.class, UpdateStatement.class, XABeginStatement.class, XAPrepareStatement.class, XACommitStatement.class, XARollbackStatement.class, XAEndStatement.class, XARecoveryStatement.class)); } diff --git a/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareCheckerTest.java b/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareCheckerTest.java index 3cfa47fdfc5..393ff1e82dd 100644 --- a/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareCheckerTest.java +++ b/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareCheckerTest.java @@ -19,11 +19,7 @@ package org.apache.shardingsphere.proxy.frontend.mysql.command.query.binary.prep import org.apache.shardingsphere.sql.parser.statement.core.statement.SQLStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.AnalyzeTableStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLFlushStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLKillStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLOptimizeTableStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.SetStatement; -import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ShowCreateTableStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dcl.AlterUserStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dcl.DropUserStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dcl.RenameUserStatement; @@ -51,25 +47,29 @@ import org.apache.shardingsphere.sql.parser.statement.core.statement.type.tcl.xa import org.apache.shardingsphere.sql.parser.statement.core.statement.type.tcl.xa.XAPrepareStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.tcl.xa.XARecoveryStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.tcl.xa.XARollbackStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLFlushStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLKillStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLOptimizeTableStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLResetStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.index.MySQLCacheIndexStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.opertation.MySQLChangeMasterStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.table.MySQLChecksumTableStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.plugin.MySQLInstallPluginStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.index.MySQLLoadIndexInfoStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.table.MySQLRepairTableStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLResetStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.plugin.MySQLInstallPluginStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.plugin.MySQLUninstallPluginStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.binlog.MySQLShowBinaryLogsStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.binlog.MySQLShowBinlogEventsStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.opertation.MySQLChangeMasterStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.opertation.MySQLStartSlaveStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.opertation.MySQLStopSlaveStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.show.MySQLShowStatusStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.error.MySQLShowErrorsStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.error.MySQLShowWarningsStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.event.MySQLShowCreateEventStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.function.MySQLShowCreateFunctionStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.procedure.MySQLShowCreateProcedureStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.table.MySQLShowCreateTableStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.view.MySQLShowCreateViewStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.error.MySQLShowErrorsStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.show.MySQLShowStatusStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.error.MySQLShowWarningsStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.opertation.MySQLStartSlaveStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.replication.opertation.MySQLStopSlaveStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.plugin.MySQLUninstallPluginStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.table.MySQLChecksumTableStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.table.MySQLRepairTableStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dcl.MySQLCreateUserStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dcl.MySQLGrantStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dcl.MySQLRevokeStatement; @@ -95,7 +95,7 @@ class MySQLComStmtPrepareCheckerTest { mock(MySQLLoadIndexInfoStatement.class), mock(MySQLOptimizeTableStatement.class), mock(RenameTableStatement.class), mock(MySQLRepairTableStatement.class), mock(MySQLResetStatement.class), mock(MySQLRevokeStatement.class), mock(SelectStatement.class), mock(SetStatement.class), mock(MySQLShowWarningsStatement.class), mock(MySQLShowErrorsStatement.class), mock(MySQLShowBinlogEventsStatement.class), mock(MySQLShowCreateProcedureStatement.class), mock(MySQLShowCreateFunctionStatement.class), - mock(MySQLShowCreateEventStatement.class), mock(ShowCreateTableStatement.class), mock(MySQLShowCreateViewStatement.class), mock(MySQLShowBinaryLogsStatement.class), + mock(MySQLShowCreateEventStatement.class), mock(MySQLShowCreateTableStatement.class), mock(MySQLShowCreateViewStatement.class), mock(MySQLShowBinaryLogsStatement.class), mock(MySQLShowStatusStatement.class), mock(MySQLStartSlaveStatement.class), mock(MySQLStopSlaveStatement.class), mock(TruncateStatement.class), mock(MySQLUninstallPluginStatement.class), mock(UpdateStatement.class), mock(XABeginStatement.class), mock(XAPrepareStatement.class), mock(XACommitStatement.class), mock(XARollbackStatement.class), mock(XAEndStatement.class), mock(XARecoveryStatement.class)); diff --git a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/DALStatementAssert.java b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/DALStatementAssert.java index 84af889b059..7154c245a3d 100644 --- a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/DALStatementAssert.java +++ b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/DALStatementAssert.java @@ -20,15 +20,10 @@ package org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement. import lombok.AccessLevel; import lombok.NoArgsConstructor; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.DALStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.column.MySQLDescribeStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.EmptyStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ExplainStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLOptimizeTableStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.SetStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.column.MySQLShowColumnsStatement; -import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ShowCreateTableStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ShowDatabasesStatement; -import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.index.MySQLShowIndexStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ShowStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ShowTableStatusStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ShowTablesStatement; @@ -36,6 +31,7 @@ import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLCloneStatem import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLDelimiterStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLFlushStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLKillStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLOptimizeTableStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLResetPersistStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLResetStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLRestartStatement; @@ -60,11 +56,15 @@ import org.apache.shardingsphere.sql.parser.statement.mysql.dal.resource.MySQLCr import org.apache.shardingsphere.sql.parser.statement.mysql.dal.resource.MySQLDropResourceGroupStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.resource.MySQLSetResourceGroupStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.character.MySQLShowCollationStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.column.MySQLDescribeStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.column.MySQLShowColumnsStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.event.MySQLShowEventsStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.function.MySQLShowFunctionStatusStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.index.MySQLShowIndexStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.privilege.MySQLShowCreateUserStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.procedure.MySQLShowProcedureCodeStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.procedure.MySQLShowProcedureStatusStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.table.MySQLShowCreateTableStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.table.MySQLShowOpenTablesStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.trigger.MySQLShowCreateTriggerStatement; import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.trigger.MySQLShowTriggersStatement; @@ -213,8 +213,8 @@ public final class DALStatementAssert { ShowTablesStatementAssert.assertIs(assertContext, (ShowTablesStatement) actual, (ShowTablesStatementTestCase) expected); } else if (actual instanceof MySQLShowColumnsStatement) { ShowColumnsStatementAssert.assertIs(assertContext, (MySQLShowColumnsStatement) actual, (ShowColumnsStatementTestCase) expected); - } else if (actual instanceof ShowCreateTableStatement) { - ShowCreateTableStatementAssert.assertIs(assertContext, (ShowCreateTableStatement) actual, (ShowCreateTableStatementTestCase) expected); + } else if (actual instanceof MySQLShowCreateTableStatement) { + ShowCreateTableStatementAssert.assertIs(assertContext, (MySQLShowCreateTableStatement) actual, (ShowCreateTableStatementTestCase) expected); } else if (actual instanceof MySQLShowCreateTriggerStatement) { ShowCreateTriggerStatementAssert.assertIs(assertContext, (MySQLShowCreateTriggerStatement) actual, (ShowCreateTriggerStatementTestCase) expected); } else if (actual instanceof MySQLShowCreateUserStatement) { diff --git a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/impl/ShowCreateTableStatementAssert.java b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/impl/ShowCreateTableStatementAssert.java index 3d78d57cfab..4a637afd81a 100644 --- a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/impl/ShowCreateTableStatementAssert.java +++ b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/impl/ShowCreateTableStatementAssert.java @@ -19,7 +19,7 @@ package org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement. import lombok.AccessLevel; import lombok.NoArgsConstructor; -import org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ShowCreateTableStatement; +import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.table.MySQLShowCreateTableStatement; import org.apache.shardingsphere.test.it.sql.parser.internal.asserts.SQLCaseAssertContext; import org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.table.TableAssert; import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.ShowCreateTableStatementTestCase; @@ -37,7 +37,7 @@ public final class ShowCreateTableStatementAssert { * @param actual actual show create table statement * @param expected expected show create table statement test case */ - public static void assertIs(final SQLCaseAssertContext assertContext, final ShowCreateTableStatement actual, final ShowCreateTableStatementTestCase expected) { + public static void assertIs(final SQLCaseAssertContext assertContext, final MySQLShowCreateTableStatement actual, final ShowCreateTableStatementTestCase expected) { if (null != actual.getTable()) { TableAssert.assertIs(assertContext, actual.getTable(), expected.getTable()); }