cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmen...@apache.org
Subject svn commit: r688347 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLDBAdapter.java
Date Sat, 23 Aug 2008 15:54:25 GMT
Author: kmenard
Date: Sat Aug 23 08:54:24 2008
New Revision: 688347

URL: http://svn.apache.org/viewvc?rev=688347&view=rev
Log:
Fixed CAY-1095: Cayenne attempts to append precision information to DOUBLE types when creating
tables in hsqldb which results in a sql exception.

Patch by Robert Zeigler.

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLDBAdapter.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLDBAdapter.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLDBAdapter.java?rev=688347&r1=688346&r2=688347&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLDBAdapter.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLDBAdapter.java
Sat Aug 23 08:54:24 2008
@@ -21,6 +21,7 @@
 package org.apache.cayenne.dba.hsqldb;
 
 import java.sql.PreparedStatement;
+import java.sql.Types;
 import java.util.Collection;
 import java.util.Iterator;
 
@@ -193,15 +194,29 @@
     @Override
     public String createTable(DbEntity ent) {
         // SET SCHEMA <schemaname>
-
         String sql = super.createTable(ent);
-
         if (sql != null && sql.toUpperCase().startsWith("CREATE TABLE ")) {
             sql = "CREATE CACHED TABLE " + sql.substring("CREATE TABLE ".length());
         }
 
         return sql;
     }
+
+    @Override
+    protected void createTableAppendColumn(StringBuffer sqlBuffer, DbAttribute column) {
+        //CAY-1095: if the column is type double, temporarily set the max length to 0 to

+        //avoid adding precision information.
+        if (column.getType() == Types.DOUBLE && column.getMaxLength() > 0) {
+            int len = column.getMaxLength();
+            column.setMaxLength(0);
+            super.createTableAppendColumn(sqlBuffer,column);
+            column.setMaxLength(len);
+        } else {
+            super.createTableAppendColumn(sqlBuffer,column);
+        }
+    }
+
+
     
     @Override
     public MergerFactory mergerFactory() {



Mime
View raw message