Browse Source

Polishing

pull/1767/merge
Juergen Hoeller 7 years ago
parent
commit
475c4d4425
  1. 10
      spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterUtils.java

10
spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterUtils.java

@ -119,9 +119,9 @@ public abstract class NamedParameterUtils { @@ -119,9 +119,9 @@ public abstract class NamedParameterUtils {
String parameter = null;
if (j < statement.length && c == ':' && statement[j] == '{') {
// :{x} style parameter
while (j < statement.length && '}' != statement[j]) {
while (j < statement.length && statement[j] != '}') {
j++;
if (':' == statement[j] || '{' == statement[j]) {
if (statement[j] == ':' || statement[j] == '{') {
throw new InvalidDataAccessApiUsageException("Parameter name contains invalid character '" +
statement[j] + "' at position " + i + " in statement: " + sql);
}
@ -133,7 +133,8 @@ public abstract class NamedParameterUtils { @@ -133,7 +133,8 @@ public abstract class NamedParameterUtils {
if (j - i > 2) {
parameter = sql.substring(i + 2, j);
namedParameterCount = addNewNamedParameter(namedParameters, namedParameterCount, parameter);
totalParameterCount = addNamedParameter(parameterList, totalParameterCount, escapes, i, j + 1, parameter);
totalParameterCount = addNamedParameter(
parameterList, totalParameterCount, escapes, i, j + 1, parameter);
}
j++;
}
@ -144,7 +145,8 @@ public abstract class NamedParameterUtils { @@ -144,7 +145,8 @@ public abstract class NamedParameterUtils {
if (j - i > 1) {
parameter = sql.substring(i + 1, j);
namedParameterCount = addNewNamedParameter(namedParameters, namedParameterCount, parameter);
totalParameterCount = addNamedParameter(parameterList, totalParameterCount, escapes, i, j, parameter);
totalParameterCount = addNamedParameter(
parameterList, totalParameterCount, escapes, i, j, parameter);
}
}
i = j - 1;

Loading…
Cancel
Save