bugfix: fix could not rollback when insert the table with multiple key#6077
bugfix: fix could not rollback when insert the table with multiple key#6077funky-eyes merged 20 commits intoapache:2.xfrom
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## 2.x #6077 +/- ##
============================================
+ Coverage 49.29% 49.38% +0.09%
- Complexity 4800 4805 +5
============================================
Files 913 913
Lines 31677 31678 +1
Branches 3825 3826 +1
============================================
+ Hits 15614 15645 +31
+ Misses 14514 14487 -27
+ Partials 1549 1546 -3
|
rm-datasource/src/main/java/io/seata/rm/datasource/exec/BaseTransactionalExecutor.java
Outdated
Show resolved
Hide resolved
rm-datasource/src/main/java/io/seata/rm/datasource/exec/BaseTransactionalExecutor.java
Outdated
Show resolved
Hide resolved
rm-datasource/src/main/java/io/seata/rm/datasource/exec/BaseTransactionalExecutor.java
Outdated
Show resolved
Hide resolved
| * @param columnName the column name | ||
| * @return the column name in sql | ||
| */ | ||
| protected String getColumnNameInSQL(String columnName) { |
There was a problem hiding this comment.
为什么要移动这段代码位置?而不是在它后面增加新方法?
Why move this piece of code instead of adding the new method after it?
There was a problem hiding this comment.
because reordering the type of method it looks more beautiful.
There was a problem hiding this comment.
because reordering the type of method it looks more beautiful.
那为什么不是将getColumnNamesInSQLList 挪到上面?
So why not move getColumnNamesInSQLList to the top?
There was a problem hiding this comment.
3 method of getColumnNamesWithTablePrefix and 3 method of getColumnNameInSQL. I just put it together
rm-datasource/src/main/java/io/seata/rm/datasource/exec/BaseTransactionalExecutor.java
Outdated
Show resolved
Hide resolved
rm-datasource/src/main/java/io/seata/rm/datasource/exec/BaseTransactionalExecutor.java
Outdated
Show resolved
Hide resolved
| return limitCondition; | ||
| } | ||
|
|
||
| /** |
There was a problem hiding this comment.
| /** | |
| /** | |
| * Gets column name in sql. | |
| * | |
| * @param columnName the column name | |
| * @return the column name in sql | |
| */ | |
| protected String getColumnNameInSQL(String columnName) { | |
| String tableAlias = sqlRecognizer.getTableAlias(); | |
| return tableAlias == null ? columnName : tableAlias + "." + columnName; | |
| } | |
| /** | |
| * Gets column names in sql. | |
| * | |
| * @param columnNames the column names | |
| * @return | |
| */ | |
| protected List<String> getColumnNamesInSQLList(List<String> columnNames) { | |
| List<String> columnNameWithTableAlias = new ArrayList<>(); | |
| for (String columnName : columnNames) { | |
| columnNameWithTableAlias.add(this.getColumnNameInSQL(columnName)); | |
| } | |
| return columnNameWithTableAlias; | |
| } | |
| /** | ||
| * Gets column name in sql. | ||
| * | ||
| * @param columnName the column name | ||
| * @return the column name in sql | ||
| */ | ||
| protected String getColumnNameInSQL(String columnName) { | ||
| String tableAlias = sqlRecognizer.getTableAlias(); | ||
| return tableAlias == null ? columnName : tableAlias + "." + columnName; | ||
| } |
There was a problem hiding this comment.
| /** | |
| * Gets column name in sql. | |
| * | |
| * @param columnName the column name | |
| * @return the column name in sql | |
| */ | |
| protected String getColumnNameInSQL(String columnName) { | |
| String tableAlias = sqlRecognizer.getTableAlias(); | |
| return tableAlias == null ? columnName : tableAlias + "." + columnName; | |
| } |
| /** | ||
| * Gets column names in sql. | ||
| * | ||
| * @param columnNames the column names | ||
| * @return | ||
| */ | ||
| protected List<String> getColumnNamesInSQLList(List<String> columnNames) { | ||
| List<String> columnNameWithTableAlias = new ArrayList<>(); | ||
| for (String columnName : columnNames) { | ||
| columnNameWithTableAlias.add(this.getColumnNameInSQL(columnName)); | ||
| } | ||
| return columnNameWithTableAlias; | ||
| } | ||
|
|
There was a problem hiding this comment.
| /** | |
| * Gets column names in sql. | |
| * | |
| * @param columnNames the column names | |
| * @return | |
| */ | |
| protected List<String> getColumnNamesInSQLList(List<String> columnNames) { | |
| List<String> columnNameWithTableAlias = new ArrayList<>(); | |
| for (String columnName : columnNames) { | |
| columnNameWithTableAlias.add(this.getColumnNameInSQL(columnName)); | |
| } | |
| return columnNameWithTableAlias; | |
| } |
4e1d3c9 to
f00d469
Compare
rm-datasource/src/main/java/io/seata/rm/datasource/exec/BaseTransactionalExecutor.java
Outdated
Show resolved
Hide resolved
rm-datasource/src/test/java/io/seata/rm/datasource/exec/UpdateExecutorTest.java
Outdated
Show resolved
Hide resolved
rm-datasource/src/test/java/io/seata/rm/datasource/exec/UpdateExecutorTest.java
Outdated
Show resolved
Hide resolved
rm-datasource/src/test/java/io/seata/rm/datasource/exec/UpdateExecutorTest.java
Outdated
Show resolved
Hide resolved
rm-datasource/src/main/java/io/seata/rm/datasource/exec/BaseTransactionalExecutor.java
Outdated
Show resolved
Hide resolved
Co-authored-by: funkye <[email protected]>
…ExecutorTest.java Co-authored-by: funkye <[email protected]>
…ansactionalExecutor.java Co-authored-by: funkye <[email protected]>
…ExecutorTest.java Co-authored-by: funkye <[email protected]>
…ExecutorTest.java Co-authored-by: funkye <[email protected]>
Ⅰ. Describe what this PR did
Ⅱ. Does this pull request fix one issue?
fixes #6076
Ⅲ. Why don't you add test cases (unit test/integration test)?
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews