Skip to content

Commit

Permalink
Merge pull request #32781 from FlyingZC/dev0903-sonar
Browse files Browse the repository at this point in the history
Fix sonar issue of InsertStatementContext
  • Loading branch information
iamhucong authored Sep 3, 2024
2 parents b675c2b + 6e90c7c commit b43006a
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ public InsertStatementContext(final ShardingSphereMetaData metaData, final List<
ShardingSphereSchema schema = getSchema(metaData, currentDatabaseName);
columnNames = containsInsertColumns() ? insertColumnNames
: Optional.ofNullable(sqlStatement.getTable()).map(optional -> schema.getVisibleColumnNames(optional.getTableName().getIdentifier().getValue())).orElseGet(Collections::emptyList);
insertColumnNamesAndIndexes = createInsertColumnNamesAndIndexes(sqlStatement, schema, insertColumnNames);
insertColumnNamesAndIndexes = createInsertColumnNamesAndIndexes(insertColumnNames);
generatedKeyContext = new GeneratedKeyContextEngine(sqlStatement, schema).createGenerateKeyContext(insertColumnNamesAndIndexes, insertValueContexts, params).orElse(null);
}

private Map<String, Integer> createInsertColumnNamesAndIndexes(final InsertStatement sqlStatement, final ShardingSphereSchema schema, final List<String> insertColumnNames) {
private Map<String, Integer> createInsertColumnNamesAndIndexes(final List<String> insertColumnNames) {
if (containsInsertColumns()) {
Map<String, Integer> result = new CaseInsensitiveMap<>(insertColumnNames.size(), 1F);
int index = 0;
Expand Down

0 comments on commit b43006a

Please sign in to comment.