RaigorJiang opened a new issue, #27587:
URL: https://github.com/apache/shardingsphere/issues/27587
## Bug Report
### Which version of ShardingSphere did you use?
master b27ed055
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-Proxy
### Expected behavior
insert successfully
### Actual behavior
```sql
ERROR 1366 (HY000): Incorrect integer value: 'Lm04PRW+sp+mG/QuimAUew==' for
column 'user_cipher' at row 1
```
### Reason analyze (If you can)
Because the logical column is of type `int` and the cipher text is of type
`varchar`
### Steps to reproduce the behavior, such as: SQL to execute, sharding rule
configuration, when exception occur etc.
- Config
```yaml
databaseName: encrypt_db
dataSources:
ds_0:
url:
jdbc:mysql://127.0.0.1:3306/demo_ds_0?serverTimezone=UTC&useSSL=false
username: root
password:
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 5
minPoolSize: 1
rules:
- !ENCRYPT
encryptors:
aes_encryptor:
type: AES
props:
aes-key-value: 123456abc
rc4_encryptor:
type: RC4
props:
rc4-key-value: 123456abc
assisted_encryptor:
type: MD5
like_encryptor:
type: CHAR_DIGEST_LIKE
props:
mask: 4093
tables:
t_encrypt:
columns:
user_id:
cipher:
name: user_cipher
encryptorName: aes_encryptor
assistedQuery:
name: user_assisted
encryptorName: assisted_encryptor
likeQuery:
name: user_like
encryptorName: like_encryptor
order_id:
cipher:
name: order_encrypt
encryptorName: rc4_encryptor
```
- SQL
```sql
mysql> show encrypt rules;
+-----------+--------------+---------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+------------------+------------------+
| table | logic_column | cipher_column | assisted_query_column |
like_query_column | encryptor_type | encryptor_props |
assisted_query_type | assisted_query_props | like_query_type |
like_query_props |
+-----------+--------------+---------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+------------------+------------------+
| t_encrypt | user_id | user_cipher | user_assisted |
user_like | AES | aes-key-value=123456abc | MD5
| | CHAR_DIGEST_LIKE | mask=4093 |
| t_encrypt | order_id | order_encrypt | |
| RC4 | rc4-key-value=123456abc | |
| | |
+-----------+--------------+---------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+------------------+------------------+
2 rows in set (0.00 sec)
mysql> CREATE TABLE t_encrypt (
-> id bigint(20) NOT NULL,
-> user_id int(11) NOT NULL,
-> order_id int(11) NOT NULL,
-> PRIMARY KEY (`id`)
-> );
Query OK, 0 rows affected (0.14 sec)
mysql> INSERT INTO t_encrypt (id, user_id, order_id) VALUES
-> (1,1,'1'),
-> (2,2,'2');
ERROR 1366 (HY000): Incorrect integer value: 'Lm04PRW+sp+mG/QuimAUew==' for
column 'user_cipher' at row 1
mysql>
```
- SQL log
```sql
- Logic SQL: CREATE TABLE t_encrypt (
id bigint(20) NOT NULL,
user_id int(11) NOT NULL,
order_id int(11) NOT NULL,
PRIMARY KEY (`id`)
)
- Actual SQL: ds_0 ::: CREATE TABLE t_encrypt (
id bigint(20) NOT NULL,
user_cipher int(11) NOT NULL,
user_assisted int(11) NOT NULL,
user_like int(11) NOT NULL,
order_encrypt int(11) NOT NULL,
PRIMARY KEY (`id`)
)
- Logic SQL: INSERT INTO t_encrypt (id, user_id, order_id) VALUES
(1,1,'1'),
(2,2,'2')
- Actual SQL: ds_0 ::: INSERT INTO t_encrypt (id, user_cipher,
user_assisted, user_like, order_encrypt) VALUES
(1, 'Lm04PRW+sp+mG/QuimAUew==', 'c4ca4238a0b923820dcc509a6f75849b', '0',
'Rw=='), (2, 'srEhJj6s19kVuEUlwniSFQ==', 'c81e728d9d4c2f636f067f89cc14862c',
'1', 'RA==')
- Exception occur:
java.sql.SQLException: Incorrect integer value: 'Lm04PRW+sp+mG/QuimAUew=='
for column 'user_cipher' at row 1
```
--
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]