You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by aw...@apache.org on 2006/08/04 23:14:30 UTC
svn commit: r428885 -
/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
Author: awhite
Date: Fri Aug 4 14:14:29 2006
New Revision: 428885
URL: http://svn.apache.org/viewvc?rev=428885&view=rev
Log:
SQL CAST() for comparisons and math functions fixes.
Modified:
incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java?rev=428885&r1=428884&r2=428885&view=diff
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java Fri Aug 4 14:14:29 2006
@@ -2292,13 +2292,11 @@
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 @@
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;
}
}