Sharding-Sphere报错总结
①
sharding-sphere不支持多条update语句批量更新,不报错,多条只更新一条。
update msp_voucher_0 set destory_date = '2022-05-12 00:00:00.0', status = 5
WHERE coupon_no = '17659452900000' and thrid_voucher_no = 'test1' ;
update msp_voucher_0 set destory_date = '2022-05-12 00:00:00.0', status = 5
WHERE coupon_no = '17659452900000' and thrid_voucher_no = 'test2' ;
update msp_voucher_0 set destory_date = '2022-05-12 00:00:00.0', status = 5
WHERE coupon_no = '17659452900000' and thrid_voucher_no = 'test3';
② INESRT INTO … ON DUPLICATE KEY UPDATE use the dynamic parameter
使用insertOrUpdateBatch 无则插入,有则更新时报错,原因未知
③ java.lang.String.mod() is applicable for argument types: (java.lang.Integer) values: [32]
类型转换错误:coupon_no数据库为varchar,不能取余
Spring:
shardingsphere:
sharding:
default-data-source-name: ds1
tables:
msp_voucher: # 逻辑表名
actual-data-nodes: ds0.msp_voucher_$->{0..31} # 真实表名,一般是逻辑表名后对一个有一定规则的后缀
table-strategy:
inline:
sharding-column: coupon_no
algorithm-expression: msp_voucher_$->{coupon_no % 32}
版权声明:本文为qq_41901039原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。