You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by David Sean Taylor <da...@bluesunrise.com> on 2005/08/07 18:46:42 UTC

[patch] MySQL SQL generation fix

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


Release time of 3.2-RC2 (was Re: [patch] MySQL SQL generation fix)

Posted by Thomas Fischer <fi...@seitenbau.net>.




"Henning P. Schmiedehausen" <hp...@intermeta.de> schrieb am 09.08.2005
07:57:59:

>
> >Do you plan on releasing anytime soon?
> >We'd like to incorporate the bug fix in our projects, and base our
> >projects on an official torque release or at least an RC
>
> We are at RC1 level (the site already documents RC2-dev; the fix will
> be in RC2. I don't know Thomas' plans for the release but I would
> expect RC2 soon.
>

Well my personal thoughts about it are to wait some time if people find
bugs in RC1, but it seems that there are not many :-))) . Also Henning
might want to do the subversion reoganisation before releasing RC2, and I
would like to check in the silent db hit stuff and a reorganized tutoriual,
but this should not take long. I hope that RC2 can be reeleased in the next
few weeks (but certainly not this week), if the other developers agree.

    Thomas


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


Re: [patch] MySQL SQL generation fix

Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
David Sean Taylor <da...@bluesunrise.com> writes:

>> Right. This is a bug.
>> 
>I would have logged it but I couldn't find a Torque project under Apache 
>JIRA
>Has Torque migrated to JIRA yet?

Well, gee, now that you mention it... The Torque team has voted about
this and decided to stay on scarab. The Torque bug tracker is at
http://issues.apache.org/scarab/ and it is linked from the Torque site
(Project Infos -> Issue Tracking). Yes, I know that we do have
stability problems here.

>> 
>>>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
>> 
>> 
>> Please move to the subversion repository in the future.

>Didn't realize that you migrated to subversion.
>I now see that the site links point to subversion and not cvs.
>That must have been recent...

Yes. We moved about a week ago.

>> 
>> While your patch fixes a symptom, it does not cure the deeper,
>> underlying problems of getSqlString() which is sort of a "let's juggle
>> with spaces somehow" method.
>> 
>> I just checked in a fix that should repair all problems with that
>> method for good.
>> 
>> If you do work with MySQL; it would be nice to have a domain test
>> class for MySQL like we have for other databases. This would help us
>> spot such errors faster.

>Sure, I'll look into it.

That would be cool!

>Do you plan on releasing anytime soon?
>We'd like to incorporate the bug fix in our projects, and base our 
>projects on an official torque release or at least an RC

We are at RC1 level (the site already documents RC2-dev; the fix will
be in RC2. I don't know Thomas' plans for the release but I would
expect RC2 soon.

	Regards
		Henning

-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/

RedHat Certified Engineer -- Jakarta Turbine Development  -- hero for hire
   Linux, Java, perl, Solaris -- Consulting, Training, Development

		      4 - 8 - 15 - 16 - 23 - 42

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


Re: [patch] MySQL SQL generation fix

Posted by David Sean Taylor <da...@bluesunrise.com>.
Henning P. Schmiedehausen wrote:
> David Sean Taylor <da...@bluesunrise.com> writes:
> 
> 
>>When we upgraded to Torque version 3.2-rc1, Torque incorrectly 
>>generating MySQL statements for MEDIUMTEXT as
> 
> 
>>    COLUMN_VALUE MEDIUMTEXTNOT NULL,
> 
> 
> Right. This is a bug.
> 
I would have logged it but I couldn't find a Torque project under Apache 
JIRA
Has Torque migrated to JIRA yet?

> 
>>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
> 
> 
> Please move to the subversion repository in the future.

Didn't realize that you migrated to subversion.
I now see that the site links point to subversion and not cvs.
That must have been recent...

> 
> While your patch fixes a symptom, it does not cure the deeper,
> underlying problems of getSqlString() which is sort of a "let's juggle
> with spaces somehow" method.
> 
> I just checked in a fix that should repair all problems with that
> method for good.
> 
> If you do work with MySQL; it would be nice to have a domain test
> class for MySQL like we have for other databases. This would help us
> spot such errors faster.

Sure, I'll look into it.

Do you plan on releasing anytime soon?
We'd like to incorporate the bug fix in our projects, and base our 
projects on an official torque release or at least an RC

Thanks,

-- 
David Sean Taylor
Bluesunrise Software
david@bluesunrise.com
[office] +01 707 773-4646
[mobile] +01 707 529 9194

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


Re: [patch] MySQL SQL generation fix

Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
David Sean Taylor <da...@bluesunrise.com> writes:

>When we upgraded to Torque version 3.2-rc1, Torque incorrectly 
>generating MySQL statements for MEDIUMTEXT as

>     COLUMN_VALUE MEDIUMTEXTNOT NULL,

Right. This is a bug.

>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

Please move to the subversion repository in the future.

While your patch fixes a symptom, it does not cure the deeper,
underlying problems of getSqlString() which is sort of a "let's juggle
with spaces somehow" method.

I just checked in a fix that should repair all problems with that
method for good.

If you do work with MySQL; it would be nice to have a domain test
class for MySQL like we have for other databases. This would help us
spot such errors faster.

	Best regards
		Henning

-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/

RedHat Certified Engineer -- Jakarta Turbine Development  -- hero for hire
   Linux, Java, perl, Solaris -- Consulting, Training, Development

		      4 - 8 - 15 - 16 - 23 - 42

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