Ericsson / codechecker

CodeChecker is an analyzer tooling, defect database and viewer extension for the Clang Static Analyzer and Clang Tidy
https://codechecker.readthedocs.io
Apache License 2.0
2.15k stars 358 forks source link

[fix] Prevent overlapping report groups #4215

Closed bruntib closed 2 months ago

bruntib commented 2 months ago

When getRunResults() API function queries the reports, the query uses LIMIT and OFFSET for returning the given page of the results due to their huge number. However, it is possible that different pages have overlapping reports. This way the resulting report list may contain duplicate reports. In this commit we apply an ordering on report id in order to prevent this.

whisperity commented 2 months ago

Does this change still work if there is something in the "sort types" in the API? Which sorting takes priority in that case?

cservakt commented 2 months ago

Does this change still work if there is something in the "sort types" in the API? Which sorting takes priority in that case?

In SQL Alchemy .order_by(col1, col2) is equal to .order_by(col1).order_by(col2). The generated raw SQL query would be "SELECT col1, col2, ... FROM ORDER BY col1, col2;" In both cases.