Commit b8204e9
fix: Correct ORDER BY parameter handling in count queries (issue 868)
- Only skip simple count when ORDER BY contains parameter placeholders
- Use existing orderByHashParameters method for consistency
- Add test with parameter binding instead of string substitution
- Add proper assertions to verify pagination works correctly
This fixes the issue where ORDER BY clauses with parameter bindings
would cause JDBC parameter mismatch if removed during count query
optimization. The fix uses the existing orderByHashParameters method
to detect placeholders in ORDER BY, ensuring optimization only happens
when safe.
Key changes:
- Modified isSimpleCount to check orderByHashParameters instead of
just checking if ORDER BY exists
- Added selectOrderByWithParam test SQL using parameter binding
- Rewrote TestOrderBy to use HSQLDB-compatible tests
- Used CASE WHEN to simulate complex ORDER BY scenarios
Co-authored-by: pwdLight <pwdlight@users.noreply.github.com>1 parent 17a6aa4 commit b8204e9
File tree
5 files changed
+887
-103
lines changed- src
- main/java/com/github/pagehelper/parser/defaults
- test
- java/com/github/pagehelper
- mapper
- test/basic/count
- resources/com/github/pagehelper/mapper
5 files changed
+887
-103
lines changed
0 commit comments