提交 ae98a3a0 编写于 作者: T terrymanu

Rename BackendConnection.schemaName

上级 ae84b341
......@@ -56,7 +56,7 @@ public final class DatabaseCommunicationEngineFactory {
* @return instance of text protocol backend handler
*/
public DatabaseCommunicationEngine newTextProtocolInstance(final SQLStatement sqlStatement, final String sql, final BackendConnection backendConnection) {
SchemaContext schemaContext = ProxyContext.getInstance().getSchema(backendConnection.getSchema());
SchemaContext schemaContext = ProxyContext.getInstance().getSchema(backendConnection.getSchemaName());
return new JDBCDatabaseCommunicationEngine(sql, backendConnection, new JDBCExecuteEngine(backendConnection, new StatementExecutorWrapper(schemaContext, sqlStatement)));
}
......@@ -70,7 +70,7 @@ public final class DatabaseCommunicationEngineFactory {
* @return instance of binary protocol backend handler
*/
public DatabaseCommunicationEngine newBinaryProtocolInstance(final SQLStatement sqlStatement, final String sql, final List<Object> parameters, final BackendConnection backendConnection) {
SchemaContext schemaContext = ProxyContext.getInstance().getSchema(backendConnection.getSchema());
SchemaContext schemaContext = ProxyContext.getInstance().getSchema(backendConnection.getSchemaName());
return new JDBCDatabaseCommunicationEngine(sql, backendConnection, new JDBCExecuteEngine(backendConnection, new PreparedStatementExecutorWrapper(schemaContext, sqlStatement, parameters)));
}
}
......@@ -76,7 +76,7 @@ public final class JDBCDatabaseCommunicationEngine implements DatabaseCommunicat
this.sql = sql;
connection = backendConnection;
executeEngine = sqlExecuteEngine;
schema = ProxyContext.getInstance().getSchema(backendConnection.getSchema());
schema = ProxyContext.getInstance().getSchema(backendConnection.getSchemaName());
}
@Override
......
......@@ -63,7 +63,7 @@ public final class BackendConnection implements JDBCExecutionConnection, AutoClo
private static final int MAXIMUM_RETRY_COUNT = 5;
private volatile String schema;
private volatile String schemaName;
private TransactionType transactionType;
......@@ -102,7 +102,7 @@ public final class BackendConnection implements JDBCExecutionConnection, AutoClo
* @param transactionType transaction type
*/
public void setTransactionType(final TransactionType transactionType) {
if (null == schema) {
if (null == schemaName) {
throw new ShardingSphereException("Please select database, then switch transaction type.");
}
if (isSwitchFailed()) {
......@@ -120,7 +120,7 @@ public final class BackendConnection implements JDBCExecutionConnection, AutoClo
if (isSwitchFailed()) {
throw new ShardingSphereException("Failed to switch schema, please terminate current transaction.");
}
schema = schemaName;
this.schemaName = schemaName;
}
@SneakyThrows(InterruptedException.class)
......@@ -170,7 +170,7 @@ public final class BackendConnection implements JDBCExecutionConnection, AutoClo
}
private List<Connection> getConnectionsWithoutTransaction(final String dataSourceName, final int connectionSize, final ConnectionMode connectionMode) throws SQLException {
Preconditions.checkNotNull(schema, "current schema is null");
Preconditions.checkNotNull(schemaName, "current schema is null");
List<Connection> result = getConnectionFromUnderlying(dataSourceName, connectionSize, connectionMode);
synchronized (cachedConnections) {
cachedConnections.putAll(dataSourceName, result);
......@@ -179,7 +179,7 @@ public final class BackendConnection implements JDBCExecutionConnection, AutoClo
}
private List<Connection> createNewConnections(final String dataSourceName, final int connectionSize, final ConnectionMode connectionMode) throws SQLException {
Preconditions.checkNotNull(schema, "current schema is null");
Preconditions.checkNotNull(schemaName, "current schema is null");
List<Connection> result = getConnectionFromUnderlying(dataSourceName, connectionSize, connectionMode);
for (Connection each : result) {
replayMethodsInvocation(each);
......@@ -188,7 +188,7 @@ public final class BackendConnection implements JDBCExecutionConnection, AutoClo
}
private List<Connection> getConnectionFromUnderlying(final String dataSourceName, final int connectionSize, final ConnectionMode connectionMode) throws SQLException {
return ProxyContext.getInstance().getBackendDataSource().getConnections(schema, dataSourceName, connectionSize, connectionMode);
return ProxyContext.getInstance().getBackendDataSource().getConnections(schemaName, dataSourceName, connectionSize, connectionMode);
}
@Override
......
......@@ -41,7 +41,7 @@ public final class BackendTransactionManager implements TransactionManager {
connection = backendConnection;
transactionType = connection.getTransactionType();
localTransactionManager = new LocalTransactionManager(backendConnection);
ShardingTransactionManagerEngine engine = ProxyContext.getInstance().getTransactionContexts().getEngines().get(connection.getSchema());
ShardingTransactionManagerEngine engine = ProxyContext.getInstance().getTransactionContexts().getEngines().get(connection.getSchemaName());
shardingTransactionManager = null == engine ? null : engine.getTransactionManager(transactionType);
}
......
......@@ -121,7 +121,7 @@ public final class JDBCExecuteEngine implements SQLExecuteEngine {
}
private Collection<ExecuteResult> executeWithUnmanagedResource(final ExecutionContext executionContext, final int maxConnectionsSizePerQuery) throws SQLException {
Collection<ShardingSphereRule> rules = ProxyContext.getInstance().getSchema(backendConnection.getSchema()).getSchema().getRules();
Collection<ShardingSphereRule> rules = ProxyContext.getInstance().getSchema(backendConnection.getSchemaName()).getSchema().getRules();
Collection<InputGroup<RawSQLExecuteUnit>> inputGroups = new RawExecuteGroupEngine(maxConnectionsSizePerQuery, rules).generate(executionContext.getExecutionUnits());
// TODO handle query header
return rawExecutor.execute(inputGroups, new RawSQLExecutorCallback());
......
......@@ -99,7 +99,7 @@ public final class ProxySQLExecutorCallback extends DefaultSQLExecutorCallback<E
private List<QueryHeader> getQueryHeaders(final ProjectionsContext projectionsContext, final ResultSetMetaData resultSetMetaData) throws SQLException {
List<QueryHeader> result = new LinkedList<>();
for (int columnIndex = 1; columnIndex <= projectionsContext.getExpandProjections().size(); columnIndex++) {
result.add(QueryHeaderBuilder.build(projectionsContext, resultSetMetaData, ProxyContext.getInstance().getSchema(backendConnection.getSchema()), columnIndex));
result.add(QueryHeaderBuilder.build(projectionsContext, resultSetMetaData, ProxyContext.getInstance().getSchema(backendConnection.getSchemaName()), columnIndex));
}
return result;
}
......@@ -107,7 +107,7 @@ public final class ProxySQLExecutorCallback extends DefaultSQLExecutorCallback<E
private List<QueryHeader> getQueryHeaders(final ResultSetMetaData resultSetMetaData) throws SQLException {
List<QueryHeader> result = new LinkedList<>();
for (int columnIndex = 1; columnIndex <= resultSetMetaData.getColumnCount(); columnIndex++) {
result.add(QueryHeaderBuilder.build(resultSetMetaData, ProxyContext.getInstance().getSchema(backendConnection.getSchema()), columnIndex));
result.add(QueryHeaderBuilder.build(resultSetMetaData, ProxyContext.getInstance().getSchema(backendConnection.getSchemaName()), columnIndex));
}
return result;
}
......
......@@ -45,7 +45,7 @@ public final class BroadcastBackendHandler implements TextProtocolBackendHandler
@Override
public BackendResponse execute() throws SQLException {
String originalSchema = backendConnection.getSchema();
String originalSchema = backendConnection.getSchemaName();
for (String each : ProxyContext.getInstance().getAllSchemaNames()) {
backendConnection.setCurrentSchema(each);
databaseCommunicationEngineFactory.newTextProtocolInstance(sqlStatement, sql, backendConnection).execute();
......
......@@ -101,7 +101,7 @@ public final class RDLBackendHandler implements TextProtocolBackendHandler {
Map<String, DataSourceConfiguration> dataSources = DataSourceParameterConverter.getDataSourceConfigurationMap(
DataSourceParameterConverter.getDataSourceParameterMapFromYamlConfiguration(parameters));
// TODO Need to get the executed feedback from registry center for returning.
ShardingSphereEventBus.getInstance().post(new DataSourcePersistEvent(backendConnection.getSchema(), dataSources));
ShardingSphereEventBus.getInstance().post(new DataSourcePersistEvent(backendConnection.getSchemaName(), dataSources));
UpdateResponse result = new UpdateResponse();
result.setType("CREATE");
return result;
......@@ -111,7 +111,7 @@ public final class RDLBackendHandler implements TextProtocolBackendHandler {
YamlShardingRuleConfiguration configs = new CreateShardingRuleStatementContextConverter().convert(context);
Collection<RuleConfiguration> rules = new YamlRuleConfigurationSwapperEngine().swapToRuleConfigurations(Collections.singleton(configs));
// TODO Need to get the executed feedback from registry center for returning.
ShardingSphereEventBus.getInstance().post(new RulePersistEvent(backendConnection.getSchema(), rules));
ShardingSphereEventBus.getInstance().post(new RulePersistEvent(backendConnection.getSchemaName(), rules));
UpdateResponse result = new UpdateResponse();
result.setType("CREATE");
return result;
......
......@@ -53,12 +53,12 @@ public final class ShowTablesBackendHandler implements TextProtocolBackendHandle
@Override
public BackendResponse execute() throws SQLException {
SchemaContext context = ProxyContext.getInstance().getSchema(backendConnection.getSchema());
SchemaContext context = ProxyContext.getInstance().getSchema(backendConnection.getSchemaName());
if (null == context) {
throw new NoDatabaseSelectedException();
}
if (!context.isComplete()) {
return getDefaultQueryResponse(backendConnection.getSchema());
return getDefaultQueryResponse(backendConnection.getSchemaName());
}
// TODO Get all tables from meta data.
databaseCommunicationEngine = databaseCommunicationEngineFactory.newTextProtocolInstance(sqlStatement, sql, backendConnection);
......
......@@ -50,7 +50,7 @@ public final class UnicastBackendHandler implements TextProtocolBackendHandler {
@Override
public BackendResponse execute() throws SQLException {
if (null == backendConnection.getSchema()) {
if (null == backendConnection.getSchemaName()) {
Map<String, SchemaContext> schemaContexts = ProxyContext.getInstance().getSchemaContexts().getSchemaContexts();
if (schemaContexts.isEmpty()) {
throw new NoDatabaseSelectedException();
......
......@@ -53,12 +53,12 @@ public final class QueryBackendHandler implements TextProtocolBackendHandler {
@Override
public BackendResponse execute() throws SQLException {
SchemaContext context = ProxyContext.getInstance().getSchema(backendConnection.getSchema());
SchemaContext context = ProxyContext.getInstance().getSchema(backendConnection.getSchemaName());
if (null == context) {
throw new NoDatabaseSelectedException();
}
if (!context.isComplete()) {
return getDefaultQueryResponse(backendConnection.getSchema());
return getDefaultQueryResponse(backendConnection.getSchemaName());
}
databaseCommunicationEngine = databaseCommunicationEngineFactory.newTextProtocolInstance(sqlStatement, sql, backendConnection);
return databaseCommunicationEngine.execute();
......
......@@ -56,7 +56,7 @@ public final class ShardingCTLExplainBackendHandler implements TextProtocolBacke
if (!explainStatement.isPresent()) {
throw new InvalidShardingCTLFormatException(sql);
}
SchemaContext schema = ProxyContext.getInstance().getSchema(backendConnection.getSchema());
SchemaContext schema = ProxyContext.getInstance().getSchema(backendConnection.getSchemaName());
StatementExecutorWrapper statementExecutorWrapper =
new StatementExecutorWrapper(schema, schema.getRuntimeContext().getSqlParserEngine().parse(explainStatement.get().getSql(), false));
executionUnits = statementExecutorWrapper.generateExecutionContext(explainStatement.get().getSql()).getExecutionUnits().iterator();
......
......@@ -57,7 +57,7 @@ public final class HintShowTableStatusExecutor extends AbstractHintQueryExecutor
protected MergedResult createMergedResult() {
Map<String, HintShowTableStatusResult> results = new HashMap<>();
Collection<String> tableNames =
ProxyContext.getInstance().getSchema(backendConnection.getSchema()).getSchema().getMetaData().getRuleSchemaMetaData().getConfiguredSchemaMetaData().getAllTableNames();
ProxyContext.getInstance().getSchema(backendConnection.getSchemaName()).getSchema().getMetaData().getRuleSchemaMetaData().getConfiguredSchemaMetaData().getAllTableNames();
for (String each : tableNames) {
if (HintManager.isDatabaseShardingOnly()) {
fillShardingValues(results, each, HintManager.getDatabaseShardingValues(), Collections.emptyList());
......
......@@ -64,7 +64,7 @@ public final class TextProtocolBackendHandlerFactoryTest {
public void setUp() {
when(backendConnection.getTransactionType()).thenReturn(TransactionType.LOCAL);
setTransactionContexts();
when(backendConnection.getSchema()).thenReturn("schema");
when(backendConnection.getSchemaName()).thenReturn("schema");
}
@SneakyThrows(ReflectiveOperationException.class)
......
......@@ -55,7 +55,7 @@ public final class DatabaseCommunicationEngineFactoryTest {
schemaContexts.set(ProxyContext.getInstance(),
new StandardSchemaContexts(getSchemaContextMap(), new Authentication(), new ConfigurationProperties(new Properties()), new MySQLDatabaseType()));
BackendConnection backendConnection = mock(BackendConnection.class, RETURNS_DEEP_STUBS);
when(backendConnection.getSchema()).thenReturn("schema");
when(backendConnection.getSchemaName()).thenReturn("schema");
when(backendConnection.isSerialExecute()).thenReturn(true);
}
......@@ -69,7 +69,7 @@ public final class DatabaseCommunicationEngineFactoryTest {
@Test
public void assertNewTextProtocolInstance() {
BackendConnection backendConnection = mock(BackendConnection.class);
when(backendConnection.getSchema()).thenReturn("schema");
when(backendConnection.getSchemaName()).thenReturn("schema");
DatabaseCommunicationEngine engine =
DatabaseCommunicationEngineFactory.getInstance().newTextProtocolInstance(mock(SQLStatement.class), "schemaName", backendConnection);
assertNotNull(engine);
......@@ -79,7 +79,7 @@ public final class DatabaseCommunicationEngineFactoryTest {
@Test
public void assertNewBinaryProtocolInstance() {
BackendConnection backendConnection = mock(BackendConnection.class);
when(backendConnection.getSchema()).thenReturn("schema");
when(backendConnection.getSchemaName()).thenReturn("schema");
DatabaseCommunicationEngine engine =
DatabaseCommunicationEngineFactory.getInstance().newBinaryProtocolInstance(mock(SQLStatement.class), "schemaName", Collections.emptyList(), backendConnection);
assertNotNull(engine);
......
......@@ -58,7 +58,7 @@ public final class BackendTransactionManagerTest {
@Before
public void setUp() {
setTransactionContexts();
when(backendConnection.getSchema()).thenReturn("schema");
when(backendConnection.getSchemaName()).thenReturn("schema");
when(backendConnection.getStateHandler()).thenReturn(stateHandler);
}
......
......@@ -73,7 +73,7 @@ public final class BroadcastBackendHandlerTest {
schemaContexts.setAccessible(true);
schemaContexts.set(ProxyContext.getInstance(),
new StandardSchemaContexts(getSchemaContextMap(), new Authentication(), new ConfigurationProperties(new Properties()), new MySQLDatabaseType()));
when(backendConnection.getSchema()).thenReturn(String.format(SCHEMA_PATTERN, 0));
when(backendConnection.getSchemaName()).thenReturn(String.format(SCHEMA_PATTERN, 0));
}
@Test
......
......@@ -64,7 +64,7 @@ public final class RDLBackendHandlerTest {
@Test
public void assertExecuteCreateDatabaseContext() throws SQLException {
BackendConnection connection = mock(BackendConnection.class);
when(connection.getSchema()).thenReturn("schema");
when(connection.getSchemaName()).thenReturn("schema");
RDLBackendHandler executeEngine = new RDLBackendHandler(connection, new CreateDatabaseStatement("new_db"));
try {
executeEngine.execute();
......@@ -79,7 +79,7 @@ public final class RDLBackendHandlerTest {
@Test
public void assertExecuteDropDatabaseContext() throws SQLException {
BackendConnection connection = mock(BackendConnection.class);
when(connection.getSchema()).thenReturn("schema");
when(connection.getSchemaName()).thenReturn("schema");
RDLBackendHandler executeEngine = new RDLBackendHandler(connection, new DropDatabaseStatement("schema"));
try {
executeEngine.execute();
......@@ -94,7 +94,7 @@ public final class RDLBackendHandlerTest {
@Test
public void assertExecuteCreateDatabaseContextWithException() throws SQLException {
BackendConnection connection = mock(BackendConnection.class);
when(connection.getSchema()).thenReturn("schema");
when(connection.getSchemaName()).thenReturn("schema");
RDLBackendHandler executeEngine = new RDLBackendHandler(connection, new CreateDatabaseStatement("schema"));
try {
executeEngine.execute();
......@@ -117,7 +117,7 @@ public final class RDLBackendHandlerTest {
@Test
public void assertExecuteDataSourcesContext() throws SQLException {
BackendConnection connection = mock(BackendConnection.class);
when(connection.getSchema()).thenReturn("schema");
when(connection.getSchemaName()).thenReturn("schema");
RDLBackendHandler executeEngine = new RDLBackendHandler(connection, mock(CreateDataSourcesStatement.class));
try {
executeEngine.execute();
......@@ -132,7 +132,7 @@ public final class RDLBackendHandlerTest {
@Test
public void assertExecuteShardingRuleContext() throws SQLException {
BackendConnection connection = mock(BackendConnection.class);
when(connection.getSchema()).thenReturn("schema");
when(connection.getSchemaName()).thenReturn("schema");
RDLBackendHandler executeEngine = new RDLBackendHandler(connection, mock(CreateShardingRuleStatement.class));
try {
executeEngine.execute();
......
......@@ -59,7 +59,7 @@ public class ShowTablesBackendHandlerTest {
when(backendConnection.getUsername()).thenReturn("root");
tablesBackendHandler = new ShowTablesBackendHandler("show tables", mock(SQLStatement.class), backendConnection);
Map<String, SchemaContext> schemaContextMap = getSchemaContextMap();
when(backendConnection.getSchema()).thenReturn(String.format(SCHEMA_PATTERN, 0));
when(backendConnection.getSchemaName()).thenReturn(String.format(SCHEMA_PATTERN, 0));
Field schemaContexts = ProxyContext.getInstance().getClass().getDeclaredField("schemaContexts");
schemaContexts.setAccessible(true);
schemaContexts.set(ProxyContext.getInstance(), new StandardSchemaContexts(schemaContextMap, getAuthentication(), new ConfigurationProperties(new Properties()), new MySQLDatabaseType()));
......
......@@ -52,7 +52,7 @@ public final class ShardingCTLExplainBackendHandlerTest {
@SneakyThrows(ReflectiveOperationException.class)
public void setUp() {
BackendConnection connection = mock(BackendConnection.class);
when(connection.getSchema()).thenReturn("schema");
when(connection.getSchemaName()).thenReturn("schema");
handler = new ShardingCTLExplainBackendHandler("sctl:explain select 1", connection);
Field schemaContexts = ProxyContext.getInstance().getClass().getDeclaredField("schemaContexts");
schemaContexts.setAccessible(true);
......
......@@ -169,7 +169,7 @@ public final class ShardingCTLHintBackendHandlerTest {
@SneakyThrows(ReflectiveOperationException.class)
public void assertShowTableStatus() throws SQLException {
clearThreadLocal();
when(backendConnection.getSchema()).thenReturn("schema");
when(backendConnection.getSchemaName()).thenReturn("schema");
Field schemaContexts = ProxyContext.getInstance().getClass().getDeclaredField("schemaContexts");
schemaContexts.setAccessible(true);
schemaContexts.set(ProxyContext.getInstance(),
......
......@@ -62,7 +62,7 @@ public final class MySQLComStmtExecuteExecutor implements QueryCommandExecutor {
private int currentSequenceId;
public MySQLComStmtExecuteExecutor(final MySQLComStmtExecutePacket comStmtExecutePacket, final BackendConnection backendConnection) {
SQLStatement sqlStatement = ProxyContext.getInstance().getSchema(backendConnection.getSchema()).getRuntimeContext().getSqlParserEngine().parse(comStmtExecutePacket.getSql(), true);
SQLStatement sqlStatement = ProxyContext.getInstance().getSchema(backendConnection.getSchemaName()).getRuntimeContext().getSqlParserEngine().parse(comStmtExecutePacket.getSql(), true);
databaseCommunicationEngine = DatabaseCommunicationEngineFactory.getInstance().newBinaryProtocolInstance(
sqlStatement, comStmtExecutePacket.getSql(), comStmtExecutePacket.getParameters(), backendConnection);
}
......
......@@ -52,7 +52,7 @@ public final class MySQLComStmtPrepareExecutor implements CommandExecutor {
public MySQLComStmtPrepareExecutor(final MySQLComStmtPreparePacket packet, final BackendConnection backendConnection) {
this.packet = packet;
schema = ProxyContext.getInstance().getSchema(backendConnection.getSchema());
schema = ProxyContext.getInstance().getSchema(backendConnection.getSchemaName());
}
@Override
......
......@@ -50,9 +50,9 @@ public final class MySQLComFieldListPacketExecutor implements CommandExecutor {
public MySQLComFieldListPacketExecutor(final MySQLComFieldListPacket packet, final BackendConnection backendConnection) {
this.packet = packet;
schemaName = backendConnection.getSchema();
schemaName = backendConnection.getSchemaName();
String sql = String.format(SQL, packet.getTable(), schemaName);
SQLStatement sqlStatement = ProxyContext.getInstance().getSchema(backendConnection.getSchema()).getRuntimeContext().getSqlParserEngine().parse(sql, false);
SQLStatement sqlStatement = ProxyContext.getInstance().getSchema(backendConnection.getSchemaName()).getRuntimeContext().getSqlParserEngine().parse(sql, false);
databaseCommunicationEngine = DatabaseCommunicationEngineFactory.getInstance().newTextProtocolInstance(sqlStatement, sql, backendConnection);
}
......
......@@ -71,7 +71,7 @@ public final class MySQLCommandExecutorFactoryTest {
schemaContexts.set(ProxyContext.getInstance(),
new StandardSchemaContexts(getSchemaContextMap(), new Authentication(), new ConfigurationProperties(new Properties()), new MySQLDatabaseType()));
BackendConnection backendConnection = mock(BackendConnection.class);
when(backendConnection.getSchema()).thenReturn("schema");
when(backendConnection.getSchemaName()).thenReturn("schema");
assertThat(MySQLCommandExecutorFactory.newInstance(MySQLCommandPacketType.COM_QUIT,
mock(CommandPacket.class), backendConnection), instanceOf(MySQLComQuitExecutor.class));
assertThat(MySQLCommandExecutorFactory.newInstance(MySQLCommandPacketType.COM_INIT_DB,
......
......@@ -76,7 +76,7 @@ public final class MySQLComStmtExecuteExecutorTest {
@Test
public void assertIsQueryResponse() throws NoSuchFieldException, SQLException {
BackendConnection backendConnection = mock(BackendConnection.class);
when(backendConnection.getSchema()).thenReturn("schema");
when(backendConnection.getSchemaName()).thenReturn("schema");
MySQLComStmtExecuteExecutor mysqlComStmtExecuteExecutor = new MySQLComStmtExecuteExecutor(mock(MySQLComStmtExecutePacket.class), backendConnection);
FieldSetter.setField(mysqlComStmtExecuteExecutor, MySQLComStmtExecuteExecutor.class.getDeclaredField("databaseCommunicationEngine"), databaseCommunicationEngine);
when(databaseCommunicationEngine.execute()).thenReturn(new QueryResponse(Collections.singletonList(mock(QueryHeader.class))));
......@@ -87,7 +87,7 @@ public final class MySQLComStmtExecuteExecutorTest {
@Test
public void assertIsUpdateResponse() throws NoSuchFieldException, SQLException {
BackendConnection backendConnection = mock(BackendConnection.class);
when(backendConnection.getSchema()).thenReturn("schema");
when(backendConnection.getSchemaName()).thenReturn("schema");
MySQLComStmtExecuteExecutor mysqlComStmtExecuteExecutor = new MySQLComStmtExecuteExecutor(mock(MySQLComStmtExecutePacket.class), backendConnection);
FieldSetter.setField(mysqlComStmtExecuteExecutor, MySQLComStmtExecuteExecutor.class.getDeclaredField("databaseCommunicationEngine"), databaseCommunicationEngine);
when(databaseCommunicationEngine.execute()).thenReturn(new UpdateResponse());
......
......@@ -67,7 +67,7 @@ public final class PostgreSQLComBindExecutor implements QueryCommandExecutor {
public PostgreSQLComBindExecutor(final PostgreSQLComBindPacket packet, final BackendConnection backendConnection) {
this.packet = packet;
SchemaContext schemaContext = ProxyContext.getInstance().getSchema(backendConnection.getSchema());
SchemaContext schemaContext = ProxyContext.getInstance().getSchema(backendConnection.getSchemaName());
if (null != packet.getSql() && null != schemaContext) {
SQLStatement sqlStatement = schemaContext.getRuntimeContext().getSqlParserEngine().parse(packet.getSql(), true);
databaseCommunicationEngine =
......
......@@ -44,7 +44,7 @@ public final class PostgreSQLComParseExecutor implements CommandExecutor {
public PostgreSQLComParseExecutor(final PostgreSQLComParsePacket packet, final BackendConnection backendConnection) {
this.packet = packet;
schema = ProxyContext.getInstance().getSchema(backendConnection.getSchema());
schema = ProxyContext.getInstance().getSchema(backendConnection.getSchemaName());
binaryStatementRegistry = BinaryStatementRegistry.getInstance().get(backendConnection.getConnectionId());
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册