Hisoka-X commented on code in PR #8222:
URL: https://github.com/apache/seatunnel/pull/8222#discussion_r1877492729
##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/executor/FieldNamedPreparedStatement.java:
##########
@@ -669,29 +671,25 @@ public static FieldNamedPreparedStatement
prepareStatement(
connection.prepareStatement(parsedSQL), indexMapping);
}
- private static String parseNamedStatement(String sql, Map<String,
List<Integer>> paramMap) {
- StringBuilder parsedSql = new StringBuilder();
- int fieldIndex = 1; // SQL statement parameter index starts from 1
- int length = sql.length();
- for (int i = 0; i < length; i++) {
- char c = sql.charAt(i);
- if (':' == c) {
- int j = i + 1;
- while (j < length &&
Character.isJavaIdentifierPart(sql.charAt(j))) {
- j++;
- }
- String parameterName = sql.substring(i + 1, j);
- checkArgument(
- !parameterName.isEmpty(),
- "Named parameters in SQL statement must not be
empty.");
- paramMap.computeIfAbsent(parameterName, n -> new
ArrayList<>()).add(fieldIndex);
- fieldIndex++;
- i = j - 1;
- parsedSql.append('?');
- } else {
- parsedSql.append(c);
- }
+ public static String parseNamedStatement(String sql, Map<String,
List<Integer>> paramMap) {
Review Comment:
```suggestion
@VisibleForTesting
public static String parseNamedStatement(String sql, Map<String,
List<Integer>> paramMap) {
```
--
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]