Saifulhuq01 commented on code in PR #5417:
URL: https://github.com/apache/fineract/pull/5417#discussion_r2758440236
##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailReadPlatformServiceImpl.java:
##########
@@ -185,4 +178,16 @@ public Page<EmailData> retrieveEmailByStatus(final Integer
limit, final Integer
return this.paginationHelper.fetchPage(this.jdbcTemplate,
sqlBuilder.toString(),
new Object[] { status, fromDateString, toDateString },
this.emailRowMapper);
}
+
+ private Collection<EmailData> retrieveEmailByStatus(final Integer status,
final String sqlPlusLimit) {
+ StringBuilder sql = new StringBuilder("select " +
this.emailRowMapper.schema() + " where emo.status_enum = ?");
+ List<Object> args = new ArrayList<>();
+ args.add(status);
+
+ if (sqlPlusLimit != null) {
+ sql.append(sqlPlusLimit);
+ }
Review Comment:
> The problem is: you are not concatenating to the SQL the following: `LIMIT
?` but you are concatenating: `LIMIT <whatever the user provided in query
param>` which is wrong...
The sqlGenerator.limit() method returns a literal string (e.g. 'LIMIT 10').
I've cleaned up the code to pass the Integer limit down, but sticking to the
generator to ensure MSSQL compatibility.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]