You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "TeslaCN (via GitHub)" <gi...@apache.org> on 2023/08/09 06:36:40 UTC
[GitHub] [shardingsphere] TeslaCN commented on a diff in pull request #27909: escape pg ? operator in proxy
TeslaCN commented on code in PR #27909:
URL: https://github.com/apache/shardingsphere/pull/27909#discussion_r1288014686
##########
proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/parse/PostgreSQLComParseExecutor.java:
##########
@@ -87,6 +93,13 @@ private SQLParserEngine createShardingSphereSQLParserEngine(final String databas
return sqlParserRule.getSQLParserEngine(protocolType.getTrunkDatabaseType().orElse(protocolType));
}
+ private String escape(final SQLStatement sqlStatement, final String sql) {
+ if (sqlStatement instanceof DMLStatement) {
+ return sql.replace("?", "??");
+ }
+ return sql;
+ }
Review Comment:
I found the doc about escape `?` in the following link. I think the escape logic could be merged into `convertSQLToJDBCStyle` and invoke the method with `convertSQLToJDBCStyle(Collections.emptyList(), sql)` if parameter placeholder is absent.
https://jdbc.postgresql.org/documentation/query/#using-the-statement-or-preparedstatement-interface
--
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