(root)/ – Rev 37496
Rev 37495 |
Rev 37497 |
Go to most recent revision |
Compare with Previous |
Directory listing |
View Log
| RSS feed
Last modification
- Rev 37496 – 38 d 11 h
- Author: amit
- Log message:
- Handle empty IN collections instead of failing the query
An empty IN list rendered as "in ()" (invalid SQL) or threw, in three inconsistent ways:
SQLGrammarException from prepareInPredicate, RuntimeException from prepareEqualPredicate,
and ProfitMandiBusinessException from selectAllByInOrderByDesc. A partner with no activity
for a brand legitimately produces an empty set, so these were 500ing on valid input
(~436 errors/week, mostly V2FofoSchemeController.getBrandWiseIncome).
An empty IN matches nothing: route every IN site through inPredicateOrNone, which returns
an empty disjunction. Empty NOT IN excludes nothing, so it matches everything (conjunction).
selectAllByInOrderByDesc returns an empty list without a DB round-trip.
Also covers three sites that had no guard at all: selectAllByInEqualOrderBysDesc,
selectCountByIn and mapToPredicate. Public API unchanged.