|                                                                                                              1
 10
 11  package com.triactive.jdo.store;
 12
 13
 14  class IndexIdentifier extends SQLIdentifier
 15  {
 16      public static final int MAX_INDICES = 36;
 17
 18
 19      public IndexIdentifier(BaseTable table, boolean isUnique, int seq)
 20      {
 21          super(table.getStoreManager().getDatabaseAdapter());
 22
 23          this.javaName = null;
 24
 25          String
  suffix = isUnique ? "_U" : "_N"; 26
 27          if (seq < 10)
 28              suffix += (char)('0' + seq);
 29          else if (seq < MAX_INDICES)
 30              suffix += (char)('A' + seq);
 31          else
 32              throw new TooManyIndicesException(table);
 33
 34          String
  baseID = truncate(table.getName().getSQLIdentifier(), getMaxLength() - 4); 35
 36          setSQLIdentifier(baseID + suffix);
 37      }
 38
 39
 40      protected int getMaxLength()
 41      {
 42          return dba.getMaxIndexNameLength();
 43      }
 44  }
 45
                                                                                                                                                                                                             |                                                                       
 
 
 
 
 
                                                                                   Popular Tags                                                                                                                                                                                              |