shardingsphere icon indicating copy to clipboard operation
shardingsphere copied to clipboard

Index out of bounds exception when set value of encrypt parameter

Open HongJinFeng opened this issue 7 years ago • 1 comments

Index out of bounds exception when set value of encrypt parameter

Version of ShardingSphere 4.0.0-RC3

JDBC i use Encrypt-JDBC

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), version timestamp } 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 sql insert into t_demo (username,version,phone) values ('xxx',UNIX_TIMESTAMP(),'xxx')

3 Bug occur when set parameters StandardParameterBuilder.getParameters() image

image wrong index of encrypt insert value image Column index is not represent the position that encrypt value replace position, some columns' value are expression like MySQL function. image

image @terrymanu

HongJinFeng avatar Nov 30 '19 07:11 HongJinFeng

Found the reason~~, it is a little complicate to describe. This case close.

HongJinFeng avatar Dec 02 '19 03:12 HongJinFeng