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 9f5c278795a Merge UnknownSQLStatementContext and CommonSQLStatementContext (#35715) 9f5c278795a is described below commit 9f5c278795adb80f6344358374539f5095f00837 Author: Liang Zhang <zhangli...@apache.org> AuthorDate: Sun Jun 15 20:54:37 2025 +0800 Merge UnknownSQLStatementContext and CommonSQLStatementContext (#35715) --- .../plugin/metrics/core/advice/SQLRouteCountAdviceTest.java | 10 +++++----- .../sharding/merge/ShardingResultMergerEngineTest.java | 7 ++++--- .../context/statement/SQLStatementContextFactory.java | 12 ++++++------ .../checker/sql/SingleDropSchemaSupportedCheckerTest.java | 4 ++-- .../handler/admin/PostgreSQLAdminExecutorCreatorTest.java | 13 +++++++------ .../binary/execute/MySQLComStmtExecuteExecutorTest.java | 4 ++-- .../postgresql/command/query/extended/PortalTest.java | 10 +++++----- .../query/extended/bind/PostgreSQLComBindExecutorTest.java | 6 +++--- 8 files changed, 34 insertions(+), 32 deletions(-) diff --git a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLRouteCountAdviceTest.java b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLRouteCountAdviceTest.java index 5e0ab7c3875..3b039ecde74 100644 --- a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLRouteCountAdviceTest.java +++ b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLRouteCountAdviceTest.java @@ -23,7 +23,7 @@ import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollecto import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration; import org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture; import org.apache.shardingsphere.agent.plugin.metrics.core.fixture.collector.MetricsCollectorFixture; -import org.apache.shardingsphere.infra.binder.context.statement.UnknownSQLStatementContext; +import org.apache.shardingsphere.infra.binder.context.statement.CommonSQLStatementContext; import org.apache.shardingsphere.infra.database.core.type.DatabaseType; import org.apache.shardingsphere.infra.hint.HintValueContext; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; @@ -60,7 +60,7 @@ class SQLRouteCountAdviceTest { @Test void assertInsertRoute() { - QueryContext queryContext = new QueryContext(new UnknownSQLStatementContext( + QueryContext queryContext = new QueryContext(new CommonSQLStatementContext( databaseType, new InsertStatement()), "", Collections.emptyList(), new HintValueContext(), mockConnectionContext(), mock(ShardingSphereMetaData.class)); assertRoute(queryContext, "INSERT=1"); } @@ -73,21 +73,21 @@ class SQLRouteCountAdviceTest { @Test void assertUpdateRoute() { - QueryContext queryContext = new QueryContext(new UnknownSQLStatementContext( + QueryContext queryContext = new QueryContext(new CommonSQLStatementContext( databaseType, new UpdateStatement()), "", Collections.emptyList(), new HintValueContext(), mockConnectionContext(), mock(ShardingSphereMetaData.class)); assertRoute(queryContext, "UPDATE=1"); } @Test void assertDeleteRoute() { - QueryContext queryContext = new QueryContext(new UnknownSQLStatementContext( + QueryContext queryContext = new QueryContext(new CommonSQLStatementContext( databaseType, new DeleteStatement()), "", Collections.emptyList(), new HintValueContext(), mockConnectionContext(), mock(ShardingSphereMetaData.class)); assertRoute(queryContext, "DELETE=1"); } @Test void assertSelectRoute() { - QueryContext queryContext = new QueryContext(new UnknownSQLStatementContext( + QueryContext queryContext = new QueryContext(new CommonSQLStatementContext( databaseType, new SelectStatement()), "", Collections.emptyList(), new HintValueContext(), mockConnectionContext(), mock(ShardingSphereMetaData.class)); assertRoute(queryContext, "SELECT=1"); } diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/ShardingResultMergerEngineTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/ShardingResultMergerEngineTest.java index 81675c07455..798604adf2f 100644 --- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/ShardingResultMergerEngineTest.java +++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/ShardingResultMergerEngineTest.java @@ -17,7 +17,8 @@ package org.apache.shardingsphere.sharding.merge; -import org.apache.shardingsphere.infra.binder.context.statement.UnknownSQLStatementContext; +import org.apache.shardingsphere.infra.binder.context.statement.CommonSQLStatementContext; +import org.apache.shardingsphere.infra.binder.context.statement.SQLStatementContext; import org.apache.shardingsphere.infra.binder.context.statement.type.dml.InsertStatementContext; import org.apache.shardingsphere.infra.binder.context.statement.type.dml.SelectStatementContext; import org.apache.shardingsphere.infra.config.props.ConfigurationProperties; @@ -69,7 +70,7 @@ class ShardingResultMergerEngineTest { @Test void assertNewInstanceWithDALStatement() { ConfigurationProperties props = new ConfigurationProperties(new Properties()); - UnknownSQLStatementContext sqlStatementContext = new UnknownSQLStatementContext(databaseType, mock(ShowStatement.class)); + SQLStatementContext sqlStatementContext = new CommonSQLStatementContext(databaseType, mock(ShowStatement.class)); assertThat(new ShardingResultMergerEngine().newInstance("foo_db", databaseType, null, props, sqlStatementContext), instanceOf(ShardingDALResultMerger.class)); } @@ -93,7 +94,7 @@ class ShardingResultMergerEngineTest { @Test void assertNewInstanceWithDDLStatement() { ConfigurationProperties props = new ConfigurationProperties(new Properties()); - UnknownSQLStatementContext sqlStatementContext = new UnknownSQLStatementContext(databaseType, mock(FetchStatement.class)); + SQLStatementContext sqlStatementContext = new CommonSQLStatementContext(databaseType, mock(FetchStatement.class)); assertThat(new ShardingResultMergerEngine().newInstance("foo_db", databaseType, null, props, sqlStatementContext), instanceOf(ShardingDDLResultMerger.class)); } } diff --git a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/SQLStatementContextFactory.java b/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/SQLStatementContextFactory.java index 035a84e4a7a..9de3b005910 100644 --- a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/SQLStatementContextFactory.java +++ b/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/SQLStatementContextFactory.java @@ -127,7 +127,7 @@ public final class SQLStatementContextFactory { if (sqlStatement instanceof DALStatement) { return getDALStatementContext(metaData, databaseType, (DALStatement) sqlStatement, params, currentDatabaseName); } - return new UnknownSQLStatementContext(databaseType, sqlStatement); + return new CommonSQLStatementContext(databaseType, sqlStatement); } private static SQLStatementContext getDMLStatementContext(final ShardingSphereMetaData metaData, final DatabaseType databaseType, @@ -145,7 +145,7 @@ public final class SQLStatementContextFactory { return new InsertStatementContext(databaseType, (InsertStatement) sqlStatement, params, metaData, currentDatabaseName); } if (sqlStatement instanceof CallStatement || sqlStatement instanceof DoStatement || sqlStatement instanceof MergeStatement) { - return new UnknownSQLStatementContext(databaseType, sqlStatement); + return new CommonSQLStatementContext(databaseType, sqlStatement); } throw new UnsupportedSQLOperationException(String.format("Unsupported SQL statement `%s`", sqlStatement.getClass().getSimpleName())); } @@ -153,7 +153,7 @@ public final class SQLStatementContextFactory { private static SQLStatementContext getDDLStatementContext(final ShardingSphereMetaData metaData, final DatabaseType databaseType, final DDLStatement sqlStatement, final List<Object> params, final String currentDatabaseName) { if (sqlStatement instanceof CreateSchemaStatement) { - return new UnknownSQLStatementContext(databaseType, sqlStatement); + return new CommonSQLStatementContext(databaseType, sqlStatement); } if (sqlStatement instanceof CreateTableStatement) { return new CreateTableStatementContext(databaseType, (CreateTableStatement) sqlStatement); @@ -212,7 +212,7 @@ public final class SQLStatementContextFactory { if (sqlStatement instanceof FetchStatement) { return new FetchStatementContext(databaseType, (FetchStatement) sqlStatement); } - return new UnknownSQLStatementContext(databaseType, sqlStatement); + return new CommonSQLStatementContext(databaseType, sqlStatement); } private static SQLStatementContext getDCLStatementContext(final DatabaseType databaseType, final DCLStatement sqlStatement) { @@ -222,7 +222,7 @@ public final class SQLStatementContextFactory { if (sqlStatement instanceof RevokeStatement) { return new CommonSQLStatementContext(databaseType, sqlStatement); } - return new UnknownSQLStatementContext(databaseType, sqlStatement); + return new CommonSQLStatementContext(databaseType, sqlStatement); } private static SQLStatementContext getDALStatementContext(final ShardingSphereMetaData metaData, final DatabaseType databaseType, @@ -245,6 +245,6 @@ public final class SQLStatementContextFactory { if (sqlStatement instanceof AnalyzeTableStatement) { return new CommonSQLStatementContext(databaseType, sqlStatement); } - return new UnknownSQLStatementContext(databaseType, sqlStatement); + return new CommonSQLStatementContext(databaseType, sqlStatement); } } diff --git a/kernel/single/core/src/test/java/org/apache/shardingsphere/single/checker/sql/SingleDropSchemaSupportedCheckerTest.java b/kernel/single/core/src/test/java/org/apache/shardingsphere/single/checker/sql/SingleDropSchemaSupportedCheckerTest.java index b6a34673fc0..9341dcac05c 100644 --- a/kernel/single/core/src/test/java/org/apache/shardingsphere/single/checker/sql/SingleDropSchemaSupportedCheckerTest.java +++ b/kernel/single/core/src/test/java/org/apache/shardingsphere/single/checker/sql/SingleDropSchemaSupportedCheckerTest.java @@ -17,8 +17,8 @@ package org.apache.shardingsphere.single.checker.sql; +import org.apache.shardingsphere.infra.binder.context.statement.CommonSQLStatementContext; import org.apache.shardingsphere.infra.binder.context.statement.SQLStatementContext; -import org.apache.shardingsphere.infra.binder.context.statement.UnknownSQLStatementContext; import org.apache.shardingsphere.infra.database.core.metadata.database.enums.TableType; import org.apache.shardingsphere.infra.exception.kernel.metadata.SchemaNotFoundException; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; @@ -77,6 +77,6 @@ class SingleDropSchemaSupportedCheckerTest { DropSchemaStatement dropSchemaStatement = mock(DropSchemaStatement.class, RETURNS_DEEP_STUBS); when(dropSchemaStatement.isContainsCascade()).thenReturn(containsCascade); when(dropSchemaStatement.getSchemaNames()).thenReturn(Collections.singleton(new IdentifierValue(schemaName))); - return new UnknownSQLStatementContext(mock(), dropSchemaStatement); + return new CommonSQLStatementContext(mock(), dropSchemaStatement); } } diff --git a/proxy/backend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/backend/postgresql/handler/admin/PostgreSQLAdminExecutorCreatorTest.java b/proxy/backend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/backend/postgresql/handler/admin/PostgreSQLAdminExecutorCreatorTest.java index a615ef87768..51f1a5e423e 100644 --- a/proxy/backend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/backend/postgresql/handler/admin/PostgreSQLAdminExecutorCreatorTest.java +++ b/proxy/backend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/backend/postgresql/handler/admin/PostgreSQLAdminExecutorCreatorTest.java @@ -17,7 +17,8 @@ package org.apache.shardingsphere.proxy.backend.postgresql.handler.admin; -import org.apache.shardingsphere.infra.binder.context.statement.UnknownSQLStatementContext; +import org.apache.shardingsphere.infra.binder.context.statement.CommonSQLStatementContext; +import org.apache.shardingsphere.infra.binder.context.statement.SQLStatementContext; import org.apache.shardingsphere.infra.binder.context.statement.type.dml.DeleteStatementContext; import org.apache.shardingsphere.infra.binder.context.statement.type.dml.SelectStatementContext; import org.apache.shardingsphere.infra.database.core.type.DatabaseType; @@ -30,12 +31,12 @@ import org.apache.shardingsphere.proxy.backend.postgresql.handler.admin.executor import org.apache.shardingsphere.proxy.backend.postgresql.handler.admin.executor.PostgreSQLShowVariableExecutor; import org.apache.shardingsphere.sql.parser.api.CacheOption; import org.apache.shardingsphere.sql.parser.statement.core.statement.SQLStatement; -import org.apache.shardingsphere.sql.parser.statement.postgresql.dal.PostgreSQLResetParameterStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.dal.SetStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.dal.ShowStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.DeleteStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.InsertStatement; import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.SelectStatement; +import org.apache.shardingsphere.sql.parser.statement.postgresql.dal.PostgreSQLResetParameterStatement; import org.junit.jupiter.api.Test; import java.util.Collections; @@ -86,12 +87,12 @@ class PostgreSQLAdminExecutorCreatorTest { @Test void assertCreateWithOtherSQLStatementContextOnly() { - assertThat(new PostgreSQLAdminExecutorCreator().create(new UnknownSQLStatementContext(databaseType, new InsertStatement())), is(Optional.empty())); + assertThat(new PostgreSQLAdminExecutorCreator().create(new CommonSQLStatementContext(databaseType, new InsertStatement())), is(Optional.empty())); } @Test void assertCreateWithShowSQLStatement() { - Optional<DatabaseAdminExecutor> actual = new PostgreSQLAdminExecutorCreator().create(new UnknownSQLStatementContext(databaseType, new ShowStatement("client_encoding"))); + Optional<DatabaseAdminExecutor> actual = new PostgreSQLAdminExecutorCreator().create(new CommonSQLStatementContext(databaseType, new ShowStatement("client_encoding"))); assertTrue(actual.isPresent()); assertThat(actual.get(), instanceOf(PostgreSQLShowVariableExecutor.class)); } @@ -147,7 +148,7 @@ class PostgreSQLAdminExecutorCreatorTest { @Test void assertCreateWithSetStatement() { - UnknownSQLStatementContext sqlStatementContext = new UnknownSQLStatementContext(databaseType, new SetStatement(Collections.emptyList())); + SQLStatementContext sqlStatementContext = new CommonSQLStatementContext(databaseType, new SetStatement(Collections.emptyList())); Optional<DatabaseAdminExecutor> actual = new PostgreSQLAdminExecutorCreator().create(sqlStatementContext, "SET client_encoding = utf8", "", Collections.emptyList()); assertTrue(actual.isPresent()); assertThat(actual.get(), instanceOf(PostgreSQLSetVariableAdminExecutor.class)); @@ -156,7 +157,7 @@ class PostgreSQLAdminExecutorCreatorTest { @Test void assertCreateWithResetStatement() { Optional<DatabaseAdminExecutor> actual = new PostgreSQLAdminExecutorCreator() - .create(new UnknownSQLStatementContext(databaseType, new PostgreSQLResetParameterStatement("client_encoding")), "RESET client_encoding", "", Collections.emptyList()); + .create(new CommonSQLStatementContext(databaseType, new PostgreSQLResetParameterStatement("client_encoding")), "RESET client_encoding", "", Collections.emptyList()); assertTrue(actual.isPresent()); assertThat(actual.get(), instanceOf(PostgreSQLResetVariableAdminExecutor.class)); } diff --git a/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/execute/MySQLComStmtExecuteExecutorTest.java b/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/execute/MySQLComStmtExecuteExecutorTest.java index 7eb2ba21c5a..c8bc7ad1907 100644 --- a/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/execute/MySQLComStmtExecuteExecutorTest.java +++ b/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/execute/MySQLComStmtExecuteExecutorTest.java @@ -28,8 +28,8 @@ import org.apache.shardingsphere.db.protocol.mysql.packet.command.query.binary.e import org.apache.shardingsphere.db.protocol.mysql.packet.generic.MySQLEofPacket; import org.apache.shardingsphere.db.protocol.mysql.packet.generic.MySQLOKPacket; import org.apache.shardingsphere.db.protocol.packet.DatabasePacket; +import org.apache.shardingsphere.infra.binder.context.statement.CommonSQLStatementContext; import org.apache.shardingsphere.infra.binder.context.statement.SQLStatementContext; -import org.apache.shardingsphere.infra.binder.context.statement.UnknownSQLStatementContext; import org.apache.shardingsphere.infra.binder.context.statement.type.dml.SelectStatementContext; import org.apache.shardingsphere.infra.binder.context.statement.type.dml.UpdateStatementContext; import org.apache.shardingsphere.infra.database.core.type.DatabaseType; @@ -117,7 +117,7 @@ class MySQLComStmtExecuteExecutorTest { when(connectionSession.getServerPreparedStatementRegistry().getPreparedStatement(2)) .thenReturn(new MySQLServerPreparedStatement("UPDATE tbl SET col=1 WHERE id = ?", updateStatementContext, new HintValueContext(), Collections.emptyList())); when(connectionSession.getServerPreparedStatementRegistry().getPreparedStatement(3)) - .thenReturn(new MySQLServerPreparedStatement("COMMIT", new UnknownSQLStatementContext(databaseType, new CommitStatement()), new HintValueContext(), Collections.emptyList())); + .thenReturn(new MySQLServerPreparedStatement("COMMIT", new CommonSQLStatementContext(databaseType, new CommitStatement()), new HintValueContext(), Collections.emptyList())); ConnectionContext connectionContext = mockConnectionContext(); when(connectionSession.getConnectionContext()).thenReturn(connectionContext); when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData()).thenReturn(new ShardingSphereMetaData()); diff --git a/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PortalTest.java b/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PortalTest.java index 05621889ab9..5348bc6495e 100644 --- a/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PortalTest.java +++ b/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PortalTest.java @@ -28,8 +28,8 @@ import org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.Pos import org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.execute.PostgreSQLPortalSuspendedPacket; import org.apache.shardingsphere.db.protocol.postgresql.packet.generic.PostgreSQLCommandCompletePacket; import org.apache.shardingsphere.db.protocol.postgresql.packet.handshake.PostgreSQLParameterStatusPacket; +import org.apache.shardingsphere.infra.binder.context.statement.CommonSQLStatementContext; import org.apache.shardingsphere.infra.binder.context.statement.SQLStatementContext; -import org.apache.shardingsphere.infra.binder.context.statement.UnknownSQLStatementContext; import org.apache.shardingsphere.infra.binder.context.statement.type.dml.InsertStatementContext; import org.apache.shardingsphere.infra.binder.context.statement.type.dml.SelectStatementContext; import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey; @@ -143,7 +143,7 @@ class PortalTest { @Test void assertGetName() throws SQLException { PostgreSQLServerPreparedStatement preparedStatement = new PostgreSQLServerPreparedStatement("", - new UnknownSQLStatementContext(databaseType, new EmptyStatement()), new HintValueContext(), Collections.emptyList(), Collections.emptyList()); + new CommonSQLStatementContext(databaseType, new EmptyStatement()), new HintValueContext(), Collections.emptyList(), Collections.emptyList()); Portal portal = new Portal("", preparedStatement, Collections.emptyList(), Collections.emptyList(), databaseConnectionManager); assertThat(portal.getName(), is("")); } @@ -232,7 +232,7 @@ class PortalTest { when(proxyBackendHandler.execute()).thenReturn(mock(UpdateResponseHeader.class)); when(proxyBackendHandler.next()).thenReturn(false); PostgreSQLServerPreparedStatement preparedStatement = new PostgreSQLServerPreparedStatement("", - new UnknownSQLStatementContext(databaseType, new EmptyStatement()), new HintValueContext(), Collections.emptyList(), Collections.emptyList()); + new CommonSQLStatementContext(databaseType, new EmptyStatement()), new HintValueContext(), Collections.emptyList(), Collections.emptyList()); Portal portal = new Portal("", preparedStatement, Collections.emptyList(), Collections.emptyList(), databaseConnectionManager); portal.bind(); assertThat(portal.describe(), is(PostgreSQLNoDataPacket.getInstance())); @@ -247,7 +247,7 @@ class PortalTest { String sql = "set client_encoding = utf8"; SetStatement setStatement = new SetStatement(Collections.singletonList(new VariableAssignSegment(0, 0, new VariableSegment(0, 0, "client_encoding"), null))); PostgreSQLServerPreparedStatement preparedStatement = new PostgreSQLServerPreparedStatement( - sql, new UnknownSQLStatementContext(databaseType, setStatement), new HintValueContext(), Collections.emptyList(), Collections.emptyList()); + sql, new CommonSQLStatementContext(databaseType, setStatement), new HintValueContext(), Collections.emptyList(), Collections.emptyList()); Portal portal = new Portal("", preparedStatement, Collections.emptyList(), Collections.emptyList(), databaseConnectionManager); portal.bind(); List<DatabasePacket> actualPackets = portal.execute(0); @@ -268,7 +268,7 @@ class PortalTest { @Test void assertClose() throws SQLException { PostgreSQLServerPreparedStatement preparedStatement = new PostgreSQLServerPreparedStatement("", - new UnknownSQLStatementContext(databaseType, new EmptyStatement()), new HintValueContext(), Collections.emptyList(), Collections.emptyList()); + new CommonSQLStatementContext(databaseType, new EmptyStatement()), new HintValueContext(), Collections.emptyList(), Collections.emptyList()); new Portal("", preparedStatement, Collections.emptyList(), Collections.emptyList(), databaseConnectionManager).close(); verify(databaseConnectionManager).unmarkResourceInUse(proxyBackendHandler); verify(proxyBackendHandler).close(); diff --git a/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/bind/PostgreSQLComBindExecutorTest.java b/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/bind/PostgreSQLComBindExecutorTest.java index d1beb52b6a3..6a58d8e81bf 100644 --- a/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/bind/PostgreSQLComBindExecutorTest.java +++ b/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/bind/PostgreSQLComBindExecutorTest.java @@ -21,7 +21,7 @@ import org.apache.shardingsphere.db.protocol.packet.DatabasePacket; import org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.PostgreSQLColumnType; import org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.bind.PostgreSQLBindCompletePacket; import org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.bind.PostgreSQLComBindPacket; -import org.apache.shardingsphere.infra.binder.context.statement.UnknownSQLStatementContext; +import org.apache.shardingsphere.infra.binder.context.statement.CommonSQLStatementContext; import org.apache.shardingsphere.infra.database.core.type.DatabaseType; import org.apache.shardingsphere.infra.hint.HintValueContext; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; @@ -99,7 +99,7 @@ class PostgreSQLComBindExecutorTest { when(databaseConnectionManager.getConnectionSession()).thenReturn(connectionSession); String statementId = "S_1"; connectionSession.getServerPreparedStatementRegistry().addPreparedStatement(statementId, new PostgreSQLServerPreparedStatement( - "", new UnknownSQLStatementContext(databaseType, new EmptyStatement()), new HintValueContext(), Collections.emptyList(), Collections.emptyList())); + "", new CommonSQLStatementContext(databaseType, new EmptyStatement()), new HintValueContext(), Collections.emptyList(), Collections.emptyList())); when(bindPacket.getStatementId()).thenReturn(statementId); when(bindPacket.getPortal()).thenReturn("C_1"); when(bindPacket.readParameters(anyList())).thenReturn(Collections.emptyList()); @@ -128,7 +128,7 @@ class PostgreSQLComBindExecutorTest { String statementId = "S_1"; List<Object> parameters = Arrays.asList(1, "updated_name"); PostgreSQLServerPreparedStatement serverPreparedStatement = new PostgreSQLServerPreparedStatement("update test set name = $2 where id = $1", - new UnknownSQLStatementContext(databaseType, new EmptyStatement()), new HintValueContext(), + new CommonSQLStatementContext(databaseType, new EmptyStatement()), new HintValueContext(), Arrays.asList(PostgreSQLColumnType.VARCHAR, PostgreSQLColumnType.INT4), Arrays.asList(1, 0)); connectionSession.getServerPreparedStatementRegistry().addPreparedStatement(statementId, serverPreparedStatement); when(bindPacket.getStatementId()).thenReturn(statementId);