From 067f8e1d27bd8d186dd64ca87a46a627d2e6c1e7 Mon Sep 17 00:00:00 2001 From: jimin Date: Thu, 31 Aug 2023 12:29:47 +0800 Subject: [PATCH 1/3] bugfix: fix oracle column alias cannot find Signed-off-by: slievrly --- changes/en-us/2.x.md | 2 ++ changes/zh-cn/2.x.md | 2 ++ .../test/java/io/seata/rm/datasource/ColumnUtilsTest.java | 4 ++-- .../src/main/java/io/seata/sqlparser/EscapeHandler.java | 7 ++++++- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/changes/en-us/2.x.md b/changes/en-us/2.x.md index d3a3565f340..74a7eed9ee2 100644 --- a/changes/en-us/2.x.md +++ b/changes/en-us/2.x.md @@ -7,6 +7,7 @@ Add changes here for all PR submitted to the 2.x branch. ### bugfix: - [[#6075](https://github.com/seata/seata/pull/6075)] fix missing table alias for on update column of image SQL +- [[#6085](https://github.com/seata/seata/pull/6085)] fix oracle column alias cannot find ### optimize: - [[#6061](https://github.com/seata/seata/pull/6061)] merge the rpcMergeMessageSend threads of rm and tm and increase the thread hibernation duration @@ -26,5 +27,6 @@ Thanks to these contributors for their code commits. Please report an unintended - [ptyin](https://github.com/ptyin) - [laywin](https://github.com/laywin) - [imcmai](https://github.com/imcmai) +- [DroidEye2ONGU](https://github.com/DroidEye2ONGU) Also, we receive many valuable issues, questions and advices from our community. Thanks for you all. diff --git a/changes/zh-cn/2.x.md b/changes/zh-cn/2.x.md index 32dcc3dce6c..4cece568c01 100644 --- a/changes/zh-cn/2.x.md +++ b/changes/zh-cn/2.x.md @@ -7,6 +7,7 @@ ### bugfix: - [[#6075](https://github.com/seata/seata/pull/6075)] 修复镜像SQL对于on update列没有添加表别名的问题 +- [[#6085](https://github.com/seata/seata/pull/6085)] 修复oracle alias 解析异常 ### optimize: - [[#6061](https://github.com/seata/seata/pull/6061)] 合并rm和tm的rpcMergeMessageSend线程,增加线程休眠时长 @@ -27,6 +28,7 @@ - [ptyin](https://github.com/ptyin) - [laywin](https://github.com/laywin) - [imcmai](https://github.com/imcmai) +- [DroidEye2ONGU](https://github.com/DroidEye2ONGU) 同时,我们收到了社区反馈的很多有价值的issue和建议,非常感谢大家。 diff --git a/rm-datasource/src/test/java/io/seata/rm/datasource/ColumnUtilsTest.java b/rm-datasource/src/test/java/io/seata/rm/datasource/ColumnUtilsTest.java index 706632b31f9..69e20ccd84d 100644 --- a/rm-datasource/src/test/java/io/seata/rm/datasource/ColumnUtilsTest.java +++ b/rm-datasource/src/test/java/io/seata/rm/datasource/ColumnUtilsTest.java @@ -240,7 +240,7 @@ public void test_addEscape_byDbType() throws Exception { cols = new ArrayList<>(); cols.add("SCHEME.\"ID\""); cols = ColumnUtils.addEscape(cols, JdbcConstants.POSTGRESQL); - Assertions.assertEquals("\"SCHEME\".\"ID\"", cols.get(0)); + Assertions.assertEquals("SCHEME.\"ID\"", cols.get(0)); cols = new ArrayList<>(); cols.add("\"SCHEME\".ID"); @@ -255,7 +255,7 @@ public void test_addEscape_byDbType() throws Exception { cols = new ArrayList<>(); cols.add("schEme.id"); cols = ColumnUtils.addEscape(cols, JdbcConstants.POSTGRESQL); - Assertions.assertEquals("\"schEme\".\"id\"", cols.get(0)); + Assertions.assertEquals("schEme.id", cols.get(0)); } diff --git a/sqlparser/seata-sqlparser-core/src/main/java/io/seata/sqlparser/EscapeHandler.java b/sqlparser/seata-sqlparser-core/src/main/java/io/seata/sqlparser/EscapeHandler.java index 5d8685054b0..da19be45c9d 100644 --- a/sqlparser/seata-sqlparser-core/src/main/java/io/seata/sqlparser/EscapeHandler.java +++ b/sqlparser/seata-sqlparser-core/src/main/java/io/seata/sqlparser/EscapeHandler.java @@ -76,7 +76,12 @@ default String addColNameEscape(String colName) { * @return colName */ default String addColNameEscape(String colName, TableMeta tableMeta) { - boolean needEscape = checkIfNeedEscape(colName, tableMeta); + String colNameToCheck = colName; + if (colName.contains(DOT)) { + colNameToCheck = colName.substring(colName.lastIndexOf(DOT) + 1); + } + + boolean needEscape = checkIfNeedEscape(colNameToCheck, tableMeta); if (!needEscape) { return colName; } From dc2aead37dfda82ae5571fb29ede9cf8d5f8570d Mon Sep 17 00:00:00 2001 From: slievrly Date: Mon, 27 Nov 2023 15:08:41 +0800 Subject: [PATCH 2/3] add change Signed-off-by: slievrly --- changes/en-us/2.x.md | 4 +++- changes/zh-cn/2.x.md | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/changes/en-us/2.x.md b/changes/en-us/2.x.md index 74a7eed9ee2..df52863e2cb 100644 --- a/changes/en-us/2.x.md +++ b/changes/en-us/2.x.md @@ -7,7 +7,8 @@ Add changes here for all PR submitted to the 2.x branch. ### bugfix: - [[#6075](https://github.com/seata/seata/pull/6075)] fix missing table alias for on update column of image SQL -- [[#6085](https://github.com/seata/seata/pull/6085)] fix oracle column alias cannot find +- [[#6086](https://github.com/seata/seata/pull/6086)] fix oracle column alias cannot find +- [[#6085](https://github.com/seata/seata/pull/6085)] support jdk9+ compile code ### optimize: - [[#6061](https://github.com/seata/seata/pull/6061)] merge the rpcMergeMessageSend threads of rm and tm and increase the thread hibernation duration @@ -28,5 +29,6 @@ Thanks to these contributors for their code commits. Please report an unintended - [laywin](https://github.com/laywin) - [imcmai](https://github.com/imcmai) - [DroidEye2ONGU](https://github.com/DroidEye2ONGU) +- [funky-eyes](https://github.com/funky-eyes) Also, we receive many valuable issues, questions and advices from our community. Thanks for you all. diff --git a/changes/zh-cn/2.x.md b/changes/zh-cn/2.x.md index 4cece568c01..7569d66ef53 100644 --- a/changes/zh-cn/2.x.md +++ b/changes/zh-cn/2.x.md @@ -7,7 +7,8 @@ ### bugfix: - [[#6075](https://github.com/seata/seata/pull/6075)] 修复镜像SQL对于on update列没有添加表别名的问题 -- [[#6085](https://github.com/seata/seata/pull/6085)] 修复oracle alias 解析异常 +- [[#6086](https://github.com/seata/seata/pull/6086)] 修复oracle alias 解析异常 +- [[#6085](https://github.com/seata/seata/pull/4410)] 修复jdk9+版本编译后,引入后ByteBuffer#flip NoSuchMethodError的问题 ### optimize: - [[#6061](https://github.com/seata/seata/pull/6061)] 合并rm和tm的rpcMergeMessageSend线程,增加线程休眠时长 @@ -29,6 +30,7 @@ - [laywin](https://github.com/laywin) - [imcmai](https://github.com/imcmai) - [DroidEye2ONGU](https://github.com/DroidEye2ONGU) +- [funky-eyes](https://github.com/funky-eyes) 同时,我们收到了社区反馈的很多有价值的issue和建议,非常感谢大家。 From 8f6cc2cfd59b9bb2434136626fc59e59a92c0710 Mon Sep 17 00:00:00 2001 From: slievrly Date: Mon, 27 Nov 2023 15:10:51 +0800 Subject: [PATCH 3/3] add change Signed-off-by: slievrly --- changes/en-us/2.x.md | 2 +- changes/zh-cn/2.x.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/changes/en-us/2.x.md b/changes/en-us/2.x.md index df52863e2cb..e2c184fd78f 100644 --- a/changes/en-us/2.x.md +++ b/changes/en-us/2.x.md @@ -8,7 +8,7 @@ Add changes here for all PR submitted to the 2.x branch. ### bugfix: - [[#6075](https://github.com/seata/seata/pull/6075)] fix missing table alias for on update column of image SQL - [[#6086](https://github.com/seata/seata/pull/6086)] fix oracle column alias cannot find -- [[#6085](https://github.com/seata/seata/pull/6085)] support jdk9+ compile code +- [[#6085](https://github.com/seata/seata/pull/6085)] fix jdk9+ compile error ### optimize: - [[#6061](https://github.com/seata/seata/pull/6061)] merge the rpcMergeMessageSend threads of rm and tm and increase the thread hibernation duration diff --git a/changes/zh-cn/2.x.md b/changes/zh-cn/2.x.md index 7569d66ef53..57e10fb8c44 100644 --- a/changes/zh-cn/2.x.md +++ b/changes/zh-cn/2.x.md @@ -8,7 +8,7 @@ ### bugfix: - [[#6075](https://github.com/seata/seata/pull/6075)] 修复镜像SQL对于on update列没有添加表别名的问题 - [[#6086](https://github.com/seata/seata/pull/6086)] 修复oracle alias 解析异常 -- [[#6085](https://github.com/seata/seata/pull/4410)] 修复jdk9+版本编译后,引入后ByteBuffer#flip NoSuchMethodError的问题 +- [[#6085](https://github.com/seata/seata/pull/6085)] 修复jdk9+版本编译后,引入后ByteBuffer#flip NoSuchMethodError的问题 ### optimize: - [[#6061](https://github.com/seata/seata/pull/6061)] 合并rm和tm的rpcMergeMessageSend线程,增加线程休眠时长