db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Sean Taylor <da...@bluesunrise.com>
Subject [patch] MySQL SQL generation fix
Date Sun, 07 Aug 2005 16:46:42 GMT
When we upgraded to Torque version 3.2-rc1, Torque incorrectly 
generating MySQL statements for MEDIUMTEXT as

     COLUMN_VALUE MEDIUMTEXTNOT NULL,

instead of the correct

     COLUMN_VALUE MEDIUMTEXT NOT NULL,

I have patched and rebuilt and tested Torque from their CVS head (the 
problem was still there)

Patch is included below.

Here is the schema test case (the COLUMN_VALUE column generates the 
error above):

     <table name="FRAGMENT_PARAMETER">
         <column name="PARAMETER_ID" primaryKey="true" required="true" 
type="INTEGER"/>
         <column name="FRAGMENT_ID" required="true" type="INTEGER"/>
         <column name="NAME" required="true" size="80" type="VARCHAR"/>
         <column name="COLUMN_VALUE" required="true" type="LONGVARCHAR"/>
         <unique name="UN_FRAGMENT_PARAMETER_1">
           <unique-column name="FRAGMENT_ID" />
           <unique-column name="PARAMETER_ID" />
         </unique>
     </table>


Index: 
src/generator/src/java/org/apache/torque/engine/database/model/Column.java
===================================================================
RCS file: 
/home/cvspublic/db-torque/src/generator/src/java/org/apache/torque/engine/database/model/Column.java,v
retrieving revision 1.29
diff -u -r1.29 Column.java
--- 
src/generator/src/java/org/apache/torque/engine/database/model/Column.java 
  27 Jun 2005 21:34:10 -0000      1.29
+++ 
src/generator/src/java/org/apache/torque/engine/database/model/Column.java 
  5 Aug 2005 06:42:27 -0000
@@ -1025,8 +1025,8 @@
         if (getPlatform().hasSize(getDomain().getSqlType()))
         {
             sb.append(getDomain().printSize());
-            sb.append(' ');
         }
+        sb.append(' ');
         if (getDomain().getDefaultValue() != null)
         {
             sb.append("default ");
Index: 
src/generator/src/test/org/apache/torque/engine/database/model/DomainTest.java
===================================================================
RCS file: 
/home/cvspublic/db-torque/src/generator/src/test/org/apache/torque/engine/database/model/DomainTest.java,v
retrieving revision 1.11
diff -u -r1.11 DomainTest.java
--- 
src/generator/src/test/org/apache/torque/engine/database/model/DomainTest.java 
      12 Mar 2004 12:25:32 -0000      1.11
+++ 
src/generator/src/test/org/apache/torque/engine/database/model/DomainTest.java 
      5 Aug 2005 06:42:27 -0000
@@ -164,7 +164,7 @@
         assertEquals("", col.getAutoIncrementString());
         assertEquals("BLOB", col.getTorqueType());
         assertEquals("LONGBLOB", col.getDomain().getSqlType());
-        assertEquals("cblob LONGBLOB ", col.getSqlString());
+        assertEquals("cblob LONGBLOB  ", col.getSqlString());
     }

}





---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message