seade 2004/08/22 17:29:52 Modified: src/generator/src/java/org/apache/torque/engine/database/model Tag: TORQUE_3_1_BRANCH Table.java Index.java xdocs Tag: TORQUE_3_1_BRANCH release-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 No revision No revision 1.3.2.4 +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.3.2.3 retrieving revision 1.3.2.4 diff -u -r1.3.2.3 -r1.3.2.4 --- Table.java 20 May 2004 04:34:15 -0000 1.3.2.3 +++ Table.java 23 Aug 2004 00:29:52 -0000 1.3.2.4 @@ -245,10 +245,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.2.2.3 +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.2.2.2 retrieving revision 1.2.2.3 diff -u -r1.2.2.2 -r1.2.2.3 --- Index.java 20 May 2004 04:34:15 -0000 1.2.2.2 +++ Index.java 23 Aug 2004 00:29:52 -0000 1.2.2.3 @@ -73,7 +73,6 @@ if (indexColumns.size() > 0) { 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().length + 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; } No revision No revision 1.3.2.13 +5 -0 db-torque/xdocs/release-changes.xml Index: release-changes.xml =================================================================== RCS file: /home/cvs/db-torque/xdocs/release-changes.xml,v retrieving revision 1.3.2.12 retrieving revision 1.3.2.13 diff -u -r1.3.2.12 -r1.3.2.13 --- release-changes.xml 20 Aug 2004 11:47:18 -0000 1.3.2.12 +++ release-changes.xml 23 Aug 2004 00:29:52 -0000 1.3.2.13 @@ -34,6 +34,11 @@ <p> <ul> <li> + Multiple unique constraints and indexes on a single table are now + allocated sequential names (previously duplicate names were being + allocated). + </li> + <li> Backported a few template fixes from Serge Huber that were committed to HEAD some time ago. </li>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]