[seata]1.7.0 版本 orcal 数据 beforImage 方法 标识符无效

2024-02-02 181 views
9

执行insert语句时 beforImage 方法生成的 sql 加了双引号 会导致 sql 执行标识符无效

image

报错

image

Ⅵ. Environment:
  • JDK version(e.g. java -version):
  • Seata client/server version: client 1.7.0 1.7.0-native-rc2 server 1.7.0
  • Database version: orcal 11.2.0.1.0

回答

1

insert sql不会有beforeimage update在oracle中的before image中只有关键字或在数据库中的列名就是小写的才会加上"",你能发一下你的表结构和原sql吗?

5

image image image

4

如果你的列名本身是大写,你可以看下OracleTableMetaCache#resultSetMetaToSchema 118行里你的columnname到底是大写还是小写,是否与库中表column不同

2

@wawua Pls provides table structure and SQL statements.

5

这是我的表结构,orcal 中字段都是大写的

CREATE TABLE "KFXT_PDKF_TEST"."PATIENT" ( "ID" NUMBER(11,0) NOT NULL, "CODE" NVARCHAR2(64), "NAME" NVARCHAR2(32), "ID_CARD_TYPE" NUMBER(11,0), "ID_CARD" NVARCHAR2(32), "BIRTHDAY" DATE, "SEX" NUMBER(11,0), "TEL" NVARCHAR2(32), "NATION" NVARCHAR2(64), "ADDRESS" NVARCHAR2(255), "MARRIAGE" NUMBER(11,0), "OCCUPATION" NVARCHAR2(255), "CREATE_TIME" DATE, "UPDATE_TIME" DATE, "IS_DELETE" NUMBER(4,0) DEFAULT 0 NOT NULL, "AGE" NUMBER ); COMMENT ON COLUMN "KFXT_PDKF_TEST"."PATIENT"."ID" IS '患者主表'; COMMENT ON COLUMN "KFXT_PDKF_TEST"."PATIENT"."CODE" IS '患者编码'; COMMENT ON COLUMN "KFXT_PDKF_TEST"."PATIENT"."NAME" IS '姓名'; COMMENT ON COLUMN "KFXT_PDKF_TEST"."PATIENT"."ID_CARD_TYPE" IS '证件号类型'; COMMENT ON COLUMN "KFXT_PDKF_TEST"."PATIENT"."ID_CARD" IS '证件号'; COMMENT ON COLUMN "KFXT_PDKF_TEST"."PATIENT"."BIRTHDAY" IS '出生日期'; COMMENT ON COLUMN "KFXT_PDKF_TEST"."PATIENT"."SEX" IS '性别 1.男 2.女 参考EnumEmployeeSex'; COMMENT ON COLUMN "KFXT_PDKF_TEST"."PATIENT"."TEL" IS '联系方式'; COMMENT ON COLUMN "KFXT_PDKF_TEST"."PATIENT"."NATION" IS '民族'; COMMENT ON COLUMN "KFXT_PDKF_TEST"."PATIENT"."ADDRESS" IS '联系地址'; COMMENT ON COLUMN "KFXT_PDKF_TEST"."PATIENT"."MARRIAGE" IS '婚姻状况 参考EnumPersonalMarriage'; COMMENT ON COLUMN "KFXT_PDKF_TEST"."PATIENT"."OCCUPATION" IS '职业'; COMMENT ON COLUMN "KFXT_PDKF_TEST"."PATIENT"."CREATE_TIME" IS '创建日期'; COMMENT ON COLUMN "KFXT_PDKF_TEST"."PATIENT"."UPDATE_TIME" IS '更新日期'; COMMENT ON COLUMN "KFXT_PDKF_TEST"."PATIENT"."IS_DELETE" IS '是否删除 1.是'; COMMENT ON COLUMN "KFXT_PDKF_TEST"."PATIENT"."AGE" IS '年龄';

ALTER TABLE "KFXT_PDKF_TEST"."PATIENT" ADD CONSTRAINT "SYS_C00105612" PRIMARY KEY ("ID");

这是执行的SQL

SQL: UPDATE patient SET code=?, name=?, id_card=?, birthday=?, age=?, sex=?, tel=?, marriage=?, create_time=?, update_time=? WHERE id=? AND is_delete=0
9

image 你看下这里是从rsColumns读到的是大写还是小写

6

把下面map里的columnmeta打开给我看下具体的内容,主要是casesensitive是不是false,如果是false理论上是不会加转义符的 OracleEscapeHandler你能debug这个类的checkIfNeedEscape中的534行吗,也就是 return columnMeta.isCaseSensitive(); 这一行的结果是什么

0

image

9

oracle 12c

3

我的columnmeta 对象里面没有 casesensitive属性

image

image

5

你版本不对,你要用1.7.0,不是rc2那个

8

更换1.7.0后不会有这问题了, 感谢 @slievrly @a364176773