TeslaCN commented on code in PR #23954:
URL: https://github.com/apache/shardingsphere/pull/23954#discussion_r1095404806
##########
proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/admin/postgresql/executor/PostgreSQLSetCharsetExecutor.java:
##########
@@ -34,7 +34,7 @@ public final class PostgreSQLSetCharsetExecutor implements
PostgreSQLSessionVari
@Override
public void handle(final ConnectionSession connectionSession, final String
variableName, final String assignValue) {
- String value = formatValue(assignValue.trim());
+ String value = assignValue.trim();
connectionSession.getAttributeMap().attr(CommonConstants.CHARSET_ATTRIBUTE_KEY).set(parseCharset(value));
Review Comment:
The variable `value` could be inlined.
##########
proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/admin/postgresql/PostgreSQLCharacterSets.java:
##########
@@ -107,7 +107,18 @@ public enum PostgreSQLCharacterSets {
* @return corresponding {@link Charset}
*/
public static Charset findCharacterSet(final String charsetName) {
- PostgreSQLCharacterSets result =
CHARACTER_SETS_MAP.get(charsetName.toUpperCase());
- return null != result && null != result.charset ? result.charset :
Charset.forName(charsetName);
+ String formattedCharsetName = formatValue(charsetName);
+ PostgreSQLCharacterSets result =
CHARACTER_SETS_MAP.get(formattedCharsetName.toUpperCase());
+ return null != result && null != result.charset ? result.charset :
Charset.forName(formattedCharsetName);
+ }
+
+ /**
+ * Find corresponding {@link Charset} by charset name defined in
PostgreSQL.
+ *
+ * @param value that needs to be formatted
+ * @return formatted string without any single/double quotes {@link String}
+ */
Review Comment:
Javadoc is unnecessary here.
##########
proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/admin/postgresql/executor/PostgreSQLSetCharsetExecutor.java:
##########
@@ -34,7 +34,7 @@ public final class PostgreSQLSetCharsetExecutor implements
PostgreSQLSessionVari
@Override
public void handle(final ConnectionSession connectionSession, final String
variableName, final String assignValue) {
- String value = formatValue(assignValue.trim());
Review Comment:
Consider removing the method `formatValue` if it is unused.
--
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]