Skip to content

Commit

Permalink
Remove toLowercase usage of ShardingSphereSchema (#33851)
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu authored Nov 30, 2024
1 parent 48f03ad commit b023933
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public final class GeneratedKeyContextEngine {
* @param params SQL parameters
* @return generate key context
*/
public Optional<GeneratedKeyContext> createGenerateKeyContext(final Map<String, Integer> insertColumnNamesAndIndexes, final List<InsertValueContext> insertValueContexts,
final List<Object> params) {
public Optional<GeneratedKeyContext> createGenerateKeyContext(final Map<String, Integer> insertColumnNamesAndIndexes,
final List<InsertValueContext> insertValueContexts, final List<Object> params) {
String tableName = insertStatement.getTable().map(optional -> optional.getTableName().getIdentifier().getValue()).orElse("");
return findGenerateKeyColumn(tableName).map(optional -> containsGenerateKey(insertColumnNamesAndIndexes, optional)
? findGeneratedKey(insertColumnNamesAndIndexes, insertValueContexts, params, optional)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private static ShardingSphereSchema getToBeAddedTablesBySchema(final ShardingSph
* @return to be added tables
*/
public static Collection<ShardingSphereTable> getToBeAddedTables(final ShardingSphereSchema reloadSchema, final ShardingSphereSchema currentSchema) {
return reloadSchema.getAllTables().stream().filter(each -> !each.equals(currentSchema.getTable(each.getName().toLowerCase()))).collect(Collectors.toList());
return reloadSchema.getAllTables().stream().filter(each -> !each.equals(currentSchema.getTable(each.getName()))).collect(Collectors.toList());
}

/**
Expand Down Expand Up @@ -91,7 +91,7 @@ private static ShardingSphereSchema getToBeDroppedTablesBySchema(final ShardingS
* @return to be dropped table
*/
public static Collection<ShardingSphereTable> getToBeDroppedTables(final ShardingSphereSchema reloadSchema, final ShardingSphereSchema currentSchema) {
return currentSchema.getAllTables().stream().filter(each -> !reloadSchema.containsTable(each.getName().toLowerCase())).collect(Collectors.toList());
return currentSchema.getAllTables().stream().filter(each -> !reloadSchema.containsTable(each.getName())).collect(Collectors.toList());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ public void refresh(final MetaDataManagerPersistService metaDataManagerPersistSe
alterSchemaMetaDataPOJO.getAlteredViews().add(new ShardingSphereView(renameViewName, originalView));
alterSchemaMetaDataPOJO.getDroppedViews().add(viewName);
}
Optional<String> viewDefinition = sqlStatement.getViewDefinition();
if (viewDefinition.isPresent()) {
alterSchemaMetaDataPOJO.getAlteredViews().add(new ShardingSphereView(viewName, viewDefinition.get()));
}
sqlStatement.getViewDefinition().ifPresent(optional -> alterSchemaMetaDataPOJO.getAlteredViews().add(new ShardingSphereView(viewName, optional)));
metaDataManagerPersistService.alterSchemaMetaData(alterSchemaMetaDataPOJO);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public Collection<LocalDataQueryResultRow> getRows(final ShowTableMetaDataStatem
String defaultSchema = new DatabaseTypeRegistry(database.getProtocolType()).getDefaultSchemaName(database.getName());
ShardingSphereSchema schema = database.getSchema(defaultSchema);
return sqlStatement.getTableNames().stream()
.filter(schema::containsTable).map(each -> buildTableRows(database.getName(), schema, each.toLowerCase())).flatMap(Collection::stream).collect(Collectors.toList());
.filter(schema::containsTable).map(each -> buildTableRows(database.getName(), schema, each)).flatMap(Collection::stream).collect(Collectors.toList());
}

private Collection<LocalDataQueryResultRow> buildTableRows(final String databaseName, final ShardingSphereSchema schema, final String tableName) {
Expand Down

0 comments on commit b023933

Please sign in to comment.