You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/07/22 11:09:10 UTC
[GitHub] [shardingsphere] zjcnb opened a new pull request #11457: Single table insert when not used sharding rule for table
zjcnb opened a new pull request #11457:
URL: https://github.com/apache/shardingsphere/pull/11457
Fixes #11381
single table insert when not used sharding rule for table and add return batch id
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] strongduanmu merged pull request #11457: Single table insert when not used sharding rule for table
Posted by GitBox <gi...@apache.org>.
strongduanmu merged pull request #11457:
URL: https://github.com/apache/shardingsphere/pull/11457
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] codecov-commenter commented on pull request #11457: Single table insert when not used sharding rule for table
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #11457:
URL: https://github.com/apache/shardingsphere/pull/11457#issuecomment-884890312
# [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/11457?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#11457](https://codecov.io/gh/apache/shardingsphere/pull/11457?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (6bfa793) into [master](https://codecov.io/gh/apache/shardingsphere/commit/22a37bbbf7abe487c4de6ab1d48db3e9413d6f12?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (22a37bb) will **decrease** coverage by `0.01%`.
> The diff coverage is `18.75%`.
[](https://codecov.io/gh/apache/shardingsphere/pull/11457?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #11457 +/- ##
============================================
- Coverage 63.28% 63.27% -0.02%
Complexity 1091 1091
============================================
Files 2223 2223
Lines 33988 33995 +7
Branches 5926 5933 +7
============================================
Hits 21511 21511
- Misses 10749 10755 +6
- Partials 1728 1729 +1
```
| [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/11457?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...rdingGeneratedKeyInsertValueParameterRewriter.java](https://codecov.io/gh/apache/shardingsphere/pull/11457/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhcmRpbmcvcmV3cml0ZS9wYXJhbWV0ZXIvaW1wbC9TaGFyZGluZ0dlbmVyYXRlZEtleUluc2VydFZhbHVlUGFyYW1ldGVyUmV3cml0ZXIuamF2YQ==) | `0.00% <0.00%> (ø)` | |
| [...keygen/GeneratedKeyInsertColumnTokenGenerator.java](https://codecov.io/gh/apache/shardingsphere/pull/11457/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhcmRpbmcvcmV3cml0ZS90b2tlbi9nZW5lcmF0b3IvaW1wbC9rZXlnZW4vR2VuZXJhdGVkS2V5SW5zZXJ0Q29sdW1uVG9rZW5HZW5lcmF0b3IuamF2YQ==) | `0.00% <0.00%> (ø)` | |
| [...keygen/GeneratedKeyInsertValuesTokenGenerator.java](https://codecov.io/gh/apache/shardingsphere/pull/11457/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhcmRpbmcvcmV3cml0ZS90b2tlbi9nZW5lcmF0b3IvaW1wbC9rZXlnZW4vR2VuZXJhdGVkS2V5SW5zZXJ0VmFsdWVzVG9rZW5HZW5lcmF0b3IuamF2YQ==) | `0.00% <0.00%> (ø)` | |
| [...gine/impl/InsertClauseShardingConditionEngine.java](https://codecov.io/gh/apache/shardingsphere/pull/11457/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhcmRpbmcvcm91dGUvZW5naW5lL2NvbmRpdGlvbi9lbmdpbmUvaW1wbC9JbnNlcnRDbGF1c2VTaGFyZGluZ0NvbmRpdGlvbkVuZ2luZS5qYXZh) | `52.00% <0.00%> (ø)` | |
| [...ore/statement/ShardingSpherePreparedStatement.java](https://codecov.io/gh/apache/shardingsphere/pull/11457/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtamRiYy9zaGFyZGluZ3NwaGVyZS1qZGJjLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2RyaXZlci9qZGJjL2NvcmUvc3RhdGVtZW50L1NoYXJkaW5nU3BoZXJlUHJlcGFyZWRTdGF0ZW1lbnQuamF2YQ==) | `78.43% <25.00%> (-0.78%)` | :arrow_down: |
| [...ta/schema/builder/loader/ColumnMetaDataLoader.java](https://codecov.io/gh/apache/shardingsphere/pull/11457/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9tZXRhZGF0YS9zY2hlbWEvYnVpbGRlci9sb2FkZXIvQ29sdW1uTWV0YURhdGFMb2FkZXIuamF2YQ==) | `87.50% <100.00%> (ø)` | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/11457?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/11457?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [22a37bb...6bfa793](https://codecov.io/gh/apache/shardingsphere/pull/11457?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] zjcnb commented on a change in pull request #11457: Single table insert when not used sharding rule for table
Posted by GitBox <gi...@apache.org>.
zjcnb commented on a change in pull request #11457:
URL: https://github.com/apache/shardingsphere/pull/11457#discussion_r675283227
##########
File path: shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/statement/ShardingSpherePreparedStatement.java
##########
@@ -410,11 +410,13 @@ private void clearPrevious() throws SQLException {
@Override
public ResultSet getGeneratedKeys() throws SQLException {
Optional<GeneratedKeyContext> generatedKey = findGeneratedKey(executionContext);
- if (statementOption.isReturnGeneratedKeys() && generatedKey.isPresent()) {
+ if (statementOption.isReturnGeneratedKeys() && generatedKey.isPresent() && !generatedValues.isEmpty()) {
return new GeneratedKeysResultSet(generatedKey.get().getColumnName(), generatedValues.iterator(), this);
}
- if (1 == statements.size()) {
- return statements.iterator().next().getGeneratedKeys();
+ for (PreparedStatement statement : statements) {
Review comment:
yes, i will do it
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] codecov-commenter edited a comment on pull request #11457: Single table insert when not used sharding rule for table
Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #11457:
URL: https://github.com/apache/shardingsphere/pull/11457#issuecomment-884890312
# [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/11457?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#11457](https://codecov.io/gh/apache/shardingsphere/pull/11457?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (37144a3) into [master](https://codecov.io/gh/apache/shardingsphere/commit/22a37bbbf7abe487c4de6ab1d48db3e9413d6f12?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (22a37bb) will **decrease** coverage by `0.09%`.
> The diff coverage is `18.75%`.
[](https://codecov.io/gh/apache/shardingsphere/pull/11457?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #11457 +/- ##
============================================
- Coverage 63.28% 63.19% -0.10%
- Complexity 1091 1095 +4
============================================
Files 2223 2226 +3
Lines 33988 34072 +84
Branches 5926 5944 +18
============================================
+ Hits 21511 21533 +22
- Misses 10749 10797 +48
- Partials 1728 1742 +14
```
| [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/11457?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...rdingGeneratedKeyInsertValueParameterRewriter.java](https://codecov.io/gh/apache/shardingsphere/pull/11457/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhcmRpbmcvcmV3cml0ZS9wYXJhbWV0ZXIvaW1wbC9TaGFyZGluZ0dlbmVyYXRlZEtleUluc2VydFZhbHVlUGFyYW1ldGVyUmV3cml0ZXIuamF2YQ==) | `0.00% <0.00%> (ø)` | |
| [...keygen/GeneratedKeyInsertColumnTokenGenerator.java](https://codecov.io/gh/apache/shardingsphere/pull/11457/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhcmRpbmcvcmV3cml0ZS90b2tlbi9nZW5lcmF0b3IvaW1wbC9rZXlnZW4vR2VuZXJhdGVkS2V5SW5zZXJ0Q29sdW1uVG9rZW5HZW5lcmF0b3IuamF2YQ==) | `0.00% <0.00%> (ø)` | |
| [...keygen/GeneratedKeyInsertValuesTokenGenerator.java](https://codecov.io/gh/apache/shardingsphere/pull/11457/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhcmRpbmcvcmV3cml0ZS90b2tlbi9nZW5lcmF0b3IvaW1wbC9rZXlnZW4vR2VuZXJhdGVkS2V5SW5zZXJ0VmFsdWVzVG9rZW5HZW5lcmF0b3IuamF2YQ==) | `0.00% <0.00%> (ø)` | |
| [...gine/impl/InsertClauseShardingConditionEngine.java](https://codecov.io/gh/apache/shardingsphere/pull/11457/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhcmRpbmcvcm91dGUvZW5naW5lL2NvbmRpdGlvbi9lbmdpbmUvaW1wbC9JbnNlcnRDbGF1c2VTaGFyZGluZ0NvbmRpdGlvbkVuZ2luZS5qYXZh) | `52.00% <0.00%> (ø)` | |
| [...ore/statement/ShardingSpherePreparedStatement.java](https://codecov.io/gh/apache/shardingsphere/pull/11457/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtamRiYy9zaGFyZGluZ3NwaGVyZS1qZGJjLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2RyaXZlci9qZGJjL2NvcmUvc3RhdGVtZW50L1NoYXJkaW5nU3BoZXJlUHJlcGFyZWRTdGF0ZW1lbnQuamF2YQ==) | `78.43% <25.00%> (-0.78%)` | :arrow_down: |
| [...ta/schema/builder/loader/ColumnMetaDataLoader.java](https://codecov.io/gh/apache/shardingsphere/pull/11457/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9tZXRhZGF0YS9zY2hlbWEvYnVpbGRlci9sb2FkZXIvQ29sdW1uTWV0YURhdGFMb2FkZXIuamF2YQ==) | `87.50% <100.00%> (ø)` | |
| [...ql/parser/core/resource/ResourceDistSQLParser.java](https://codecov.io/gh/apache/shardingsphere/pull/11457/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZGlzdHNxbC1wYXJzZXIvc2hhcmRpbmdzcGhlcmUtZGlzdHNxbC1wYXJzZXItZW5naW5lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9kaXN0c3FsL3BhcnNlci9jb3JlL3Jlc291cmNlL1Jlc291cmNlRGlzdFNRTFBhcnNlci5qYXZh) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [...core/resource/ResourceDistSQLStatementVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/11457/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZGlzdHNxbC1wYXJzZXIvc2hhcmRpbmdzcGhlcmUtZGlzdHNxbC1wYXJzZXItZW5naW5lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9kaXN0c3FsL3BhcnNlci9jb3JlL3Jlc291cmNlL1Jlc291cmNlRGlzdFNRTFN0YXRlbWVudFZpc2l0b3IuamF2YQ==) | `0.00% <0.00%> (-91.31%)` | :arrow_down: |
| [...ore/resource/ResourceSQLStatementParserEngine.java](https://codecov.io/gh/apache/shardingsphere/pull/11457/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZGlzdHNxbC1wYXJzZXIvc2hhcmRpbmdzcGhlcmUtZGlzdHNxbC1wYXJzZXItZW5naW5lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9kaXN0c3FsL3BhcnNlci9jb3JlL3Jlc291cmNlL1Jlc291cmNlU1FMU3RhdGVtZW50UGFyc2VyRW5naW5lLmphdmE=) | `0.00% <0.00%> (-66.67%)` | :arrow_down: |
| [...stsql/parser/api/DistSQLStatementParserEngine.java](https://codecov.io/gh/apache/shardingsphere/pull/11457/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZGlzdHNxbC1wYXJzZXIvc2hhcmRpbmdzcGhlcmUtZGlzdHNxbC1wYXJzZXItZW5naW5lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9kaXN0c3FsL3BhcnNlci9hcGkvRGlzdFNRTFN0YXRlbWVudFBhcnNlckVuZ2luZS5qYXZh) | `0.00% <0.00%> (-50.00%)` | :arrow_down: |
| ... and [59 more](https://codecov.io/gh/apache/shardingsphere/pull/11457/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/11457?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/11457?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [22a37bb...37144a3](https://codecov.io/gh/apache/shardingsphere/pull/11457?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] strongduanmu commented on a change in pull request #11457: Single table insert when not used sharding rule for table
Posted by GitBox <gi...@apache.org>.
strongduanmu commented on a change in pull request #11457:
URL: https://github.com/apache/shardingsphere/pull/11457#discussion_r677060422
##########
File path: shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/statement/ShardingSpherePreparedStatement.java
##########
@@ -406,15 +406,17 @@ private void clearPrevious() throws SQLException {
return executionContext.getSqlStatementContext() instanceof InsertStatementContext
? ((InsertStatementContext) executionContext.getSqlStatementContext()).getGeneratedKeyContext() : Optional.empty();
}
-
+
@Override
public ResultSet getGeneratedKeys() throws SQLException {
Optional<GeneratedKeyContext> generatedKey = findGeneratedKey(executionContext);
- if (statementOption.isReturnGeneratedKeys() && generatedKey.isPresent()) {
+ if (statementOption.isReturnGeneratedKeys() && generatedKey.isPresent() && !generatedValues.isEmpty()) {
return new GeneratedKeysResultSet(generatedKey.get().getColumnName(), generatedValues.iterator(), this);
}
- if (1 == statements.size()) {
- return statements.iterator().next().getGeneratedKeys();
+ for (PreparedStatement statement : statements) {
+ if (statement.getGeneratedKeys().next()) {
+ return statement.getGeneratedKeys();
Review comment:
@zjcnb If the user does not configure the key generation strategy, should we return all the keys generated by the DB?
##########
File path: shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/statement/ShardingSpherePreparedStatement.java
##########
@@ -406,15 +406,17 @@ private void clearPrevious() throws SQLException {
return executionContext.getSqlStatementContext() instanceof InsertStatementContext
? ((InsertStatementContext) executionContext.getSqlStatementContext()).getGeneratedKeyContext() : Optional.empty();
}
-
+
@Override
public ResultSet getGeneratedKeys() throws SQLException {
Review comment:
@zjcnb Please also consider the `getGeneratedKeys` method of `ShardingSphereStatement`.
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] zjcnb commented on a change in pull request #11457: Single table insert when not used sharding rule for table
Posted by GitBox <gi...@apache.org>.
zjcnb commented on a change in pull request #11457:
URL: https://github.com/apache/shardingsphere/pull/11457#discussion_r675283160
##########
File path: shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rewrite/parameter/impl/ShardingGeneratedKeyInsertValueParameterRewriter.java
##########
@@ -34,13 +34,15 @@
*/
@Setter
public final class ShardingGeneratedKeyInsertValueParameterRewriter implements ParameterRewriter<InsertStatementContext> {
-
+
@Override
public boolean isNeedRewrite(final SQLStatementContext sqlStatementContext) {
- return sqlStatementContext instanceof InsertStatementContext
- && ((InsertStatementContext) sqlStatementContext).getGeneratedKeyContext().isPresent() && ((InsertStatementContext) sqlStatementContext).getGeneratedKeyContext().get().isGenerated();
+ return sqlStatementContext instanceof InsertStatementContext
+ && ((InsertStatementContext) sqlStatementContext).getGeneratedKeyContext().isPresent()
+ && ((InsertStatementContext) sqlStatementContext).getGeneratedKeyContext().get().isGenerated()
+ && !((InsertStatementContext) sqlStatementContext).getGeneratedKeyContext().get().getGeneratedValues().isEmpty();
}
-
Review comment:
ok
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] strongduanmu commented on a change in pull request #11457: Single table insert when not used sharding rule for table
Posted by GitBox <gi...@apache.org>.
strongduanmu commented on a change in pull request #11457:
URL: https://github.com/apache/shardingsphere/pull/11457#discussion_r674717587
##########
File path: shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/statement/ShardingSpherePreparedStatement.java
##########
@@ -410,11 +410,13 @@ private void clearPrevious() throws SQLException {
@Override
public ResultSet getGeneratedKeys() throws SQLException {
Optional<GeneratedKeyContext> generatedKey = findGeneratedKey(executionContext);
- if (statementOption.isReturnGeneratedKeys() && generatedKey.isPresent()) {
+ if (statementOption.isReturnGeneratedKeys() && generatedKey.isPresent() && !generatedValues.isEmpty()) {
return new GeneratedKeysResultSet(generatedKey.get().getColumnName(), generatedValues.iterator(), this);
}
- if (1 == statements.size()) {
- return statements.iterator().next().getGeneratedKeys();
+ for (PreparedStatement statement : statements) {
Review comment:
@zjcnb Please add some test cases for this change.
##########
File path: shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rewrite/parameter/impl/ShardingGeneratedKeyInsertValueParameterRewriter.java
##########
@@ -34,13 +34,15 @@
*/
@Setter
public final class ShardingGeneratedKeyInsertValueParameterRewriter implements ParameterRewriter<InsertStatementContext> {
-
+
@Override
public boolean isNeedRewrite(final SQLStatementContext sqlStatementContext) {
- return sqlStatementContext instanceof InsertStatementContext
- && ((InsertStatementContext) sqlStatementContext).getGeneratedKeyContext().isPresent() && ((InsertStatementContext) sqlStatementContext).getGeneratedKeyContext().get().isGenerated();
+ return sqlStatementContext instanceof InsertStatementContext
+ && ((InsertStatementContext) sqlStatementContext).getGeneratedKeyContext().isPresent()
+ && ((InsertStatementContext) sqlStatementContext).getGeneratedKeyContext().get().isGenerated()
+ && !((InsertStatementContext) sqlStatementContext).getGeneratedKeyContext().get().getGeneratedValues().isEmpty();
}
-
Review comment:
@zjcnb Please keep indents consistent with the previous one.
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] strongduanmu commented on pull request #11457: Single table insert when not used sharding rule for table
Posted by GitBox <gi...@apache.org>.
strongduanmu commented on pull request #11457:
URL: https://github.com/apache/shardingsphere/pull/11457#issuecomment-885480048
@zjcnb Ci is fail.
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org