NamedParameterUtils skips Postgres-style ?? operator

Issue: SPR-13582
This commit is contained in:
Juergen Hoeller
2015-10-26 22:47:12 +01:00
parent 5386e8a9e9
commit 11d1f050e9
2 changed files with 29 additions and 40 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -103,7 +103,7 @@ public abstract class NamedParameterUtils {
if (c == ':' || c == '&') {
int j = i + 1;
if (j < statement.length && statement[j] == ':' && c == ':') {
// Postgres-style "::" casting operator - to be skipped.
// Postgres-style "::" casting operator should be skipped
i = i + 2;
continue;
}
@@ -144,7 +144,7 @@ public abstract class NamedParameterUtils {
if (c == '\\') {
int j = i + 1;
if (j < statement.length && statement[j] == ':') {
// this is an escaped : and should be skipped
// escaped ":" should be skipped
sqlToUse = sqlToUse.substring(0, i - escapes) + sqlToUse.substring(i - escapes + 1);
escapes++;
i = i + 2;
@@ -152,6 +152,12 @@ public abstract class NamedParameterUtils {
}
}
if (c == '?') {
int j = i + 1;
if (j < statement.length && statement[j] == '?') {
// Postgres-style "??" operator should be skipped
i = i + 2;
continue;
}
unnamedParameterCount++;
totalParameterCount++;
}