wuguowei19880907 opened a new issue #13962:
URL: https://github.com/apache/shardingsphere/issues/13962


   ### Which version of ShardingSphere did you use?
   sharding-5.0.0  java8
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-JDBC
   
   ### Expected behavior
   I use `Statement` execute a update sql like this:
   ```
           final String sql = "update SUPPLIER set S_ADDRESS = 'wangyaoyao' 
where S_SUPPKEY = 62";
           try (Connection connection = dataSource.getConnection()) {
               try (Statement statement = connection.createStatement()) {
                   final boolean i = statement.execute(sql);
                   assertThat(i, equalTo(false));
               }
           }
   ```
   Encrypt rules like this:
   ```
   spring:
     shardingsphere:
       datasource:
         name: ds
         ds:
           type: com.zaxxer.hikari.HikariDataSource
           driver-class-name: oracle.jdbc.OracleDriver
           jdbcUrl: jdbc:oracle:thin:@xxxx:1521:ORCL
           username: xxx
           password: xxx
       props:
         sql-show: true
         local-encryption: true
       rules:
         encrypt:
           encryptors:
             part-p-name:
               props:
                 sm4-key-value: '316F7F9689F35AB9710A9718A190BE93'
               type: sm4
           tables:
             PART:
               columns:
                 P_NAME:
                   cipher-column: P_NAME
                   encryptor-name: part-p-name
                   hashedkey: '580079384'
                   logic-column: P_NAME
                   column-type: 12
                   column-type-name: 'VARCHAR'
                   column-class-name: 'java.lang.String'
             SUPPLIER:
               columns:
                 S_ADDRESS:
                   cipher-column: S_ADDRESS
                   encryptor-name: part-p-name
                   hashedkey: '580079384'
                   logic-column: S_ADDRESS
                   column-type: 12
                   column-type-name: 'VARCHAR'
                   column-class-name: 'java.lang.String'
             TEST_A:
               columns:
                 A_NAME:
                   cipher-column: A_NAME
                   encryptor-name: part-p-name
                   hashedkey: '580079384'
                   logic-column: A_NAME
                   column-type: 12
                   column-type-name: 'VARCHAR'
                   column-class-name: 'java.lang.String'
   ```
   ### Actual behavior
   
![image](https://user-images.githubusercontent.com/19338820/144953305-93cfba83-3e48-46ab-9f26-fe79fe1e96e8.png)
   
   ### Reason analyze (If you can)
   I think it is because the parser cannot parse the sql in correct way.
   if i use the `PreparedStatement`,it is right:
   ```
           final String sql = "update SUPPLIER set S_ADDRESS = 'wangyaoyao' 
where S_SUPPKEY = 62";
           try (Connection connection = dataSource.getConnection()) {
               try (PreparedStatement statement = 
connection.prepareStatement(sql)) {
                   final boolean i = statement.execute();
                   assertThat(i, equalTo(false));
               }
           }
   ```
   
![image](https://user-images.githubusercontent.com/19338820/144953618-616b2ad6-9c73-4938-831e-5308c16788b1.png)
   ## Note: Sharding5.0.0-beta doesn't have this problem
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to