galovics commented on code in PR #2354:
URL: https://github.com/apache/fineract/pull/2354#discussion_r895376399
##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java:
##########
@@ -1304,18 +1334,19 @@ private GenericResultsetData
retrieveDataTableGenericResultSetForUpdate(final St
final List<ResultsetColumnHeaderData> columnHeaders =
this.genericDataService.fillResultsetColumnHeaders(dataTableName);
- String sql = "";
+ final boolean multiRow = isMultirowDatatable(columnHeaders);
- // id only used for reading a specific entry in a one to many datatable
- // (when updating)
- if (id == null) {
- String whereClause = getFKField(appTable) + " = " + appTableId;
- SQLInjectionValidator.validateSQLInput(whereClause);
- sql = sql + "select * from " + sqlGenerator.escape(dataTableName)
+ " where " + whereClause;
- } else {
- sql = sql + "select * from " + sqlGenerator.escape(dataTableName)
+ " where id = " + id;
+ String whereClause = getFKField(appTable) + " = " + appTableId;
+ SQLInjectionValidator.validateSQLInput(whereClause);
+ String sql = "select * from " + sqlGenerator.escape(dataTableName) + "
where " + whereClause;
+
+ // id only used for reading a specific entry that belongs to
appTableId (in a one to many datatable)
+ if (multiRow && id != null) {
+ sql = sql + " and id = " + id;
}
+ LOG.info(sql);
Review Comment:
Unnecessary logging here.
--
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]