This is an automated email from the ASF dual-hosted git repository.

panjuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 762ca52  Add judgment before set schema (#12571)
762ca52 is described below

commit 762ca52f4cb9a6f00532358fd579d2b682a7886f
Author: lanchengx <[email protected]>
AuthorDate: Sun Sep 19 08:09:35 2021 -0500

    Add judgment before set schema (#12571)
    
    * Not in set when `schema` exists
    
    * revert space
    
    * revert space
---
 .../proxy/backend/communication/jdbc/connection/BackendConnection.java | 3 +++
 1 file changed, 3 insertions(+)

diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/connection/BackendConnection.java
 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/connection/BackendConnection.java
index a37a2dc..109a587 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/connection/BackendConnection.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/connection/BackendConnection.java
@@ -103,6 +103,9 @@ public final class BackendConnection implements 
ExecutorJDBCManager {
      * @param schemaName schema name
      */
     public void setCurrentSchema(final String schemaName) {
+        if (null != schemaName && schemaName.equals(this.schemaName)) {
+            return;
+        }
         if (transactionStatus.isInTransaction()) {
             throw new ShardingSphereException("Failed to switch schema, please 
terminate current transaction.");
         }

Reply via email to