Skip to content

Commit

Permalink
WIP - 100% IT Tests passing / style
Browse files Browse the repository at this point in the history
  • Loading branch information
luciano-fiandesio committed Jan 7, 2025
1 parent b9de61f commit 79f7563
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,8 @@ protected String getQueryItemsAndFiltersWhereClause(EventQueryParams params, Sql
* @param params the {@link EventQueryParams}.
* @param helper the {@link SqlHelper}.
*/
protected String getQueryItemsAndFiltersWhereClause(EventQueryParams params, Set<QueryItem> exclude, SqlHelper helper) {
protected String getQueryItemsAndFiltersWhereClause(
EventQueryParams params, Set<QueryItem> exclude, SqlHelper helper) {
if (params.isEnhancedCondition()) {
return getItemsSqlForEnhancedConditions(params, helper);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,14 +535,14 @@ private String addCteFiltersToWhereClause(EventQueryParams params, CteContext ct
}
}
// Add filters for items that are not part of the CTE
String nonCteWhereClause = getQueryItemsAndFiltersWhereClause(params, processedItems, new SqlHelper() )
String nonCteWhereClause =
getQueryItemsAndFiltersWhereClause(params, processedItems, new SqlHelper())
.replace("where", "");
if (nonCteWhereClause.isEmpty()) return cteWhereClause.toString();

String currentWhereClause = cteWhereClause.toString().toLowerCase().trim();
cteWhereClause.append(currentWhereClause.endsWith("and")
? nonCteWhereClause
: " and " + nonCteWhereClause);
cteWhereClause.append(
currentWhereClause.endsWith("and") ? nonCteWhereClause : " and " + nonCteWhereClause);

return cteWhereClause.toString();
}
Expand All @@ -563,7 +563,9 @@ private String getSqlFilterValue(QueryFilter filter, QueryItem item) {
}

// Handle text and numeric values
return item.isNumeric() ? filter.getSqlBindFilter() : sqlBuilder.singleQuote(filter.getSqlBindFilter());
return item.isNumeric()
? filter.getSqlBindFilter()
: sqlBuilder.singleQuote(filter.getSqlBindFilter());
}

private String buildFilterCteSql(List<QueryItem> queryItems, EventQueryParams params) {
Expand Down

0 comments on commit 79f7563

Please sign in to comment.