OPENJPA-394 (bug in 1.0.x) : DB2 CAST ? AS VARCHAR missing LENGTH

git-svn-id: https://svn.apache.org/repos/asf/openjpa/branches/1.0.x@582581 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Catalina Wei 2007-10-07 05:46:00 +00:00
parent 77ce13d6fc
commit 6c1b918371
1 changed files with 4 additions and 1 deletions

View File

@ -733,7 +733,10 @@ public class DB2Dictionary
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);
}