eldenmoon commented on code in PR #43038:
URL: https://github.com/apache/doris/pull/43038#discussion_r1825412183
##########
fe/fe-core/src/main/java/org/apache/doris/qe/MysqlConnectProcessor.java:
##########
@@ -195,6 +198,24 @@ private void handleExecute() {
handleExecute(preparedStatementContext.command, stmtId,
preparedStatementContext);
}
+ private String parseRealSql(String origStmt, Map<PlaceholderId,
Expression> idExpressionMap) {
+ if (idExpressionMap.isEmpty()) {
+ return origStmt;
+ }
+ // To maintain the original order of replace, sort the entries
accordingly.
+ List<Map.Entry<PlaceholderId, Expression>> sortedEntries = new
ArrayList<>(idExpressionMap.entrySet());
+ sortedEntries.sort(Comparator.comparingInt(entry ->
entry.getKey().asInt()));
+ for (Map.Entry<PlaceholderId, Expression> entry : sortedEntries) {
+ Expression expr = entry.getValue();
+ String value = "";
+ if (!expr.isNullLiteral()) {
+ value = expr.toString();
+ }
+ origStmt = origStmt.replaceFirst("\\?", value);
Review Comment:
what if literal contains "?" for example , select * from tbl where key =
"123?"
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]