SQL CAST() for comparisons and math functions fixes.

git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@428885 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
A. Abram White 2006-08-04 21:14:29 +00:00
parent 1a2d048f3d
commit f70f99e638
1 changed files with 6 additions and 10 deletions

View File

@ -2292,13 +2292,11 @@ public class DBDictionary
int type = 0;
if (requiresCastForMathFunctions && (lc != rc
|| (lhs.isConstant() && rhs.isConstant()))) {
Class c = Filters.promote(lhs.getType(), rhs.getType());
Class c = Filters.promote(lc, rc);
type = getJDBCType(JavaTypes.getTypeCode(c), false);
if (type != Types.VARBINARY && type != Types.BLOB) {
castlhs = (lhs.isConstant() && rhs.isConstant())
|| Filters.wrap(lhs.getType()) != c;
castrhs = (lhs.isConstant() && rhs.isConstant())
|| Filters.wrap(rhs.getType()) != c;
castlhs = (lhs.isConstant() && rhs.isConstant()) || lc != c;
castrhs = (lhs.isConstant() && rhs.isConstant()) || rc != c;
}
}
@ -2346,13 +2344,11 @@ public class DBDictionary
int type = 0;
if (requiresCastForComparisons && (lc != rc
|| (lhs.isConstant() && rhs.isConstant()))) {
Class c = Filters.promote(lhs.getType(), rhs.getType());
Class c = Filters.promote(lc, rc);
type = getJDBCType(JavaTypes.getTypeCode(c), false);
if (type != Types.VARBINARY && type != Types.BLOB) {
castlhs = (lhs.isConstant() && rhs.isConstant())
|| Filters.wrap(lhs.getType()) != c;
castrhs = (lhs.isConstant() && rhs.isConstant())
|| Filters.wrap(rhs.getType()) != c;
castlhs = (lhs.isConstant() && rhs.isConstant()) || lc != c;
castrhs = (lhs.isConstant() && rhs.isConstant()) || rc != c;
}
}