openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From awh...@apache.org
Subject svn commit: r428885 - /incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
Date Fri, 04 Aug 2006 21:14:30 GMT
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;
             }
         }
 



Mime
View raw message