simple fix for colon use in SQL select statement

This commit is contained in:
Jörg Prante 2022-03-08 18:45:27 +01:00
parent d35071b910
commit 81a0bd8bc9

View file

@ -65,19 +65,21 @@ public class MixedParameterSql {
}
newSql.append(sql, searchIndex, nextColonIndex);
String paramName = sql.substring(nextColonIndex + 1, endOfNameIndex);
boolean secretParam = paramName.startsWith("secret");
Object arg = nameToArg.get(paramName);
if (arg instanceof RewriteArg) {
newSql.append(((RewriteArg) arg).getSql());
rewrittenArgs.add(paramName);
} else {
newSql.append('?');
if (nameToArg.containsKey(paramName)) {
argsList.add(secretParam ? new SecretArg(arg) : arg);
if (!"".equals(paramName)) {
boolean secretParam = paramName.startsWith("secret");
Object arg = nameToArg.get(paramName);
if (arg instanceof RewriteArg) {
newSql.append(((RewriteArg) arg).getSql());
rewrittenArgs.add(paramName);
} else {
throw new DatabaseException("The SQL requires parameter ':" + paramName + "' but no value was provided");
newSql.append('?');
if (nameToArg.containsKey(paramName)) {
argsList.add(secretParam ? new SecretArg(arg) : arg);
} else {
throw new DatabaseException("The SQL requires parameter ':" + paramName + "' but no value was provided");
}
argNamesList.add(paramName);
}
argNamesList.add(paramName);
}
searchIndex = endOfNameIndex;
} else {