Encryp-JDBC rewrite wrong sql when sql contain character '('
Encrypt-JDBC rewrite wrong sql when sql contain character '('. Besides, it works normally with the version of 4.0.0-RC2.
Version of ShardingSphere 4.0.0-RC3
JDBC I use Encrypt-JDBC
Expected behavior Rewrite the sql correct which is contain character '('
Actual behavior The rewrite sql error when sql contain character '('
Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
1.MySQL table and encrypt configuration table: create table t_demo{ username varchar(20), phone varchar(20), username_encrypt(64), phone_encrypt(64) } encrypt configuration spring.shardingsphere.datasource.name = ds spring.shardingsphere.datasource.ds.type = com.alibaba.druid.pool.DruidDataSource spring.shardingsphere.datasource.ds.driver-class-name = com.mysql.jdbc.Driver spring.shardingsphere.datasource.ds.url = xxx spring.shardingsphere.datasource.ds.username = xxx spring.shardingsphere.datasource.ds.password = xxx spring.shardingsphere.encrypt.encryptors.encryptor_aes.type = AES spring.shardingsphere.encrypt.tables.t_demo.columns.username.plainColumn = username spring.shardingsphere.encrypt.tables.t_demo.columns.username.cipherColumn = username_encrypt spring.shardingsphere.encrypt.tables.t_demo.columns.phone.plainColumn = phone spring.shardingsphere.encrypt.tables.t_demo.columns.phone.cipherColumn = phone_encrypt spring.shardingsphere.encrypt.tables.t_demo.columns.phone.encryptor = encryptor_aes spring.shardingsphere.encrypt.tables.t_demo.columns.username.encryptor = encryptor_aes
2.My dao method definition
List
3.My mybatis sql
4.Encrypt-JDBC rewrite sql(The rewrite sql get more left parenthesis) method: EncryptPreparedStatement.getSQLUnit(final String sql)
sql: select * from t_demo t where (t.username_encrypt in (('xxx','xxxx') or t.phone_encrypt in (('xxx','xxxx')) and delete = 0;
i hava two question for this issue,First,this spring.shardingsphere.encrypt.encryptors.encryptor_aes.props.aes.key.value = ? Second, SELECT * FROM t_demo t WHERE (t.username IN #{phone} OR t.phone IN #{phone} ) AND delete = 0 this sql is error,Is that Right, SELECT * FROM t_demo t WHERE (t.username IN ('13718687573') OR t.phone IN ('13718687573'))
Frist question: Copy from my project(I use spi to extend encryptor). It is not needed here.
Secondary questuon: I dont know with my content was formated to '
SELECT * FROM t_demo t WHERE (t.username IN #{phone} OR t.phone IN #{phone} ) AND delete = 0'
Actual content is

ok, I verified this,let me see
@terrymanu Please assign me to solve @HongJinFeng @zjcnb question.

//to fix the bug for my project, I change the source core tentatively, so it is a litter different.

@zjcnb Here get one more left parenthesis. When get conjunction text of 'username in (?,?)', the content already has a left parenthesis, so the rewrite sql get one more left parenthesis.
@SteNicholas Thank you, assigned