db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r427738 - in /db/torque: site/trunk/xdocs/ templates/trunk/src/templates/om/ test/trunk/test-project/src/java/org/apache/torque/map/ test/trunk/test-project/src/java/org/apache/torque/om/
Date Tue, 01 Aug 2006 21:21:44 GMT
Author: tfischer
Date: Tue Aug  1 14:21:43 2006
New Revision: 427738

URL: http://svn.apache.org/viewvc?rev=427738&view=rev
Log:
Preserved case when generating the constants or column names in the Peer classes and the MapBuilder
classes.
Fixes TORQUE-44.

Modified:
    db/torque/site/trunk/xdocs/changes.xml
    db/torque/templates/trunk/src/templates/om/MapBuilder.vm
    db/torque/templates/trunk/src/templates/om/Peer.vm
    db/torque/test/trunk/test-project/src/java/org/apache/torque/map/DatabaseMapTest.java
    db/torque/test/trunk/test-project/src/java/org/apache/torque/om/OMByNameMethodsTest.java

Modified: db/torque/site/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/db/torque/site/trunk/xdocs/changes.xml?rev=427738&r1=427737&r2=427738&view=diff
==============================================================================
--- db/torque/site/trunk/xdocs/changes.xml (original)
+++ db/torque/site/trunk/xdocs/changes.xml Tue Aug  1 14:21:43 2006
@@ -29,6 +29,13 @@
 
   <release version="3.2.1-dev" date="in SVN">
   
+    <action type="fix" dev="tfischer" issue="TORQUE-44" due-to="Thoralf Rickert">
+      Preserved case when generating the constants for column names
+      in the Peers and the database maps. For example, for a table named book
+      and a column namend author_id, the constant BaseBookPeer.AUTHOR_ID
+      is now set to book.author_id, whereas in former versions, this constant 
+      would have been set to book.AUTHOR_ID.
+    </action>
     <action type="update" dev="tv">
       Simplified the Torque Avalon component.
     </action>

Modified: db/torque/templates/trunk/src/templates/om/MapBuilder.vm
URL: http://svn.apache.org/viewvc/db/torque/templates/trunk/src/templates/om/MapBuilder.vm?rev=427738&r1=427737&r2=427738&view=diff
==============================================================================
--- db/torque/templates/trunk/src/templates/om/MapBuilder.vm (original)
+++ db/torque/templates/trunk/src/templates/om/MapBuilder.vm Tue Aug  1 14:21:43 2006
@@ -132,8 +132,9 @@
 #foreach ($col in $table.Columns)
   #set ( $cfc=$col.JavaName )
   #set ( $cup=$col.Name.toUpperCase() )
+  #set ( $cnm=$col.Name )
   // ------------- Column: $cup --------------------
-        cMap = new ColumnMap( "$cup", tMap);
+        cMap = new ColumnMap( "$cnm", tMap);
         cMap.setType( $col.JavaObject );
         cMap.setUsePrimitive($col.UsePrimitive);
         cMap.setPrimaryKey($col.isPrimaryKey());

Modified: db/torque/templates/trunk/src/templates/om/Peer.vm
URL: http://svn.apache.org/viewvc/db/torque/templates/trunk/src/templates/om/Peer.vm?rev=427738&r1=427737&r2=427738&view=diff
==============================================================================
--- db/torque/templates/trunk/src/templates/om/Peer.vm (original)
+++ db/torque/templates/trunk/src/templates/om/Peer.vm Tue Aug  1 14:21:43 2006
@@ -102,7 +102,8 @@
     #set ( $tfc=$table.JavaName )
     #set ( $cfc=$col.JavaName )
     #set ( $cup=$col.Name.toUpperCase() )
-        $cup = "${table.Name}.$cup";
+    #set ( $cnm=$col.Name )
+        $cup = "${table.Name}.$cnm";
   #end
         if (Torque.isInit())
         {

Modified: db/torque/test/trunk/test-project/src/java/org/apache/torque/map/DatabaseMapTest.java
URL: http://svn.apache.org/viewvc/db/torque/test/trunk/test-project/src/java/org/apache/torque/map/DatabaseMapTest.java?rev=427738&r1=427737&r2=427738&view=diff
==============================================================================
--- db/torque/test/trunk/test-project/src/java/org/apache/torque/map/DatabaseMapTest.java
(original)
+++ db/torque/test/trunk/test-project/src/java/org/apache/torque/map/DatabaseMapTest.java
Tue Aug  1 14:21:43 2006
@@ -39,7 +39,7 @@
 
     public static final String[] COLUMN_NAMES =
     {
-            "ID", "ONE", "TWO", "THREE"
+            "id", "one", "two", "three"
     };
 
     public DatabaseMapTest(String name)
@@ -196,7 +196,7 @@
         map.initialize();
         TableMap table = map.getTable(TABLE_NAME1);
 
-        ColumnMap column = table.getColumn("ID");
+        ColumnMap column = table.getColumn("id");
 
         validateAttribute("Column JavaName", "Id", column.getJavaName());
         validateAttribute("Column description", "id column", column
@@ -217,7 +217,7 @@
         assertTrue("Column type attribute was not Integer!",
                 column.getType() instanceof Integer);
 
-        column = table.getColumn("ONE");
+        column = table.getColumn("one");
         assertTrue(
             "Column isProtected attribute returned false instead of true!",
             column.isProtected());
@@ -225,7 +225,7 @@
         validateAttribute("Column default", "unknown", column
                 .getDefault());
 
-        column = table.getColumn("THREE");
+        column = table.getColumn("three");
         assertTrue("Column position attribute != 4", 
                     column.getPosition() == 4);
         assertTrue("Column isForeignKey attribute was false instead of true!",

Modified: db/torque/test/trunk/test-project/src/java/org/apache/torque/om/OMByNameMethodsTest.java
URL: http://svn.apache.org/viewvc/db/torque/test/trunk/test-project/src/java/org/apache/torque/om/OMByNameMethodsTest.java?rev=427738&r1=427737&r2=427738&view=diff
==============================================================================
--- db/torque/test/trunk/test-project/src/java/org/apache/torque/om/OMByNameMethodsTest.java
(original)
+++ db/torque/test/trunk/test-project/src/java/org/apache/torque/om/OMByNameMethodsTest.java
Tue Aug  1 14:21:43 2006
@@ -150,34 +150,56 @@
 
     public static final String[] OBJECT_PEER_NAMES =
     {
-            "types_object.O_BIT", "types_object.O_TINYINT",
-            "types_object.O_SMALLINT", "types_object.O_BIGINT",
-            "types_object.O_FLOAT", "types_object.O_REAL",
-            "types_object.O_NUMERIC", "types_object.O_DECIMAL",
-            "types_object.O_CHAR", "types_object.O_VARCHAR",
-            "types_object.O_LONGVARCHAR", "types_object.O_DATE",
-            "types_object.O_TIME", "types_object.O_INTEGER",
-            "types_object.O_TIMESTAMP", "types_object.O_BINARY",
-            "types_object.O_VARBINARY", "types_object.O_LONGVARBINARY",
-            "types_object.O_BLOB", "types_object.O_CLOB",
-            "types_object.O_BOOLEANINT", "types_object.O_BOOLEANCHAR",
-            "types_object.O_DOUBLE"
+            "types_object.o_bit",
+            "types_object.o_tinyint",
+            "types_object.o_smallint",
+            "types_object.o_bigint",
+            "types_object.o_float",
+            "types_object.o_real",
+            "types_object.o_numeric",
+            "types_object.o_decimal",
+            "types_object.o_char",
+            "types_object.o_varchar",
+            "types_object.o_longvarchar",
+            "types_object.o_date",
+            "types_object.o_time",
+            "types_object.o_integer",
+            "types_object.o_timestamp",
+            "types_object.o_binary",
+            "types_object.o_varbinary",
+            "types_object.o_longvarbinary",
+            "types_object.o_blob",
+            "types_object.o_clob",
+            "types_object.o_booleanint",
+            "types_object.o_booleanchar",
+            "types_object.o_double"
     };
 
     public static final String[] PRIMITIVE_PEER_NAMES =
     {
-            "types_primitive.P_BIT", "types_primitive.P_TINYINT",
-            "types_primitive.P_SMALLINT", "types_primitive.P_BIGINT",
-            "types_primitive.P_FLOAT", "types_primitive.P_REAL",
-            "types_primitive.P_NUMERIC", "types_primitive.P_DECIMAL",
-            "types_primitive.P_CHAR", "types_primitive.P_VARCHAR",
-            "types_primitive.P_LONGVARCHAR", "types_primitive.P_DATE",
-            "types_primitive.P_TIME", "types_primitive.P_INTEGER",
-            "types_primitive.P_TIMESTAMP", "types_primitive.P_BINARY",
-            "types_primitive.P_VARBINARY", "types_primitive.P_LONGVARBINARY",
-            "types_primitive.P_BLOB", "types_primitive.P_CLOB",
-            "types_primitive.P_BOOLEANINT", "types_primitive.P_BOOLEANCHAR",
-            "types_primitive.P_DOUBLE"
+            "types_primitive.p_bit",
+            "types_primitive.p_tinyint",
+            "types_primitive.p_smallint",
+            "types_primitive.p_bigint",
+            "types_primitive.p_float",
+            "types_primitive.p_real",
+            "types_primitive.p_numeric",
+            "types_primitive.p_decimal",
+            "types_primitive.p_char",
+            "types_primitive.p_varchar",
+            "types_primitive.p_longvarchar",
+            "types_primitive.p_date",
+            "types_primitive.p_time",
+            "types_primitive.p_integer",
+            "types_primitive.p_timestamp",
+            "types_primitive.p_binary",
+            "types_primitive.p_varbinary",
+            "types_primitive.p_longvarbinary",
+            "types_primitive.p_blob",
+            "types_primitive.p_clob",
+            "types_primitive.p_booleanint",
+            "types_primitive.p_booleanchar",
+            "types_primitive.p_double"
     };
 
     public OMByNameMethodsTest(String name)
@@ -432,7 +454,7 @@
                 boolean status = objectTypes.setByPeerName(
                         OBJECT_PEER_NAMES[i], OBJECT_TEST_VALUES[i]);
                 assertTrue("setByPeerName returned false setting column "
-                        + OBJECT_COLUMN_NAMES[i], status);
+                        + OBJECT_PEER_NAMES[i], status);
             }
         }
         catch (TorqueException e)



---------------------------------------------------------------------
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