db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r1237924 - /db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLTransformer.java
Date Mon, 30 Jan 2012 18:53:15 GMT
Author: tfischer
Date: Mon Jan 30 18:53:15 2012
New Revision: 1237924

URL: http://svn.apache.org/viewvc?rev=1237924&view=rev
Log:
TORQUE-110 always generate a name for indices even if none is given

Modified:
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLTransformer.java

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLTransformer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLTransformer.java?rev=1237924&r1=1237923&r2=1237924&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLTransformer.java
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLTransformer.java
Mon Jan 30 18:53:15 2012
@@ -178,9 +178,20 @@ public class SQLTransformer implements S
         }
 
         // index
+        int indexIndex = 1;
         for (SourceElement indexElement : tableElement.getChildren(
                 TorqueSchemaElementName.INDEX.getName()))
         {
+            if (indexElement.getAttribute(
+                    TorqueSchemaAttributeName.NAME.getName())
+                    == null)
+            {
+                indexElement.setAttribute(
+                        TorqueSchemaAttributeName.NAME.getName(),
+                        indexElement.getParent().getAttribute(
+                               TorqueSchemaAttributeName.NAME.getName())
+                            + "_IDX_" + indexIndex);
+            }
             String indexColumnNames = collectAttributes(
                     indexElement,
                     TorqueSchemaElementName.INDEX_COLUMN.getName(),
@@ -188,6 +199,7 @@ public class SQLTransformer implements S
             indexElement.setAttribute(
                     SqlAttributeName.INDEX_COLUMN_NAMES,
                     indexColumnNames);
+            indexIndex++;
         }
 
         List<SourceElement> columnElements = tableElement.getChildren(



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