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