Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 3 Defining TDS, EES, SES, and TEM Tables : Task D: Define Primary Keys

Task D: Define Primary Keys
Purpose of this Task
In this task you define the primary key fields for the table. At least one primary key field must be specified for each table definition for a table of type TDS, EES SES, and TEM. The value provided for the primary key field of each occurrence must be unique to the table. If the table is parameterized, the value provided for each primary key field must be unique to the table instance. The primary key fields is used to identify and retrieve occurrences of data. Primary keys are defined in the field segment of the Table Definer screen.
Field Segment
The following example illustrates the fields used to define the primary key (EMPNO). To view additional fields, press PF11.

 
Field Name Typ Syn Len Dec Key Ord Rqd Default Reference
---------------- - -- ---- -- - - - ---------------- ----------------
- EMPNO I P 3 0 P
-

 
Secondary keys can also be specified for data access but they are not defined with the standard definer. For more information, refer to TIBCO Object Service Broker Application Administion.
Composite Primary Keys
You can specify a single field or up to sixteen fields to be the primary key, to a total maximum length of 127 bytes. The primary key is always stored as the first field or series of fields.
Although TIBCO Object Service Broker allows a maximum of sixteen fields in a composite primary key, you can use only the Table Browser and the Table Editor on tables that have a maximum of eight fields in the composite primary key. You must use rules to access tables with more than eight fields in a composite primary key.
Methods Available for Defining Primary Key Fields
You can use the following methods to define primary key fields:
For information about how to use fields with predefined attributes, refer to Selecting Global Fields.
For information about copying a definition, refer to Copying a Definition.
The following section describes how to create a new primary key field.
Creating a New Primary Key Field
To define a primary key, type information in the following fields in any order in the fields segment. Primary key fields must be the first fields in the definition. For a list of valid values, press PF1.
Field Name
Enter the semantic data type for the primary key field. For valid values for users to supply, refer to TIBCO Object Service Broker Programming in Rules. If the table has the IDgen field set to Y, the semantic type must be defined as I (identifier).
Enter the syntax of the primary key field. For valid values for users to supply, refer to TIBCO Object Service Broker Programming in Rules. If the table has the IDgen field set to Y, the syntax must be defined as B (binary).
Specify the length of the primary key field. The value is in bytes and the length is determined by the syntax of the field. For valid lengths, refer to TIBCO Object Service Broker Programming in Rules. Each primary key field must have a non-null value. If the table has the IDgen field set to Y, the length must be defined as 4 bytes.
Specify the number of digits to the right of the decimal point. In most cases this is optional. It is relevant only for syntax P.
Type P to indicate that the field is a primary key field. At least one field must be specified as the primary key field.
[Optional] Specify the ordering of the primary key field. The default value of null returns occurrences in ascending order by primary key. Specifying a value in this field incurs sorting overhead, which can be significant in tables with a large number of occurrences.
[Optional] Indicate if a value for the primary key field is required. By definition a value for a primary key field is required.
[Optional] Specify the name of a reference table. Specify a value only if a table is to be referenced when a user is inserting or replacing a value in the field. You then ensure that the user enters valid values for the primary key field. The reference table must be non-parameterized. If the new value does not exist as a primary key value in the referenced table, the action fails validation.

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved