seade       2004/08/22 17:30:10

  Modified:    src/generator/src/java/org/apache/torque/engine/database/model
                        Table.java Index.java
               xdocs    changes.xml
  Log:
  Multiple unique constraints and indexes on a single table are now allocated 
sequential names (previously duplicate names were being allocated).
  
  Revision  Changes    Path
  1.8       +11 -5     
db-torque/src/generator/src/java/org/apache/torque/engine/database/model/Table.java
  
  Index: Table.java
  ===================================================================
  RCS file: 
/home/cvs/db-torque/src/generator/src/java/org/apache/torque/engine/database/model/Table.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Table.java        31 Mar 2004 14:34:33 -0000      1.7
  +++ Table.java        23 Aug 2004 00:30:10 -0000      1.8
  @@ -237,10 +237,16 @@
                   }
               }
   
  -            // NOTE: Most RDBMSes can apparently name unique column
  -            // constraints/indices themselves (using MySQL and Oracle
  -            // as test cases), so we'll assume that we needn't add an
  -            // entry to the system name list for these.
  +            for (i = 0, size = unices.size(); i < size; i++)
  +            {
  +                Unique unique = (Unique) unices.get(i);
  +                name = unique.getName();
  +                if (StringUtils.isEmpty(name))
  +                {
  +                    name = acquireConstraintName("U", i + 1);
  +                    unique.setName(name);
  +                }
  +            }
           }
           catch (EngineException nameAlreadyInUse)
           {
  
  
  
  1.6       +1 -39     
db-torque/src/generator/src/java/org/apache/torque/engine/database/model/Index.java
  
  Index: Index.java
  ===================================================================
  RCS file: 
/home/cvs/db-torque/src/generator/src/java/org/apache/torque/engine/database/model/Index.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Index.java        22 Feb 2004 06:27:19 -0000      1.5
  +++ Index.java        23 Aug 2004 00:30:10 -0000      1.6
  @@ -73,7 +73,6 @@
           if (!indexColumns.isEmpty())
           {
               this.indexColumns = indexColumns;
  -            createName();
   
               if (log.isDebugEnabled())
               {
  @@ -89,31 +88,6 @@
       }
   
       /**
  -     * Creates a name for the index using the NameFactory.
  -     *
  -     * @throws EngineException if the name could not be created
  -     */
  -    private void createName() throws EngineException
  -    {
  -        Table table = getTable();
  -        List inputs = new ArrayList(4);
  -        inputs.add(table.getDatabase());
  -        inputs.add(table.getName());
  -        if (isUnique())
  -        {
  -            inputs.add("U");
  -        }
  -        else
  -        {
  -            inputs.add("I");
  -        }
  -        // ASSUMPTION: This Index not yet added to the list.
  -        inputs.add(new Integer(table.getIndices().size() + 1));
  -        indexName = NameFactory.generateName(
  -                NameFactory.CONSTRAINT_GENERATOR, inputs);
  -    }
  -
  -    /**
        * Imports index from an XML specification
        *
        * @param attrib the xml attributes
  @@ -140,18 +114,6 @@
        */
       public String getName()
       {
  -        if (indexName == null)
  -        {
  -            try
  -            {
  -                // generate an index name if we don't have a supplied one
  -                createName();
  -            }
  -            catch (EngineException e)
  -            {
  -                // still no name
  -            }
  -        }
           return indexName;
       }
   
  
  
  
  1.129     +5 -0      db-torque/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/db-torque/xdocs/changes.xml,v
  retrieving revision 1.128
  retrieving revision 1.129
  diff -u -r1.128 -r1.129
  --- changes.xml       20 Aug 2004 11:48:46 -0000      1.128
  +++ changes.xml       23 Aug 2004 00:30:10 -0000      1.129
  @@ -9,6 +9,11 @@
   
       <release version="3.2-alpha" date="in CVS">
         <action dev='seade' type='fix'>
  +        Multiple unique constraints and indexes on a single table are now 
  +        allocated sequential names (previously duplicate names were being 
  +        allocated).
  +      </action>
  +      <action dev='seade' type='fix'>
           Generate sequences correctly for PostgreSQL (i.e. leave it to 
           PostgreSQL).  Note that schemas produced from the database using
           the <code>torque:jdbc</code> goal are not yet handling sequences
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to