openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From allee8...@apache.org
Subject svn commit: r792284 - in /openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql: AbstractResult.java ResultSetResult.java
Date Wed, 08 Jul 2009 20:01:08 GMT
Author: allee8285
Date: Wed Jul  8 20:01:08 2009
New Revision: 792284

URL: http://svn.apache.org/viewvc?rev=792284&view=rev
Log:
OPENJPA-525 - Semi-revert the original solution due to regression in ResultSetResult.translate()
method. Implemented an alternative solution to perform the same original intent. Based on
Milosz, the current solution caused some failure in MySQL. He agreed for this interim commit
and look for cause of failures in MySQL.

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/AbstractResult.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/ResultSetResult.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/AbstractResult.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/AbstractResult.java?rev=792284&r1=792283&r2=792284&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/AbstractResult.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/AbstractResult.java
Wed Jul  8 20:01:08 2009
@@ -30,6 +30,7 @@
 import java.sql.SQLException;
 import java.sql.Time;
 import java.sql.Timestamp;
+import java.sql.Types;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.HashMap;
@@ -756,15 +757,17 @@
 
     public String getString(Object obj)
         throws SQLException {
-        return getStringInternal(translate(obj, null), null);
+        return getStringInternal(translate(obj, null), null,
+            obj instanceof Column && ((Column) obj).getType() == Types.CLOB);
     }
 
     public String getString(Column col, Joins joins)
         throws SQLException {
-        return getStringInternal(translate(col, joins), joins);
+        return getStringInternal(translate(col, joins), joins,
+            col.getType() == Types.CLOB);
     }
 
-    protected String getStringInternal(Object obj, Joins joins)
+    protected String getStringInternal(Object obj, Joins joins, boolean isClobString)
         throws SQLException {
         Object val = checkNull(getObjectInternal(obj, JavaTypes.STRING,
             null, joins));

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/ResultSetResult.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/ResultSetResult.java?rev=792284&r1=792283&r2=792284&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/ResultSetResult.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/ResultSetResult.java
Wed Jul  8 20:01:08 2009
@@ -393,7 +393,8 @@
                 val = new Short(getShortInternal(obj, joins));
                 break;
             case JavaTypes.STRING:
-                return getStringInternal(obj, joins);
+                return getStringInternal(obj, joins,
+                    obj instanceof Column && ((Column) obj).getType() == Types.CLOB);
             case JavaTypes.OBJECT:
                 return _dict
                     .getBlobObject(_rs, ((Number) obj).intValue(), _store);
@@ -462,10 +463,11 @@
         return _dict.getShort(_rs, ((Number) obj).intValue());
     }
 
-    protected String getStringInternal(Object obj, Joins joins)
+    protected String getStringInternal(Object obj, Joins joins, boolean isClobString)
         throws SQLException {
-        if (obj instanceof Column && ((Column) obj).getType() == Types.CLOB)
-            return _dict.getClobString(_rs, findObject(obj, joins));
+        if (isClobString) {
+            return _dict.getClobString(_rs, ((Number) obj).intValue());
+        }
         return _dict.getString(_rs, ((Number) obj).intValue());
     }
 
@@ -489,9 +491,6 @@
         throws SQLException {
         if (obj instanceof Number)
             return obj;
-        // getStringInternal will take care the translation
-        if (obj instanceof Column && ((Column) obj).getType() == Types.CLOB)
-        	return obj;
         return Numbers.valueOf(findObject(obj, joins));
     }
 



Mime
View raw message