Skip to content

Commit

Permalink
fix: bind parameter for ingestin pipeline (#16837)
Browse files Browse the repository at this point in the history
Co-authored-by: Chirag Madlani <[email protected]>
(cherry picked from commit 0f2d365)
  • Loading branch information
TeddyCr committed Jul 10, 2024
1 parent 38afc88 commit d7107c4
Showing 1 changed file with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1885,8 +1885,7 @@ default int listCount(ListFilter filter) {
"%s WHERE entity_relationship.fromEntity = :serviceType and entity_relationship.relation = :relation",
condition);
bindMap.put("relation", CONTAINS.ordinal());
bindMap.put("serviceType", serviceType);
return listIngestionPipelineCount(condition, bindMap);
return listIngestionPipelineCount(condition, bindMap, filter.getQueryParams());
}
return EntityDAO.super.listCount(filter);
}
Expand Down Expand Up @@ -1922,11 +1921,10 @@ default List<String> listAfter(ListFilter filter, int limit, String after) {
"%s WHERE entity_relationship.fromEntity = :serviceType and entity_relationship.relation = :relation and ingestion_pipeline_entity.name > :after order by ingestion_pipeline_entity.name ASC LIMIT :limit",
condition);

bindMap.put("serviceType", serviceType);
bindMap.put("relation", CONTAINS.ordinal());
bindMap.put("after", after);
bindMap.put("limit", limit);
return listAfterIngestionPipelineByserviceType(condition, bindMap);
return listAfterIngestionPipelineByserviceType(condition, bindMap, filter.getQueryParams());
}
return EntityDAO.super.listAfter(filter, limit, after);
}
Expand Down Expand Up @@ -1961,27 +1959,33 @@ default List<String> listBefore(ListFilter filter, int limit, String before) {
"%s WHERE entity_relationship.fromEntity = :serviceType and entity_relationship.relation = :relation and ingestion_pipeline_entity.name < :before order by ingestion_pipeline_entity.name DESC LIMIT :limit",
condition);

bindMap.put("serviceType", serviceType);
bindMap.put("relation", CONTAINS.ordinal());
bindMap.put("before", before);
bindMap.put("limit", limit);
return listBeforeIngestionPipelineByserviceType(condition, bindMap);
return listBeforeIngestionPipelineByserviceType(
condition, bindMap, filter.getQueryParams());
}
return EntityDAO.super.listBefore(filter, limit, before);
}

@SqlQuery("SELECT ingestion_pipeline_entity.json FROM ingestion_pipeline_entity <cond>")
List<String> listAfterIngestionPipelineByserviceType(
@Define("cond") String cond, @BindMap Map<String, Object> bindings);
@Define("cond") String cond,
@BindMap Map<String, Object> bindings,
@BindMap Map<String, String> params);

@SqlQuery(
"SELECT json FROM (SELECT ingestion_pipeline_entity.name, ingestion_pipeline_entity.json FROM ingestion_pipeline_entity <cond>) last_rows_subquery ORDER BY last_rows_subquery.name")
List<String> listBeforeIngestionPipelineByserviceType(
@Define("cond") String cond, @BindMap Map<String, Object> bindings);
@Define("cond") String cond,
@BindMap Map<String, Object> bindings,
@BindMap Map<String, String> params);

@SqlQuery("SELECT count(*) FROM ingestion_pipeline_entity <cond> ")
int listIngestionPipelineCount(
@Define("cond") String cond, @BindMap Map<String, Object> bindings);
@Define("cond") String cond,
@BindMap Map<String, Object> bindings,
@BindMap Map<String, String> params);
}

interface PipelineServiceDAO extends EntityDAO<PipelineService> {
Expand Down

0 comments on commit d7107c4

Please sign in to comment.