openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fa...@apache.org
Subject svn commit: r582581 - /openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
Date Sun, 07 Oct 2007 05:46:03 GMT
Author: fancy
Date: Sat Oct  6 22:46:00 2007
New Revision: 582581

URL: http://svn.apache.org/viewvc?rev=582581&view=rev
Log:
OPENJPA-394 (bug in 1.0.x) : DB2 CAST ? AS VARCHAR missing LENGTH

Modified:
    openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java

Modified: openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java?rev=582581&r1=582580&r2=582581&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
(original)
+++ openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
Sat Oct  6 22:46:00 2007
@@ -733,7 +733,10 @@
             String sqlString = buf.getSQL(false);
             if (sqlString.endsWith("?")) {
                 // case "(?" - convert to "CAST(? AS type"
-                String str = "CAST(? AS " + getTypeName(type) + ")";
+                String typeName = getTypeName(type);
+                if (String.class.equals(val.getType()))
+                    typeName = typeName + "(" + characterColumnSize + ")";
+                String str = "CAST(? AS " + typeName + ")";
                 buf.replaceSqlString(sqlString.length() - 1,
                         sqlString.length(), str);
             }



Mime
View raw message