|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.triactive.jdo.store.sql.QualifiedName com.triactive.jdo.store.sql.ConstraintName
An SQL constraint name.
A ConstraintName is a type of QualifiedName
naming an SQL database
constraint.
Constraints include the primary key, other candidate keys, and foreign keys.
Constraint names in TJDO are generated using a suffix convention based on their type. For example, all primary key constraints are named based on their table with a _PK suffix appended.
Field Summary | |
static int |
MAX_FOREIGN_KEYS
The maximum number of foreign keys allowed. |
static int |
MAX_SUFFIX_LENGTH
The maximum length in characters reserved at the end of constraint names for suffixes used to indicate the type of constraint. |
Fields inherited from class com.triactive.jdo.store.sql.QualifiedName |
identifier, schemaName |
Constructor Summary | |
ConstraintName(DatabaseAdapter dba,
SchemaName schemaName,
java.lang.String identifier)
Constructs a constraint name. |
|
ConstraintName(DatabaseAdapter dba,
java.lang.String identifier)
Constructs a constraint name. |
Method Summary | |
static ConstraintName |
forCandidateKey(BaseTable table,
int seq)
Generates a new candidate key constraint name. |
static ConstraintName |
forForeignKey(BaseTable table,
int seq)
Generates a new foreign key constraint name. |
static ConstraintName |
forPrimaryKey(BaseTable table)
Generates a new primary key constraint name. |
Methods inherited from class com.triactive.jdo.store.sql.QualifiedName |
effectiveCatalogName, effectiveSchemaName, equals, fullyQualified, getIdentifier, getSchemaName, hashCode, intern, toString |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int MAX_SUFFIX_LENGTH
public static final int MAX_FOREIGN_KEYS
Constructor Detail |
public ConstraintName(DatabaseAdapter dba, java.lang.String identifier)
dba
- a database adapter for the relevant databaseidentifier
- the SQL identifier value as a stringpublic ConstraintName(DatabaseAdapter dba, SchemaName schemaName, java.lang.String identifier)
dba
- a database adapter for the relevant databaseschemaName
- the schema name part of the constraint name, or null
if the name is not schema-qualifiedidentifier
- the SQL identifier value as a stringMethod Detail |
public static ConstraintName forPrimaryKey(BaseTable table)
The table name is used as the base of the new constraint name.
The table name identifier is first truncated if necessary to reserve
MAX_SUFFIX_LENGTH
characters for a suffix.
Then _PK is appended.
If the specified table's name is schema-qualified then the constraint name will be schema-qualified.
table
- The base table for the named primary key constraint.
public static ConstraintName forCandidateKey(BaseTable table, int seq)
The table name is used as the base of the new constraint name.
The table name identifier is first truncated if necessary to reserve
MAX_SUFFIX_LENGTH
characters for a suffix.
Then _Un is appended, where n is a
character from [0-9A-Z] representing the given seq parameter.
If the specified table's name is schema-qualified then the constraint name will be schema-qualified.
table
- The base table for the named candidate key constraint.seq
- The number of the candidate key for this table. By convention,
should start at 1.
public static ConstraintName forForeignKey(BaseTable table, int seq)
The table name is used as the base of the new constraint name.
The table name identifier is first truncated if necessary to reserve
MAX_SUFFIX_LENGTH
characters for a suffix.
Then _FKn is appended, where n is a
character from [0-9A-Z] representing the given seq parameter.
If the specified table's name is schema-qualified then the constraint name will be schema-qualified.
table
- The base table for the named foreign key constraint.seq
- The number of the foreign key for this table. By convention,
should start at 1.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |