Return-Path: Delivered-To: apmail-db-torque-dev-archive@www.apache.org Received: (qmail 61650 invoked from network); 23 Aug 2004 00:30:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 23 Aug 2004 00:30:12 -0000 Received: (qmail 19726 invoked by uid 500); 23 Aug 2004 00:30:11 -0000 Delivered-To: apmail-db-torque-dev-archive@db.apache.org Received: (qmail 19703 invoked by uid 500); 23 Aug 2004 00:30:11 -0000 Mailing-List: contact torque-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Apache Torque Developers List" Reply-To: "Apache Torque Developers List" Delivered-To: mailing list torque-dev@db.apache.org Received: (qmail 19690 invoked by uid 500); 23 Aug 2004 00:30:11 -0000 Received: (qmail 19687 invoked by uid 99); 23 Aug 2004 00:30:11 -0000 X-ASF-Spam-Status: No, hits=-2.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.27.1) with SMTP; Sun, 22 Aug 2004 17:30:10 -0700 Received: (qmail 61628 invoked by uid 1610); 23 Aug 2004 00:30:10 -0000 Date: 23 Aug 2004 00:30:10 -0000 Message-ID: <20040823003010.61627.qmail@minotaur.apache.org> From: seade@apache.org To: db-torque-cvs@apache.org Subject: cvs commit: db-torque/xdocs changes.xml X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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 @@ + Multiple unique constraints and indexes on a single table are now + allocated sequential names (previously duplicate names were being + allocated). + + Generate sequences correctly for PostgreSQL (i.e. leave it to PostgreSQL). Note that schemas produced from the database using the torque:jdbc goal are not yet handling sequences --------------------------------------------------------------------- To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org For additional commands, e-mail: torque-dev-help@db.apache.org