I was playing around trying to do the nested set thing from:

http://www.intelligententerprise.com/001020/celko1_1.shtml

One of the things that it has is a table with two unique columns. The code 
for generating names for unique columns is:

(from org/apache/torque/engine/database/model/Index.java)

    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);
    }

The problem with this is that since the number of uniques is not taken 
into account the second constraint fails because it is named the same 
thing as the first. Would it be possible to do:

inputs.add(new Integer(table.getIndices().length +
                       table.getUnices() + 1));

or maybe just add either the uniques or the indices in the if for the 
second parameter depending on the type. That way the numbering would still 
be meaningful.

I know that in the interimn I can use the name attribute. Whenever I 
manage to get the test target to build (the regular one works fine) I'll 
try submitting patches instead of this sort of stuff.

Will


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

Reply via email to