simple fix for colon use in SQL select statement

main
Jörg Prante 2 years ago
parent d35071b910
commit 81a0bd8bc9

@ -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 {

Loading…
Cancel
Save