mirror of https://github.com/apache/openjpa.git
Special comparison for two boolean constants
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@884233 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d4010d13e1
commit
3d07bcd372
|
@ -2888,6 +2888,16 @@ public class DBDictionary
|
|||
boolean castrhs = false;
|
||||
Class lc = Filters.wrap(lhs.getType());
|
||||
Class rc = Filters.wrap(rhs.getType());
|
||||
|
||||
// special case of comparison of two boolean constants
|
||||
// because some databases do not like false = false or false = true
|
||||
// but all databases understand 1 = 0 or 0 <> 1 etc.
|
||||
if (lc == rc && lc == Boolean.class && lhs.isConstant() && rhs.isConstant()) {
|
||||
String lvalue = Boolean.TRUE.equals(lhs.getValue()) ? "1" : "0";
|
||||
String rvalue = Boolean.TRUE.equals(rhs.getValue()) ? "1" : "0";
|
||||
buf.append(lvalue).append(op).append(rvalue);
|
||||
return;
|
||||
}
|
||||
int type = 0;
|
||||
if (requiresCastForComparisons && (lc != rc
|
||||
|| (lhs.isConstant() && rhs.isConstant()))) {
|
||||
|
|
Loading…
Reference in New Issue