RaigorJiang commented on issue #34224:
URL: 
https://github.com/apache/shardingsphere/issues/34224#issuecomment-2597529617

   > [@RaigorJiang](https://github.com/RaigorJiang) the fix could be broader 
than below code:
   > 
   > ```
   >   public ShardingSphereDatabase getUsedDatabase() {
   >             ShardingSpherePreconditions.checkNotEmpty(usedDatabaseNames, 
NoDatabaseSelectedException::new); // this line
   >             
ShardingSpherePreconditions.checkState(usedDatabaseNames.size() <= 1,
   >                     () -> new 
UnsupportedSQLOperationException(String.format("Can not support multiple logic 
databases [%s]", Joiner.on(", ").join(usedDatabaseNames))));
   >             String databaseName = usedDatabaseNames.iterator().next();
   >             
ShardingSpherePreconditions.checkState(metaData.containsDatabase(databaseName), 
() -> new UnknownDatabaseException(databaseName));
   >             return metaData.getDatabase(databaseName);
   >   }
   > ```
   > 
   > or it should be handle earlier like `ConnectionSession`?
   
   @amirhmd  In fact, `usedDatabaseName` can indeed be null, so we should not 
add this mandatory check (checkNotEmpty).


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to