-
Notifications
You must be signed in to change notification settings - Fork 377
Closed as not planned
Labels
for: stackoverflowA question that's better suited to stackoverflow.comA question that's better suited to stackoverflow.com
Description
Here's the concept:
final Integer parameter = 5; // Or maybe null.
final String sql = (parameter == null) ? "SELECT 0" : "SELECT :param";
return databaseClient.sql(sql)
.filter(statement -> {
if (parameter == null) {
return statement;
} else {
return statement.bind("param", parameter);
}
})
.all();(Obviously this simple example could be worked around via other means. The real code involves dynamic SQL over possibly-provided filter parameters.)
Expected
The query functions with the binding provided during the filter chain.
Actual
The statement fails before the filter chain is invoked, indicating that the param binding is not set.
org.springframework.dao.InvalidDataAccessApiUsageException: No parameter specified for [param] in query [SELECT :param]
I cannot find any documentation on how the DatabaseClient.GenericExecuteSpec filter chain is intended to work. So I'm unsure whether this would be an enhancement request or bug report.
Metadata
Metadata
Assignees
Labels
for: stackoverflowA question that's better suited to stackoverflow.comA question that's better suited to stackoverflow.com