Power Designer Data Model
Power Designer Data Model
Sybase PowerDesigner
15.0 Windows
ii
Contents
vii
ix 1 2 5 11 12 13 17 21 24 27 30 32 44 51 57 58 62 86 95 103 111 115 124 129 138 152 169 174 179 188
iii
4 Building Multidimensional Diagrams Multidimensional Diagram Basics . . . . Cubes (PDM) . . . . . . . . . . . . . . . Dimensions (PDM) . . . . . . . . . . . . Attributes (PDM) . . . . . . . . . . . . . Facts (PDM) . . . . . . . . . . . . . . . Measures (PDM) . . . . . . . . . . . . . Hierarchies (PDM) . . . . . . . . . . . . Associations (PDM) . . . . . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
193 194 198 209 211 214 216 218 220 223 224 240 248 255 266 270 271 275 281 282 283 298 300 302 309 310 311 316 321 323 324 328 331 332 370 381 426
5 Building Triggers and Procedures Triggers (PDM) . . . . . . . . . . . . . . . . Trigger Templates (PDM) . . . . . . . . . . Trigger Template Items (PDM) . . . . . . . . Stored Procedures and Functions (PDM) . Procedure Templates (PDM) . . . . . . . . SQL Code Denition Toolbars . . . . . . . . Creating SQL/XML Queries with the Wizard Generating Triggers and Procedures . . . . 6 Building a Database Access Structure Introducing database access . . . . . . . Users (PDM) . . . . . . . . . . . . . . . . Roles (PDM) . . . . . . . . . . . . . . . . Groups (PDM) . . . . . . . . . . . . . . . Synonyms (PDM) . . . . . . . . . . . . . . 7 Building Web Services Introducing Web Services . . . . . . Web Services (PDM) . . . . . . . . . Web Operations (PDM) . . . . . . . Web Parameters (PDM) . . . . . . . Testing Web Services . . . . . . . . Generating Web Services . . . . . . Reverse Engineering Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8 Working with Data Models Customizing the Data Modeling Environment Generating Other Models from a Data Model Checking a Data Model . . . . . . . . . . . . Working with SQL . . . . . . . . . . . . . . .
iv
433
435 436 438 472 500 506 513 515 516 517 520 524 532 535 536 537 542 549 550 551 552 553 617 619 620 643 648 649 655 659 674 678 687 688 689 691 693 704 716
10 Reverse Engineering a Database into a PDM Getting Started with Reverse Engineering . . . Reverse Engineering from Scripts . . . . . . . Reverse Engineering from a Live Database . . Reverse Engineering Options . . . . . . . . . . Reverse Engineering Database Statistics . . .
11 DBMS-Specic Features Working with PowerDesigners DBMS-Specic Features IBM DB2 for z/OS (formerly OS/390) . . . . . . . . . . . IBM DB2 for Common Server . . . . . . . . . . . . . . . Informix SQL . . . . . . . . . . . . . . . . . . . . . . . . Ingres . . . . . . . . . . . . . . . . . . . . . . . . . . . . Interbase . . . . . . . . . . . . . . . . . . . . . . . . . . Microsoft Access . . . . . . . . . . . . . . . . . . . . . . Microsoft SQL Server . . . . . . . . . . . . . . . . . . . MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . NonStop SQL . . . . . . . . . . . . . . . . . . . . . . . . Oracle . . . . . . . . . . . . . . . . . . . . . . . . . . . . PostgreSQL . . . . . . . . . . . . . . . . . . . . . . . . . Red Brick Warehouse . . . . . . . . . . . . . . . . . . . Sybase AS Anywhere . . . . . . . . . . . . . . . . . . . Sybase AS Enterprise . . . . . . . . . . . . . . . . . . . Sybase AS IQ . . . . . . . . . . . . . . . . . . . . . . . Sybase SQL Anywhere . . . . . . . . . . . . . . . . . . Teradata . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Writing SQL Statements in PowerDesigner Introduction . . . . . . . . . . . . . . . . . . . . . Writing SQL with the PowerDesigner GTL . . . . Writing SQL with the PDM Variables and Macros PDM Macros . . . . . . . . . . . . . . . . . . . . PDM Variables . . . . . . . . . . . . . . . . . . . PowerDesigner Formatting Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13 Migrating from ERwin to PowerDesigner Introducing the ERwin Import Process . . . Preparing to Import your ERwin models . . The Import Process . . . . . . . . . . . . . After Importing . . . . . . . . . . . . . . . . Getting Started Using PowerDesigner . . . Index
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
vi
PART I
viii
Used for: Key names. Example: Press the ENTER key. Bibliography Data Modeling Essentials Graeme Simsion, Van Nostrand Reinhold, 1994, 310 pages; paperbound; ISBN 1850328773 ix
Information engineering James Martin, Prentice Hall, 1990, three volumes of 178, 497, and 625 pages respectively; clothbound, ISBN 0-13-464462-X (vol. 1), 0-13-464885-4 (vol. 2), and 0-13-465501-X (vol. 3). Celko95 Joe Celko, Joe Celkos SQL for Smarties (Morgan Kaufmann Publishers, Inc., 1995), 467 pages; paperbound; ISBN 1-55860-323-9.
CHAPTER 1
This chapter presents the Conceptual, Logical, and Physical Data Models and provides guidance for data modeling with PowerDesigner.
Topic: Data Modeling with PowerDesigner Creating a Data Model page 2 5
To create a CDM, see Creating a Data Model on page 5. For detailed information about conceptual diagrams, see Conceptual Diagram Basics in the Building Conceptual and Logical Diagrams chapter. Logical Data Models
A Logical Data Model helps you design a database structure and perform some database denormalization actions independent of any specic DBMS physical requirements. You can use a logical model as an intermediary step in the database design process between the conceptual and physical designs: Start with a CDM containing entities, attributes, relationships, domains, data items and business rules. If need be, you may develop the CDM in several design steps starting from a high level model to a low level CDM Generate an LDM. Create indexes and specify FK column names and other common features
Generate one or more PDMs, each targeted to a specic DBMS implementation This design process allows you to keep everything consistent in a large development effort.
To create an LDM, see Creating a Data Model on page 5. For detailed information about logical diagrams, see Logical Diagram Basics in the Building Conceptual and Logical Diagrams chapter. Physical Data Models
A Physical Data Model (PDM) is a database design tool suitable for modeling the implementation of physical structures and data queries in a database.
Depending on the type of database you want to design, you will use different types of diagrams in the PDM: Operational PDM - You use PDM to design the structure of an operational database. Usually, in data modeling, the physical analysis follows the conceptual and/or logical analysis, and addresses the details of the actual physical implementation of data in a database, to suit your performance and physical constraints. Business intelligence PDM - You can use a PDM to design the structure of a data environment, which consists of: Data warehouse or data mart database are populated with data transferred from operational databases, and gather together all the information that may be needed in an OLAP database, where queries for business analysis and decision making are performed. The data warehouse database gathers all the data manipulated in a company for 3
example, whereas the data mart focuses on smaller entities in the company. You use physical diagrams to design a data warehouse or data mart database. Since these databases usually contain very large amounts of data for storage, you do not need to design them for performance. You may assign types (fact and dimension) to the database tables to have a preview of the multidimensional structure in an OLAP database. A multidimensional OLAP database - which is generally populated with data that has rst been aggregated in a data warehouse or data mart (though sometimes it is transferred directly from operational databases), and in which information is organized to facilitate queries performed by different tools. Business analysts use OLAP databases to send queries and retrieve business information from the different dimensions existing in the database. You use PDM multidimensional diagrams to design the different dimensions and cubes within the OLAP database.
2. Select one of the following model types: Conceptual Data Model Logical Data Model Physical Data Model 3. Select one of the following radio buttons: New model Creates a new, empty, model. New model from template Creates a model from a model template, which can contain pre-congured options, preferences, extensions, and objects. For more information, see Model Templates in the Models chapter of the Core Features Guide . 4. Enter a model name. The code of the model, which is used for script or code generation, is derived from this name according to the model naming conventions.
5. [PDM only] Select a DBMS, and specify whether to: Share the DBMS denition use the original DBMS le in the Resource Files\DBMS directory. Changes made to the DBMS are shared by all PDMs that share it. Copy the DBMS denition in model make a copy of the DBMS le. The copied DBMS is saved with the PDM and changes made to it do not impact any other PDMs. For more information on DBMS properties and customizing a DBMS, see the DBMS Resource File Reference chapter of the Customizing and Extending PowerDesigner manual. 6. [PDM only] Select the type of the rst diagram. The diagram chosen becomes the default for the next time you create a new PDM. You can create as many diagrams as you need in a CDM, LDM, or PDM. 7. [optional] Click the Extended Model Denitions tab, and select one or more extended model denitions to attach to your model.
Model properties
To open a model property sheet, double-click its Browser entry. The General tab contains the following properties:
Property Description
Name
Species the name of the model, which should be clear and meaningful, and should convey its purpose to non-technical users. Species the technical name of the item used for generating code or scripts, which may be abbreviated, and should not include spaces. Provides descriptive information about the model.
Code
Comment
Property
Description
Filename Author
Species the location of the model le. This eld is empty if the model has never been saved. Species the author of the model. If you enter nothing, the Author eld in diagram title boxes displays the user name from the model property sheet Version Info tab. If you enter a space, the Author eld displays nothing. Species the version of the model. You can use this box to display the repository version or a user dened version of the model. This parameter is dened in the Title page of the model display preferences [PDM only] Species the DBMS attached to the model. Clicking the Properties tool to the right of this eld to open the DBMS le in the Resource Editor. [PDM only] Species the database that is the target for the model. You can create a database in the model by clicking the Create tool to the right of this eld. If your DBMS supports multiple databases in a single model (enabled by the EnableManyDatabases entry in the Database category of the DBMS), this eld is not present, and is replaced by a list of databases in the Model menu. A Database category is also displayed in the physical options of your database objects.
Version
DBMS
Database
Default diagram
Species the diagram displayed by default when you open the model.
Database properties (PDM) You can create a database from the General tab of the model property sheet or, if your DBMS supports multiple databases in a single model, from the list of databases in the Model menu. A database has the following properties:
Property Description
Name for the database Code for the database. This code is generated in database scripts Descriptive label for the database
Property
Description
Stereotype
Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or userdened DBMS for the database Physical options available in the DBMS Begin and end scripts that are inserted at the start and end of a database creation script Business rules for the database
O To use a database in a physical option 1. Open the property sheet of an object with physical options. 2. Click the Options tab, select the in database (. . . ) option and click the >> button. 3. Select a database from the list below the right pane. 4. Click OK. When you use the in [<tablespace>] physical option, you associate a predened tablespace with a database using the following syntax:
DBname.TBSPCname
For example, tablespace CUST_DATA belongs to database myBase. In the following example, table Customer will be created in tablespace CUST_DATA:
You should not dene a database together with a tablespace physical option on the same object, this will raise an error during check model. The database Dependencies tab displays the list of objects that use the current database in their physical options.
Archiving a PDM
Archived models store all constraint names without making a difference between user dened and calculated constraints. These models are used with the modify database feature. You can archive a PDM with the .apm le extension, using the following methods: Save a PDM as an archived model Automatically archive PDM after database creation O To archive a PDM 1. Select File Save As, select Archived PDM (bin) or Archived PDM (xml) in the Save As Type list, and click Save.
or
Select Database Generate Database, click the Options tab, select the Automatic Archive check box in the After Generation groupbox, and click OK.
10
CHAPTER 2
This chapter describes how to build conceptual and logical diagrams, and how to create and modify the associated objects.
Topic: Introducing Conceptual and Logical Diagrams Conceptual Diagram Basics Logical Diagram Basics Data Items (CDM) Entities (CDM/LDM) Attributes (CDM/LDM) Identiers (CDM/LDM) Relationships (CDM/LDM) Associations and Association Links (CDM) Inheritances (CDM/LDM) page 12 13 17 21 24 27 30 32 44 51
11
12
In addition: a teacher can teach several subjects and a subject can be taught by several teachers (many-to-many). a teacher can teach several lessons and a lesson is taught by only one teacher (one-to-many). a student attends multiple lessons and a lesson is followed by multiple students (many-to-many). a student studies multiple subjects and a subject can be studied by multiple students (many-to-many).
13
Domain
[none]
[none]
Set of values for which a data item is valid. See Domains (CDM/LDM/PDM) in the Building Physical Diagrams chapter. Elementary piece of information. See Data Items (CDM) on page 21. Person, place, thing, or concept that is of interest to the enterprise. See Entities (CDM/LDM) on page 24.
Data Item
[none]
[none]
Entity
Entity Attribute
[none]
[none]
Elementary piece of information attached to an entity. See Attributes (CDM/LDM) on page 27. One or many entity attributes, whose values uniquely identify each occurrence of the entity. See Identiers (CDM/LDM) on page 30. Named connection or relation between entities (ER modeling methodology). See Relationships (CDM/LDM) on page 32. Relationship that denes an entity as a special case of a more general entity. See Inheritances (CDM/LDM) on page 51.
Identier
[none]
[none]
Relationship
Inheritance
14
Object
Tool
Symbol
Description
Association
Named connection or association between entities (Merise modeling methodology). See Associations and Association Links (CDM) on page 44. Link that connects an association to an entity. See Associations and Association Links (CDM) on page 44.
Association Link
You can recover processes from a PAM by opening it into a BPM (see the Business Process Modeling guide).
15
O To open a PAM into a CDM 1. Select File Open and select the PAM le. 2. Click Open to display the Formats for ProcessAnalyst Model window.
3. Select PowerDesigner Conceptual Data Model and click OK to begin the import. The recovered objects are imported into the CDM and appear in a default diagram.
16
Primary identiers have migrated along one-to-many relationships to become foreign identiers, and many-to-many relationships are replaced with an intermediary entity linked with one-to-many relationships to the extremities.
17
Object
Tool
Symbol
Description
Domain
[none]
[none]
Set of values for which a data item is valid. See Domains (CDM/LDM/PDM) in the Building Physical Diagrams chapter. Person, place, thing, or concept that is of interest to the enterprise. See Entities (CDM/LDM) on page 24.
Entity
Entity Attribute
[none]
[none]
Elementary piece of information attached to an entity. See Attributes (CDM/LDM) on page 27. One or many entity attributes, whose values uniquely identify each occurrence of the entity. See Identiers (CDM/LDM) on page 30. Named connection or relation between entities (ER modeling methodology). See Relationships (CDM/LDM) on page 32. [LDM only] Named cardinality represented with an intermediary entity. See Relationships (CDM/LDM) on page 32. Relationship that denes an entity as a special case of a more general entity. See Inheritances (CDM/LDM) on page 51.
Identier
[none]
[none]
Relationship
n-n Relationship
Inheritance
Right-click the model in the Browser and select New Logical Diagram from the contextual menu. Right-click the background of any diagram and select Diagram New Diagram from the contextual menu. To create a new LDM with a logical diagram, select File New, choose Logical Data Model from the Model type list, and click OK.
3. Choose one of the following options: Convert the model to a logical data model Note that only tables, columns, keys and references are preserved Change the DBMS target to ANSI Level 2 and open it as a PDM 4. Click OK to open the model.
Restoring generation links to a converted LDM
A PDM with the logical model DBMS that had been generated from a CDM will retain its links to the source CDM when you convert it to an LDM. However, for any PDM generated from the old LDM, you will need to restore the generation links by regenerating the PDM from the new LDM, using the Update existing PDM option (see Linking and Synchronizing Models in the Core Features Guide ).
19
2. Click Open, browse to the legacy PDMs you want to import, select them, and then click OK to add them to the list. You can, if necessary, add multiple PDMs from multiple directories by repeating this step. 3. When you have added all the necessary PDMs to the list, click OK to import them into interconnected LDMs.
20
In the information system for a publishing company, the last names for authors and customers are both important pieces of business information. The data item LAST NAME is created to represent this information. It is attached to the entities AUTHOR and CUSTOMER, and becomes entity attributes of those entities. Another piece of information is the date of birth of each author. The data item BIRTH DATE is created but, as there is no immediate need for this information in the model, it is not attached to any entity.
For general information about creating objects, see the Objects chapter
in the Core Features Guide .
21
Property
Description
Name
Species the name of the item, which should be clear and meaningful, and should convey the items purpose to nontechnical users. Species the technical name of the object, which is used for generating code or scripts, which may be abbreviated, and should not generally include spaces. Species a descriptive label for the data item. Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or userdened. Species the code indicating the data format, such as N for numeric or A for alphanumeric, followed by the number of characters. Species the maximum number of characters. Species the number of places after the decimal point, for data values that can take a decimal point. Species the name of the associated domain (See Domains (CDM/LDM/PDM) in the Building Physical Diagrams chapter). If you attach a data item to a domain, the domain supplies a data type to the data item, and can also apply length, decimal precision, and check parameters.
Code
Comment Stereotype
Data type
The following tabs are also commonly used: Standard Checks - contains checks which control the values permitted for the data item (see Check parameters (CDM/LDM/PDM) in the Building Physical Diagrams chapter). Additional Checks - allows you to specify additional constraints (not dened by standard check parameters) for the data item. Rules - lists the business rules associated with the data item (see Business Rules (CDM/LDM/PDM) in the Building Physical Diagrams chapter).
Option
When selected
When cleared
Each data item must have a unique code. One data item can be an entity attribute for multiple entities.
Multiple data items can have the same code. Each data item can be an entity attribute for only one entity
If you do not select Unique Code, two data items can have the same code, and you differentiate them by the entities that use them. The entities are listed in the Used By column of the list of data items.
Item not visible in list
To make an item visible in a list, click the Customize Columns and Filter tool in the list toolbar, select the appropriate check box from the list of lter options that is displayed, and click OK. O To dene code and reuse options for data items 1. Select Tools Model Options to open the Model Options dialog box: 2. Select or clear the Unique Code and Allow Reuse check boxes in the Data Item groupbox, and then click OK to return to the model.
Error message
The following error message is displayed if you select the Unique Code option, when data items are already sharing a name in the CDM:
Error message Solution
Unique Code option could not be selected because two data items have the same code: data_item_code.
23
Entities (CDM/LDM)
Entities (CDM/LDM)
An entity represents an object about which you want to store information. For example, in a model of a major corporation, the entities created may include Employee and Division. When you generate a PDM from a CDM or LDM, entities are generated as tables.
Creating an entity
You can create an entity in any of the following ways: Use the Entity tool in the diagram Palette. Select Model Entities to access the List of Entities, and click the Add a Row tool. Right-click the model or package in the Browser, and select New Entity.
For general information about creating objects, see the Objects chapter
in the Core Features Guide .
Entity properties
You can modify an objects properties from its property sheet. To open an entity property sheet, double-click its diagram symbol or its Browser entry in the Entities folder. The General tab contains the following properties:
24
Property
Description
Name
Species the name of the item, which should be clear and meaningful, and should convey the items purpose to nontechnical users. Species the technical name of the object, which is used for generating code or scripts, which may be abbreviated, and should not generally include spaces. Species a descriptive label for the entity. Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or userdened. Species the estimated number of occurrences in the physical database for the entity (the number of records). Species that the entity will generate a table in a PDM. [read-only] Species the parent entity. Click the Properties tool at the right of the eld to open the parent property sheet.
Code
Comment Stereotype
The following tabs are also available: Attributes - lists the attributes associated with the entity (see Attributes (CDM/LDM) on page 27). Identiers - lists the attributes associated with the entity (see Identiers (CDM/LDM) on page 30). Rules - lists the business rules associated with the entity (see Business Rules (CDM/LDM/PDM) in the Building Physical Diagrams chapter). Subtypes [Barker only] lists the subtypes that inherit from the entity.
Copying an entity
You can make a copy of an entity within the same model or between models. The following rules apply to copied entities. The indicated selections for Unique code and Allow reuse apply to the model that receives the copied entity:
25
Entities (CDM/LDM)
New entity with new name and code New identier with new name code Reuses other entity attributes
New entity with new name and code New identier with new name and code New attributes with new names and codes
New entity with new name and code New identier with same name and code Reuses other entity attributes
None
New entity with new name and code New identier with same name code New entity attributes with same names and codes
O To copy an entity within a model 1. Select an entity in the CDM/LDM, and then select Edit Copy and Edit Paste. 2. [alternatively] Press CTRL and drag the entity to a new position in the diagram. The entity is copied and the new entity is displayed in the Browser and diagram. O To copy an entity to a different model 1. Select an entity in the CDM/LDM, and then select Edit Copy 2. Select the new diagram or model and then select Edit Paste. The entity is copied and the new entity is displayed in the Browser and diagram.
26
Attributes (CDM/LDM)
In a CDM, attributes are data items attached to an entity, association, or inheritance. In an LDM, there are no data items, and so attributes exist in entities without a conceptual origin. When you generate a PDM from a CDM or LDM, entity attributes are generated as table columns.
Creating an attribute
You can create an entity attribute using the following tools, available on the Attributes tab in the property sheet of an entity, association, or inheritance:
Tool Description
Add a Row Creates a new attribute and associated data item (with the same name and code). If you have enabled the Allow Reuse model option, the new data item can be used as an attribute for other objects. If you have enabled the Allow Reuse and Unique Code model options and you type the name of an existing data item, it will be automatically reused. Add Data Item (CDM)/Add Attributes (LDM) - Opens a Selection window listing all the data items/attributes available in the model. Select one or more data items/attributes in the list and then click OK to make them attributes to the object. If the data item/attribute has not yet been used, it will be linked to the object. If the data item/attribute has already been used, it will be copied (with a modied name if you have enabled the Unique code model option) and the copy attached to the object.
For general information about creating objects, see the Objects chapter
in the Core Features Guide .
Attribute properties
You can modify an objects properties from its property sheet. To open an attribute property sheet, double-click its Browser entry in the Attributes folder within an entity, association, or inheritance. The General tab contains the following properties:
27
Attributes (CDM/LDM)
Property
Description
Name
Species the name of the item, which should be clear and meaningful, and should convey the items purpose to nontechnical users. Species the technical name of the object, which is used for generating code or scripts, which may be abbreviated, and should not generally include spaces. Species a descriptive label for the attribute. Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or userdened. [read-only] Species the parent object. Click the tool to the right of the eld to open its property sheet. [CDM only, read-only] Species the related data item. Click the tool to the right of the eld to open its property sheet. [LDM only, read-only] Species the parent entity from which the attribute is migrated through an inheritance. Species the data type of the attribute, such as numeric, alphanumeric, boolean, or others. Click the question mark button to open the list of data types (see Domains (CDM/LDM/PDM) in the Building Physical Diagrams chapter). Species the maximum length of the data type. Species the maximum number of places after the decimal point. Species the name of the associated domain (See Domains (CDM/LDM/PDM) in the Building Physical Diagrams chapter). If you attach an attribute to a domain, the domain supplies a data type to the attribute, and can also apply length, decimal precision, and check parameters. [entity attributes only] Indicates whether or not the attribute is the primary identier of the entity. [entity and association attributes only] Displays the attribute in the object symbol.
Code
Comment Stereotype
28
Property
Description
Mandatory
Species that every object occurrence must assign a value to the attribute. Identiers (see Identiers (CDM/LDM) on page 30) are always mandatory. [LDM only, read-only] Indicates whether or not the attribute is the foreign identier of the entity.
Foreign identier
The following tabs are also available: Standard Checks - contains checks which control the values permitted for the attribute (see Check parameters (CDM/LDM/PDM) in the Building Physical Diagrams chapter). Additional Checks - allows you to specify additional constraints (not dened by standard check parameters) for the attribute. Rules - lists the business rules associated with the attribute (see Business Rules (CDM/LDM/PDM) in the Building Physical Diagrams chapter).
Unique Code and Allow Reuse Unique Code only Allow Reuse only None
Does not delete corresponding data item Does not delete corresponding data item Deletes corresponding data item if it is not used by another entity Deletes corresponding data item
29
Identiers (CDM/LDM)
Identiers (CDM/LDM)
An identier is one or many entity attributes, whose values uniquely identify each occurrence of the entity. Each entity must have at least one identier. If an entity has only one identier, it is designated by default as the primary identier. When you generate a PDM from a CDM or LDM, identiers are generated as primary or alternate keys.
Creating an identier
You can create an entity in any of the following ways: Open the Attributes tab in the property sheet of an entity, select one or more attributes, and click the Create Identier tool. The selected attributes are associated with the identier and are listed on the attributes tab of its property sheet. Open the Identiers tab in the property sheet of an entity, and click the Add a Row tool.
For general information about creating objects, see the Objects chapter
in the Core Features Guide .
Identier properties
You can modify an objects properties from its property sheet. To open an identier property sheet, double-click its Browser entry in the Identiers folder beneath an entity. The General tab contains the following properties:
30
Property
Description
Name Code
The name of the identier which should be clear and meaningful, and should convey its purpose to non-technical users. The technical name of the identier used for generating code or scripts, which may be abbreviated, and should not generally include spaces. Species a descriptive label for the identier. Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or userdened. Species the name of the entity to which the identier belongs. Species that the identier is a primary identier.
Comment Stereotype
The following tabs are also available: Attributes - lists the attributes (see Attributes (CDM/LDM) on page 27) associated with the identier: Click the Add Attributes tool to add an attribute.
31
Relationships (CDM/LDM)
Relationships (CDM/LDM)
A relationship is a link between entities. For example, in a model that manages human resources, the Member relationship links the entities Employee and Team and expresses that each employee works in a team, and each team has employees. An occurrence of a relationship corresponds to one instance of each of the two entities involved in the relationship. For example, the employee Martin working in the Marketing team is one occurrence of the relationship Member. When you generate a PDM from a CDM or LDM, relationships are generated as references.
Relationships and associations
Relationships are used in the Entity Relationship (ER), Barker, and IDEF1X modeling methodologies. In the Merise methodology associations (see Associations and Association Links (CDM) on page 44) are used to link entities. PowerDesigner lets you use either relationships or associations exclusively, or combine the two methodologies in the same model. This section analyzes relationships in the Entity Relationship methodology, for more information on IDEF1X, see Setting CDM/LDM Model Options in the Working with Data Models chapter.
Creating a relationship
You can create a relationship in any of the following ways: Use the Relationship tool in the diagram Palette. Click inside the rst entity to be linked and, while continuing to hold down the mouse button, drag the cursor to the second entity. Release the mouse button inside the second entity. Select Model Relationships to access the List of Relationships, and click the Add a Row tool. Right-click the model or package in the Browser, and select New Relationship.
For general information about creating objects, see the Objects chapter
in the Core Features Guide .
Relationship properties
You can modify an objects properties from its property sheet. To open a relationship property sheet, double-click its diagram symbol or its Browser entry in the Relationships folder. 32
Name
Species the name of the item, which should be clear and meaningful, and should convey the items purpose to nontechnical users. Species the technical name of the object, which is used for generating code or scripts, which may be abbreviated, and should not generally include spaces. Species a descriptive label for the relationship. Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or userdened. Species the two entities linked by the relationship. You can use the tools to the right of the lists to create an object, browse the complete tree of available objects or view the properties of the currently selected object. Species that the relationship should be generated as a reference when you generate a PDM. Contains data about cardinality as the number of instances of one entity in relation to another entity.
Code
Comment Stereotype
Entity1 Entity2
Generate Cardinalities
33
Relationships (CDM/LDM)
Relationship property sheet Cardinalities tab The Cardinalities tab contains the following properties:
Property Description
Cardinality
Species the number of instances (none, one, or many) of an entity in relation to another entity. You can choose from the following values: One-to-one (symbol: <1..1>) - One instance of entity A can correspond to only one instance of entity B. One-to-many (symbol: <1..n>) - One instance of entity A can correspond to more than one instance of entity B. Many-to-one (symbol: <n..1>) - More than one instance of entity A can correspond to the same one instance of entity B. Many-to-many (symbol: <n..n>) - More than one instance of entity A can correspond to more than one instance of entity B. To use n..n relationships in an LDM, see Enabling many-to-many relationships in an LDM on page 38.
34
Property
Description
Dominant role
In a one-to-one relationship, you can dene one direction of the relationship as dominant. If you dene a dominant direction, the one-to-one relationship generates one reference in the PDM. The dominant entity becomes the parent table. If you do not dene a dominant direction, the one-to-one relationship generates two references. The relationship pictured here shows the one-to-one relationship. In a PDM, this relationship generates the following reference: Author is the parent table, and its primary key migrates to the Picture table as foreign key.
Role name
35
Relationships (CDM/LDM)
Property
Description
Dependent
In a dependent relationship, one entity is partially identied by another. Each entity must have an identier. In some cases, however, the attributes of an entity are not sufcient to identify an occurrence of the entity. For these entities, their identiers incorporate the identier of another entity with which they have a dependent relationship. For example, an entity named Task has two entity attributes, TASK NAME and TASK COST. A task may be performed in many different projects and the task cost will vary with each project. To identify each occurrence of TASK COST the unique Task entity identier is the compound of its Task name entity attribute and the Project number identier from the Project entity. A many-to-many relationship cannot be a dependent relationship. The relationship pictured here expresses this dependency.
The circle at the top of the triangle indicates that occurrences of the Project entity do not require an occurrence of the Task entity. But an occurrence of the Task entity requires an occurrence of the Project entity on which it depends. Mandatory Indicates that the relationship between entities is mandatory. You dene options from the point of view of the both entities in the relationship. For example, the subcontract relationship is optional from customer to project, but mandatory from project to customer. Each project must have a customer, but each customer does not have to have a project. Cardinality Species the maximum and minimum number of instances of EntityA in relation to EntityB (if mandatory, at least 1). You can choose from the following values: 0..1 Zero to one instances 0..n Zero to many instances 1..1 Exactly one instance 1..n one to many instances
36
Relationship property sheet Joins tab (LDM) A join is a link between an attribute in a parent entity and an attribute in a child entity (attribute pair) that is dened within a relationship. A join can link primary, alternate or foreign identiers, or user-specied attributes in the parent and child entities that are independent of identier attributes. O To dene joins in a relationship 1. Double-click a relationship in the diagram to open its property sheet and then click the Joins tab. 2. Select a key in the Parent Identier list to create joins on its attributes. If you select <NONE>, the attribute lists are empty and you must specify your own attributes to join. The attributes linked by the joins are listed in the Parent Attribute and Child Attribute columns.
37
Relationships (CDM/LDM)
You can change the foreign identier attribute linked by a join by clicking the attribute in the Child Entity list, and selecting another attribute from the list. 3. [optional] If you selected <NONE> from the Parent Identier list, click the Parent Attribute column and select an attribute from the list, then click the Child Attribute column and select a child attribute. 4. [optional] Select the Auto arrange join order check box to sort the list by the identier attribute order. If this option is not selected, you can re-arrange the attributes using the arrow buttons. 5. Click OK.
Linking attributes in a primary or alternate identier
For any relationship you can choose to link a primary or alternate identier, to a corresponding foreign identier. When you select an identier from the Joins tab of the relationship property sheet, all the identier attributes are linked to matching foreign identier attributes in the child entity.
Changing a foreign identier attribute link
A foreign identier attribute can be changed to link to another parent entity attribute, either within the identier relationship, or independent of it.
Reuse and Migration option for a selected relationship
You can use the following buttons on the Joins tab to reuse or migrate attributes linked by joins.
Tool Description
Reuse Attributes - Reuse existing child attributes with same code as parent entity attributes. Migrate Attributes - Migrate identier attributes to foreign identier attributes. If attributes do not exist they are created. Cancel Migration - Delete any migrated attributes in child entity.
Enabling many-to-many relationships in an LDM In an LDM, many-to-many relationships are, by default, not permitted and are represented with an intermediary entity. If you allow many-to-many relationships, you can select the many-to-many value in the cardinalities tab.
38
O To display the many-to-many value in a LDM cardinalities tab 1. Select Tools Model Options to open the Model Options dialog box. 2. Select the Allow n-n relationships check box in the Relationship groupbox, and then click OK to return to the model.
To obtain clean lines with rounded corners when you create a reexive relationship, select Display Preferences Format Relationship and modify the Line Style with the appropriate type from the Corners list. O To create a reexive relationship 1. Click the Relationship tool in the Palette. 2. Click inside the entity symbol and, while continuing to hold down the mouse button, drag the cursor a short distance within the symbol, before releasing the button. A relationship symbol loops back to the same entity.
Entity dependencies
In the Dependencies page of the entity, you can see two identical occurrences of the relationship, this is to indicate that the relationship is reexive and serves as origin and destination for the link
39
Relationships (CDM/LDM)
The following error message is displayed when the option you choose is incompatible with the current CDM:
Error message Solution
Unique Code option could not be selected because at least two relationships have the same code: relationship_code.
40
O To change a relationship into an associative entity using the Change to Entity Wizard 1. Right-click a relationship symbol and select Change to Entity Wizard from the contextual menu to open the Change to Entity Wizard. 2. On the Customizing Entity page, type an entity name and code, and then click Next. 3. On the rst Customizing Relationship page, complete the details for the relationship that will be created between the rst entity and the new entity, and then click Next. 4. On the second Customizing Relationship page, complete the details for the relationship that will be created between the new entity and the second entity, and then click Finish. The associative entity with two relationships replaces the relationship.
Relationship examples
This section shows the graphic representation of various relationship properties.
One-to-many relationship Description
Each division may have zero or more employees Each employee may belong to zero or one division Each division must have one or more employees Each employee may belong to zero or one division Each division may have zero or more employees Each employee must belong to one and only one division Each division must have one or more employees Each employee must belong to one and only one division
41
Relationships (CDM/LDM)
One-to-many relationship
Description
Each division may have zero or more employees Each employee must belong to one and only one division Each employee is identied uniquely by division number and employee number Each division must have one or more employees Each employee must belong to one and only one division Each employee is identied uniquely by division number and employee number
One-to-one relationship
Description
Each team works on zero or one project Each project is managed by zero or one team Each team works on one and one project only Each project is managed by zero or one team Each team works on zero or one project Each project is managed by one and one team only
42
Many-to-many relationship
Description
Each division may have zero or more employees Each employee may belong to zero or more divisions Each division must have one or more employees Each employee may belong to zero or more divisions Each division may have zero or more employees Each employee must belong to one or more divisions Each division must have one or more employees Each employee must belong to one or more divisions
Foreign identiers become attributes of the primary identier of the child entity. No attributes are migrated. Primary identier migrate from the dominant attribute. If the child to parent role is mandatory, migrated attributes are mandatory.
43
When you generate a PDM, K7RENTED is generated as a table with ve columns, STORE_ID,K7_ID, CLIENT_ID, DATE, and STAFF_ID.
44
You can use associations exclusively in your CDM, or use both associations and relationships.
Association links
An association is connected to an entity by an association link, which symbolizes the role and the cardinality between an association and an entity.
45
Right-click the model or package in the Browser, and select New Association. Once you have created the association, you can link it to the relevant entities by using the Association Link tool.
For general information about creating objects, see the Objects chapter
in the Core Features Guide .
Association properties
You can modify an objects properties from its property sheet. To open an association property sheet, double-click its diagram symbol or its Browser entry in the Associations folder. The General tab contains the following properties:
Property Description
Name
Species the name of the item, which should be clear and meaningful, and should convey the items purpose to nontechnical users. Species the technical name of the object, which is used for generating code or scripts, which may be abbreviated, and should not generally include spaces. Species a descriptive label for the association. Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or userdened. Species the estimated number of occurrences in the physical database for the association (the number of records). Species that the association will generate a table in a PDM. Species the data item attached to an association. Species the business rules associated with the association.
Code
Comment Stereotype
46
Entity
Species the entity connected by the association link. You can use the tools to the right of the list to create an object, browse the complete tree of available objects or view the properties of the currently selected object. Species the association connected by the association link. Species the label indicating the role of the association link. Indicates if the entity is dependent on the other entity. Species the number of occurrences (one or many) that one entity has relative to another. You dene the cardinality for each association link between the association and the entity. You can choose between: 0,1 - There can be zero or one occurrence of the association in relation to one instance of the entity. The association is not mandatory 0,n - There can be zero or many occurrences of the association in relation to one instance of the entity. The association is not mandatory 1,1 - One occurrence of the entity can be related to only one occurrence of the association. The association is mandatory 1,n - One occurrence of the entity can be related to one or many occurrences of the association. The association is mandatory You can change the default format of cardinalities from the registry:
HKEY_CURRENT_USER\Software\Sybase\ PowerDesigner <version>\ ModelOptions\Conceptual Options CardinalityNotation=1 (0..1) or 2 (0,1)
Stereotype
Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or userdened.
O To create a reexive association 1. Click the Association Link tool in the Palette. 2. Click inside the entity symbol and, while continuing to hold down the mouse button, drag the cursor a short distance within the symbol, before releasing the button. 3. Drag the resulting association symbol away from entity to make clear its two links to the entity:
In the example above, the reexive association Manager expresses that an employee (Manager) can manage other employees.
An entity named Task has two entity attributes, TASK NAME and TASK COST. A task may be performed in many different projects and the task cost will vary with each project. To identify each occurrence of TASK COST the unique Task entity identier is the compound of its Task name entity attribute and the Project number identier from the Project entity.
When you generate a PDM, the TASK table contains the PROJECT NUMBER column as a foreign key, which is also a primary key column. The primary key therefore consists of both PROJECT NUMBER and TASK NAME columns.
48
The same association can not have two identier association links. O To dene a dependent association 1. Double-click an association link symbol to display the association link property sheet. 2. Select the Identier check box and then click OK to return to the model.. The cardinality of the association link is enclosed in parenthesis to indicate that the association link is an identier.
Two entities PROJECT MANAGER and CONTRACTOR are linked by the association WORKS ON PROJECT WITH:
49
O To change an association into an associative entity 1. Right-click an association symbol, and select Change to Entity from the contextual menu. An associative entity that is linked to two associations replaces the original association. The associative entity takes the name of the original association.
50
Inheritances (CDM/LDM)
An inheritance allows you to dene an entity as a special case of a more general entity. The general, or supertype (or parent) entity contains all of the common characteristics, and the subtype (or child) entity contains only the particular characteristics. In the example below, the Account entity represents all the bank accounts in the information system. There are two subtypes: checking accounts and savings accounts.
Standard
Complete inheritance
There is no separate inheritance object in the Barker notation. You represent an inheritance by placing one entity symbol on top of another. Barker inheritances are always complete and mutually exclusive. The supertype lists its subtypes on the Subtypes tab (see Entity properties on page 24).
Creating an inheritance
You can create an inheritance in any of the following ways:
51
Inheritances (CDM/LDM)
Use the Inheritance tool in the diagram Palette (see Creating an inheritance with the Inheritance tool on page 52). Select Model Inheritances to access the List of Inheritances, and click the Add a Row tool. You will be required to specify a parent entity. Right-click the model or package in the Browser, and select New Inheritance. You will be required to specify a parent entity.
For general information about creating objects, see the Objects chapter
in the Core Features Guide . Creating an inheritance with the Inheritance tool You can use the inheritance tool to create inheritances between entities and to join additional children to an inheritance. O To create an inheritance link using the Inheritance tool 1. Select the Inheritance tool in the Palette. 2. Click the child entity and, while continuing to hold down the mouse button, drag the cursor to the parent entity. Release the mouse button inside the child entity. The link is displayed between the two entities and has a half-circle in the middle and an arrowhead that points to the parent entity.
3. [optional] To create additional child entities for the same link, drag and drop an inheritance link from the half-circle to the additional child entity. The symbol links all the child entities to the parent.
52
You can change the child entity at the end of an inheritance link by clicking the inheritance link and drag one of its attach points to a different entity. 4. [optional] Double-click the new link in the diagram to open the inheritance property sheet, and enter any appropriate properties.
Inheritance properties
You can modify an objects properties from its property sheet. To open an inheritance property sheet, double-click its diagram symbol or its Browser entry in the Inheritances folder. The General tab contains the following properties:
Property Description
Name
Species the name of the item, which should be clear and meaningful, and should convey the items purpose to nontechnical users. Species the technical name of the object, which is used for generating code or scripts, which may be abbreviated, and should not generally include spaces. Species a descriptive label for the inheritance link. Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or userdened. Species the name of the parent entity. You can use the tools to the right of the list to create an object, browse the complete tree of available objects or view the properties of the currently selected object. Species that only one child can exist for one occurrence of the parent entity. Species that all instances of the parent entity (surtype) must belong to one of the children (subtypes). For example, entity Person has 2 sub-types Male and Female; each instance of entity Person is either a male or a female.
Code
Comment Stereotype
Parent
53
Inheritances (CDM/LDM)
Inheritance property sheet Generation tab The generation mode denes the physical implementation of an inheritance structure by specifying which entities in an inheritance structure should be generated as tables in the PDM. The Generation tab contains the following properties:
Property Description
Generation Mode
Species which parts of the inheritance will be generated. You can specify one or both of the following: Generate parent - Generates a table corresponding to the parent entity, which: Inherits entity attributes of each child entity Is affected by child entity relationships Contains reference to any table which has a many-to-one relationship with child entity Generate children - Generates a table corresponding to each child entity. The primary key of each child table is the concatenation of the child entity identier and the parent entity identier. When this option is selected, you must choose between: Inherit all attributes Each table inherits all the entity attributes of the parent entity Inherit only primary attributes - Each table inherits only the identier of the parent entity Note that, if you do not select Generate Children, you can control the generation of individual child tables using the option Generate in the property sheet of each child entity.
54
Property
Description
Specifying attributes
In the case of parent-only generation, you can choose to dene a specifying attribute, an entity attribute that is dened for a parent entity which differentiates occurrences of each child. In the example below, the TITLE entity has two children, NONPERIODICAL and PERIODICAL. As only the parent table TITLE will be generated in a PDM, a specifying entity attribute PERIODICAL is dened for the inheritance link to differentiate between the two child entities. In the PDM, each of the child entity attributes will generate columns in the table TITLE, and the specifying entity attribute PERIODICAL will generate a corresponding column PERIODICAL. The values of this column indicate whether an instance of TITLE is a periodical or
not.
The tools available on this tab for creating specifying attributes are the same as those for creating entity attributes. For more information, see Creating an attribute on page 27.
Inheritance property sheet Children tab The Children tab list the child entities attached to the inheritance. O To add a child entity to an inheritance link 1. Open an inheritance property sheet and click the Children tab: 2. Click the Add Children tool to open a selection window listing all the entities available in the model. 3. Select one or more entities, and then click OK to return to the inheritance property sheet. The new entity is added to the list of child entities. 55
Inheritances (CDM/LDM)
4. Click OK to return to the diagram. The new child entity is linked to the inheritance symbol in the diagram.
56
CHAPTER 3
This chapter describes how to build physical diagrams, and how to create and modify the associated objects.
Topic: Physical Diagram Basics Tables (PDM) Columns (PDM) Keys (PDM) Indexes (PDM) Defaults (PDM) Domains (CDM/LDM/PDM) Sequences (PDM) Abstract Data Types (PDM) References (PDM) Views (PDM) View References (PDM) Check Parameters (CDM/LDM/PDM) Business Rules (CDM/LDM/PDM) Physical Options page 58 62 86 95 103 111 115 124 129 138 152 169 174 179 188
57
Table
Collection of rows (records) that have associated columns (elds). See Tables (PDM) on page 62. [none] [none] Data structure that contains an individual data item within a row (record), model equivalent of a database eld. See Columns (PDM) on page 86. Column or columns whose values uniquely identify each row in a table, and are designated as the primary identier of each row in the table. See Keys (PDM) on page 95. Column or columns whose values uniquely identify each row in a table, and which is not a primary key. See Keys (PDM) on page 95. Column or columns whose values depend on and migrate from a primary or alternate key in another table. See Keys (PDM) on page 95. Data structure associated with one or more columns in a table, in which the column values are ordered in such a way as to speed up access to data. See Indexes (PDM) on page 103.
Column
Primary key
[none]
[none]
Alternate key
[none]
[none]
Foreign key
[none]
[none]
Index
[none]
[none]
58
Object
Tool
Symbol
Description
Default
[none]
[none]
[certain DBMSs] A default value for a column. See Defaults (PDM) on page 111. Denes valid values for a column. See Domains (CDM/LDM/PDM) on page 115. [certain DBMSs] Denes the form of incrementation for a column. See Sequences (PDM) on page 124. [certain DBMSs] User-dened data type. See Abstract Data Types (PDM) on page 129. Link between a primary or an alternate key in a parent table, and a foreign key of a child table. Depending on its selected properties, a reference can also link columns that are independent of primary or alternate key columns. See References (PDM) on page 138. Data structure that results from a SQL query and that is built from data in one or more tables. See Views (PDM) on page 152. Link between a table and a view. See View References (PDM) on page 169.
Domain
[none]
[none]
Sequence
[none]
[none]
[none]
[none]
View
A segment of SQL code associated with a table or a view. See Trigger Overview in the Building Triggers and Procedures chapter. Precompiled collection of SQL statements stored under a name in the database and processed as a unit. See Stored Procedures and Functions in the Building Triggers and Procedures chapter.
Procedure
59
Object
Tool
Symbol
Description
Database
[none]
[none]
The database of which the PDM is a representation. See Creating a Database in the Getting Started with Data Modeling chapter. A partition on a storage device. See Tables spaces and Storages in the Generating a Database from a PDM chapter. A partition in a database. See Tables spaces and Storages in the Generating a Database from a PDM chapter. A person who can log in or connect to the database. See Users (PDM) in the Building a Database Access Structure chapter. A predened user prole. See Roles (PDM) in the Building a Database Access Structure chapter. Denes privileges and permissions for a set of users. See Groups (PDM) in the Building a Database Access Structure chapter. An alternative name for various types of objects. See Synonyms (PDM) in the Building a Database Access Structure chapter. Collection of SQL statements stored in a database to retrieve relational data in HTML, XML, WSDL or plain text format, through HTTP or SOAP requests. See Web Services (PDM) in the Building Web Services chapter. Sub-object of a Web service containing a SQL statement and displaying Web parameters and result columns. See Web Service Operations (PDM) in the Building Web Services chapter.
Storage
[none]
[none]
Tablespace
[none]
[none]
User
[none]
[none]
Role
[none]
[none]
Group
[none]
[none]
Synonym
[none]
[none]
Web service
[none]
[none]
Web operation
[none]
[none]
60
61
Tables (PDM)
Tables (PDM)
A table represents a collection of data arranged in columns and rows. Tables may contain any of the following objects: Columns are named properties of a table that describe its characteristics (see Columns (PDM) on page 86). Indexes are data structures associated with a table that are logically ordered by key values (see Indexes (PDM) on page 103). Keys are columns, or combinations of columns, that uniquely identify rows in a table. Each key can generate a unique index or a unique constraint in a target database (see Keys (PDM) on page 95). Triggers are segments of SQL code associated with tables, and stored in a database. They are invoked automatically whenever there is an attempt to modify data in associated tables (see the Building Triggers and Procedures chapter). You can use database-specic physical options to specify physical parameters for tables and many other objects (see Physical Options on page 188).
Creating a table
You can create a table in any of the following ways: Use the Table tool in the diagram Palette Select Model Tables to access the List of Tables, and click the Add a Row tool Right-click the model or package in the Browser, and select New Table
For general information about creating objects, see the Objects chapter
in the Core Features Guide .
Table properties
You can modify an objects properties from its property sheet. To open a table property sheet, double-click its diagram symbol or its Browser entry in the Tables folder. The following sections detail the property sheet tabs that contain the properties most commonly entered for tables. The General tab contains the following properties:
62
Property
Description
Name
Species the name of the item which should be clear and meaningful, and should convey the items purpose to nontechnical users Species the technical name of the item used for generating code or scripts, which may be abbreviated, and should not generally include spaces Species a descriptive label for the table Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or userdened Species the name of the table owner. You choose an owner from a list of users. A table can only have one owner at a time. This is normally the table creator Species the estimated number of records in the table in the physical database, which is used to estimate database size. This box is automatically populated during reverse engineering if you select the Statistics check box in the Reverse Engineering dialog box (see Reverse Engineering from a Live Database in the Reverse Engineering a Database into a PDM chapter). You can enter your own value in this eld, or refresh its statistics (along with those for all of the tables columns) at any time by right-clicking the table symbol or its entry in the Browser and selecting Update Statistics from the contextual menu. You can also update the statistics for all tables by selecting Tools Update Statistics (see Reverse Engineering Database Statistics in the Reverse Engineering a Database into a PDM chapter).
Code
Comment Stereotype
Owner
Number
Species that the table is generated in the database Species the multidimensional type of the table. You can choose between: Dimension - see Dimensions (PDM) in the Building Multidimensional Diagrams chapter Fact - see Facts (PDM) in the Building Multidimensional Diagrams chapter
63
Tables (PDM)
Property
Description
Type
Species the type of the table. You can choose between: Relational Object - for abstract data types XML - for storing and retrieving data using an XML format. For more information, see Creating an XML table or view on page 65
The following tabs are also available: Columns - lists the columns associated with the table (see Columns (PDM) on page 86). Indexes - lists the indexes associated with the table (see Indexes (PDM) on page 103). Keys - lists the keys associated with the table (see Keys (PDM) on page 95). Triggers - lists the triggers associated with the table (see The Building Triggers and Procedures chapter). Procedures - lists the procedures associated with the table (see the Building Triggers and Procedures chapter). Physical Options - list the physical options associated with the table (see Physical Options on page 188). Preview - displays the SQL code associated with the table (see Previewing SQL statements in the Working with Data Models chapter).
64
For more information on abstract data types, see Abstract Data Types (PDM) on page 129. Creating an XML table or view
Some DBMS support tables and views of XML type. An XML table is used to store an XML document, it does not contain columns. It is possible to associate this table with an XML schema registered in a relational database, in this case the schema is used to validate the XML document stored in the table. If you select the XML type in the Type list, the Column tab disappears and the following additional properties appear in the table property sheet:
65
Tables (PDM)
Property
Description
Schema
Allows you to enter the target namespace or the name of an XML model. The schema must be registered in the database to be used for validating XML documents. You can: type a user-dened schema name click the Select a registered schema button to connect to a database and select a registered schema If you select an element from an XML model open in the PowerDesigner workspace, the Schema property is automatically initialized with the XML model target namespace. Note that this schema must also be registered in the database to be used for validating XML documents
Element
Allows you to select a root element in the XML document. You can: type a user-dened element name click the Select an element button to select an element from the XML models open in the workspace or from the schema registered in the database
O To create an XML table 1. Right-click the Table category in the Browser and select New. The property sheet of a new table is displayed. 2. Type a table name and a table code. 3. In the Type list, select XML. The Columns tab disappears and the Schema and Element boxes appear in the lower part of the General tab. 4. In the Schema box, type the target namespace or name of an XML model or use the Select a registered schema button to select among the registered schema in a selected database. 5. In the Element box, type the name of the root element of the selected schema.
66
6. Click OK.
You can always return to the default constraint name by re-clicking the User-Dened button. 3. Click OK. 67
Tables (PDM)
For more information, see Check Parameters (CDM/LDM/PDM) on page 174. Creating external tables
You can create external tables when you need to access data in a remote table. The external table has all the properties of the remote table but it does not contain any data locally. External tables are metamodel extensions dened in the prole category of an extended model denition attached to a PDM. For example, in Sybase ASA, external tables are called proxy tables and a specic extended model denition is delivered to let you design these tables.
Vertical partitioning is used to divide a table into multiple tables containing the same number of rows but fewer columns Table collapsing is used to merge tables in order to eliminate the join between them Column denormalization is used to repeat a column in tables in order to avoid creating a join between tables The following sections explain how to implement these denormalization techniques in PowerDesigner. Creating horizontal partitions Horizontal partitioning consists in segmenting a table into multiple tables each containing a subset of rows and the same columns as the partitioned table in order to optimize data retrieval. You can use any column, including primary keys, as partitioning criteria.
Example
This table may contain a very large amount of data. You could optimize data retrieval by creating horizontal partitions by year. The result is as follows:
69
Tables (PDM)
Pros
Cons
Improve the query response time Accelerate incremental data backup and recovery Decrease time required to load into indexed tables Horizontal Partitioning Wizard
Requires additional joins and unions to retrieve data from multiple tables Requires more intelligent queries to determine which table contains the requested data Requires additional metadata to describe the partitioned table
You can partition tables horizontally using the Horizontal Partitioning Wizard. O To partition a table with the Horizontal Partitioning Wizard 1. Select Tools Denormalization Horizontal Partitioning, or right-click a table in the diagram and select Horizontal Partitioning from the contextual menu, in order to open the Horizontal Partitioning Wizard:
2. Select the table to partition and select the check box if you want to keep the original table after partitioning. Then click Next to go to the Partition Denition page. 3. The Partition Denition page allows you to create as many partitions as you need with the Insert and Add a row tools. The name of each partition must be unique in the model. A table will be created for each partition
70
you specify, and will take the name of the relevant partition. Then click Next to go to the Discriminant Column Selection page. 4. The Discriminant Column Selection page allows you to specify the columns that will be used as partition criteria using the Add Columns tool. These columns will not be included in the partitions. Then click Next to go to the Partitioning Information page. 5. The Partitioning Information page allows you to specify a name and code for the transformation object that will be created together with the partitions. Then click Finish. The table is partitioned, a horizontal partitioning object is created, and all references to the original table are created on each partition table. Creating vertical partitions Vertical partitioning consists in segmenting a table into multiple tables each containing a subset of columns and the same number of rows as the partitioned table. The partition tables share the same primary key.
Example
This table can be divided in two tables corresponding to different aspects of the table. You can use the Vertical Partitioning Wizard to split the table as follows:
71
Tables (PDM)
Pros
Cons
Improve the query response time Allows you to split data requiring different levels of protection, you can store condential information in a special partition
Requires additional joins and unions to retrieve data from multiple tables Requires more intelligent queries to determine which table contains the requested data Requires additional metadata to describe the partitioned table
You can partition tables vertically using the Vertical Partitioning Wizard. The key columns of the partitioned table are duplicated whereas the other columns are distributed among the partition tables. PowerDesigner veries that all the columns of the partitioned table are used in the partition tables. O To partition a table with the Vertical Partitioning Wizard 1. Select Tools Denormalization Vertical Partitioning, or right-click a table in the diagram and select Vertical Partitioning from the contextual menu, in order to open the Vertical Partitioning Wizard:
2. Select the table to partition and select the check box if you want to keep the original table after partitioning. Then click Next to go to the Partition Denition page. 3. The Partition Denition page allows you to create as many partitions as 72
you need with the Insert and Add a row tools. The name of each partition must be unique in the model. A table will be created for each partition you specify, and will take the name of the relevant partition. Then click Next to go to the Discriminant Column Selection page. 4. The Discriminant Column Selection page allows you to specify which columns will be included in each partition table. Drag columns from the Available columns pane, and drop them onto the appropriate partition table in the Columns distribution pane, or use the Add and Remove buttons at the bottom of each pane. When all your columns are allocated, click Next to go to the Partitioning Information page. 5. The Partitioning Information page allows you to specify a name and code for the transformation object that will be created together with the partitions. Then click Finish. The table is partitioned, a vertical partitioning object is created, and all references to the original table are created on each partition table. Creating table collapsings Table collapsing consists in merging tables into a single table in order to eliminate joins and to improve query performance. The generated table gathers the columns of the merged tables. All incoming and outgoing references to the input tables are preserved in the resulting table. When the collapsed tables are related by references, the following occurs: The parent column of the join is no longer needed, thus removed The columns of the parent table are duplicated The foreign keys of the children are removed, but their columns are preserved in the resulting table
Example
73
Tables (PDM)
To optimize data retrieval in the database, you collapse both tables into a single table to eliminate the join. The result is a single table (with 2 synonym symbols) with the primary key of the child table:
The Table Collapsing Wizard lets you merge multiple tables into a single table. You can collapse tables related to each other with a reference or tables with identical primary keys.
O To combine multiple tables with the Table Collapsing Wizard 1. Select Tools Denormalization Table Collapsing, or right-click a reference between the tables to collapse and select Table Collapsing from the contextual menu, in order to open the Table Collapsing Wizard:
74
2. Specify a name and code for the target table to be created, and then click Next to go to the Input Table Selection page. 3. The Input Table Selection page allows you to select the tables to collapse with the Add Tables tool. Select the check box if you want to keep the original tables after collapsing, and then click Next to go to the Table Collapsing Information page. 4. The Table Collapsing Information page allows you to specify a name and code for the transformation object that will be created together with the table collapsing. Then click Finish. The selected tables are collapsed, and a table collapsing object is created. Denormalizing columns You can denormalize columns to eliminate frequent joins using column denormalization.
Example
In this example, you want to have the division name printed on the pay slip of each employee, however, you do not want to create a join between those tables. You can denormalize columns in order to have column Div_Name in table PaySlip:
Column denormalization eliminates joins for many queries, however it requires more maintenance and disk space.
Column Denormalization Wizard
The Column Denormalization Wizard lets you duplicate columns in a selected table. The result is a replica of the original column in the target table.
75
Tables (PDM)
For more information about object replicas, see the Shortcuts and Object
Replications chapter in the Core Features Guide . O To denormalize a column with the Column Denormalization Wizard 1. Select Tools Denormalization Column Denormalization, or right-click a table and select Column Denormalization from the contextual menu, in order to open the Column Denormalization Wizard:
2. Select the table in which you want the denormalized columns to be added, and then click Next to go to the Column Selection page. 3. The Column Selection page allows you to select the columns to replicate. Select one or more columns to replicate, and then click Finish. A replication is created for each selected column. You can display the list of replicas from the menu command Model Replications. Each replica has its own property sheet. For more information about object replicas, see the Shortcuts and Object Replications chapter in the Core Features Guide .
Removing a denormalized column Reverting a denormalized column
You can move and paste a denormalized column into another model or package in the standard way. You can revert a column denormalization by deleting the duplicated column from the target table property sheet. This automatically removes the column replica. Note that you cannot revert a column denormalization by deleting a column replica from the list of replications.
76
Denormalization object properties A denormalization transformation object is automatically created when you partition a table using the Horizontal or Vertical Partitioning Wizard or collapse tables with the Table Collapsing Wizard. To access this object, select Model Transformations to open the List of Transformations, select the appropriate object, and then click the Properties tool. The following properties are available on the General tab:
Property Description
Name
Species the name of the partitioning object. It is recommended to provide a clear name in the Partitioning Wizard Species the code of the partitioning object Species additional information about the partitioning object. [partitionings only] Species the name of the table used to create the table partitions. [horizontal partitionings only] Species the name and code of the columns used as partition criteria [table collapsings only] Species the name of the table resulting from the collapsing of selected tables
Code Comment Partitioned table Discriminant Columns Target table Partitions tab
The Partitions tab is only available for partitionings, and lists the tables associated with the partitioning. The following actions can be performed on this tab: Open the property sheets of the partition tables. Add more partitions and edit the properties of the corresponding tables. Add comments to identify the different partitions Delete partitions and their corresponding tables. When you delete a partition, you are prompted to specify whether you want to delete the corresponding table. You can delete a partition and keep its table, but you cannot delete a table and keep an empty partition
The Partition Columns tab is only available for vertical partitionings, and displays the distribution of columns between the partition tables. You can drag and drop columns to reallocate them between tables. 77
Tables (PDM)
The Source Tables tab is only available for table collapsings, and displays the tables that were collapsed. These tables will no longer exist unless you selected to keep the original tables in the Table Collapsing Wizard.
Example: Intermodel generation and horizontal partitions When you update a PDM generated from another model, any horizontal partitioning is preserved. For example, the Sales CDM contains the entity Customer:
You generate the Sales PDM from the CDM, and the Customer entity is generated to the Customer table:
You partition this table using City as the criterion. The City column is excluded from the partition tables:
You modify the CDM by adding an Activity attribute to the Customer entity, and regenerate the PDM in update mode. The partitions are taken into account in the merge dialog box: The new Activity attributes are selected by default, while the City criteria columns are not selected.
78
Example: Intermodel generation and vertical partitions When you generate in update mode a PDM from a PDM, a CDM or an OOM, vertical partitioning is preserved. For example, you build a CDM to design the project management process, this model contains entity Task:
79
Tables (PDM)
You decide to split the table in two table partitions: one table contains the details about the task, the other table contains the task schedule:
You modify the CDM and regenerate the PDM in update mode. The partitions are taken into account in the merge dialog box as you can see in the following dialog box: CDM changes (creation of the Task_Manager attribute) are selected by default, and column modications related to partition creation are not selected.
80
Removing partitionings and table collapsings You can remove partitionings or table collapsings and either keep or remove the associated tables. O To remove a denormalization and keep the associated tables 1. Select Model Transformations to open the List of Transformations. 2. Select the denormalization object, and then click the Delete tool. The denormalization object (and, for partitionings, its partitions) are deleted, but the corresponding tables are retained, and become independent from each other.
81
Tables (PDM)
O To remove a denormalization as well as the associated tables 1. Select Model Transformations to open the List of Transformations. 2. Select the denormalization object, and then click the Cancel tool.
Cancel Transformation tool
The Cancel Transformation tool is only available if the selected denormalization object is based upon a table generated from another model. You can recover the original table by regenerating it from the source model. The denormalization object (and, for partitionings, its partitions) are deleted, as well as the corresponding tables.
Moving denormalizations
82
In order to use the PowerBuilder extended attributes, you must rst attach the PowerBuilder extended model denition to your PDM: O To attach the PowerBuilder extended model denition 1. In your PDM, select Model Extended Model Denition to open the List of Extended Model Denitions. 2. Click the Import an Extended Model Denition tool to open the Extended Model Denition Selection dialog box. 3. Select PowerBuilder and specify whether you want to share the XEM or copy it to your model. 4. Click OK to attach the XEM and click OK to close the List of Extended Model Denitions and return to your model. The attributes are now available for editing on the PowerBuilder tab of tables and columns.
Generating PowerBuilder extended attributes You can update the PowerBuilder extended attribute system tables by performing a PowerBuilder extended attribute generation. 83
Tables (PDM)
During generation, certain extended attributes may contain variables in their values, which are translated during generation, for example to access object properties. The following object properties are translated during generation:
Object Property
Table Column
This automated process uses the PowerDesigner generation template language (see the Customizing Generation with GTL chapter in Customizing and Extending PowerDesigner ). O To generate PowerBuilder extended attributes 1. Select Tools PowerBuilder Generate Extended Attributes to open the PowerBuilder Extended Attributes Generation dialog box. 2. Click the Connect to a Data Source tool to open the Connect to a Data Source window. 3. Select a machine or le data source and click Connect. The selected data source is displayed in the Data Source box in the upper part of the PowerBuilder Extended Attributes Generation dialog box. 4. Select the tables you want to generate. 5. Click OK to start generation. The Output window displays the generation messages. Reverse engineering PowerBuilder extended attributes The reverse engineering feature reads the PowerBuilder extended attributes contained in a database and writes them into the appropriate tables and columns in a PDM. During reverse engineering, certain reversed extended attributes are compared with the translated default values in the PowerBuilder extended model denition. It these attributes match, the reversed value is replaced by the default value from the extended model denition.
This automated process uses the PowerDesigner generation template language (see the Customizing Generation with GTL chapter in Customizing and Extending PowerDesigner ). O To reverse engineer PowerBuilder extended attributes 1. Select Tools PowerBuilder Reverse Extended Attributes. The PowerBuilder Extended Attributes Reverse Engineering dialog box is displayed. 2. Click the Connect to a Data Source tool to open the Connect to a Data Source dialog box. 3. Select a machine or le data source and click Connect. The selected data source is displayed in the Data Source box in the upper part of the PowerBuilder Extended Attributes Reverse Engineering dialog box. 4. Select the tables you want to reverse engineer. 5. Click OK to start reverse engineering. The Output window displays the reverse engineering messages.
85
Columns (PDM)
Columns (PDM)
A column contains an individual data item within a row. It is the model equivalent of a database column. A column is always dened for a table. When you create a column, it must be assigned a name and code. You can also select a data type for the column. This can be done directly from a list of available data types, or by attaching the column to a domain.
Creating a column
You can create a column in any of the following ways: Open the Columns tab in the property sheet of a table, and click the Add a Row tool Right-click a table in the Browser, and select New Column
For general information about creating objects, see the Objects chapter
in the Core Features Guide .
Column properties
You can modify an objects properties from its property sheet. To open a column property sheet, double-click its row in the Columns tab of a table or its Browser entry. The following sections detail the property sheet tabs that contain the properties most commonly entered for columns. The General tab contains the following properties:
Property Description
Name
Species the name of the item, which should be clear and meaningful, and should convey the items purpose to nontechnical users Species the technical name of the object, which is used for generating code or scripts, which may be abbreviated, and should not generally include spaces Species a descriptive label for the column Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or userdened Species the table which contains column Species the form of the data corresponding to the column, such as numeric, alphanumeric, boolean, or others
Code
Comment Stereotype
86
Property
Description
When selected, allows the display of the selected column in the table symbol Species the maximum length of the data type Species the maximum number of places after the decimal point When selected, indicates that the data is auto-incremented (not available for all DBMS) Species the name of the associated domain. You can use the tools to the right of the list to create an object, browse the complete tree of available objects or view the properties of the currently selected object When selected, designates that the column is computed from an expression using values from other columns in the table (not available for all DBMS) When selected, designates a column whose values uniquely identify a row in the table When selected, designates a column that depends on and migrates from a primary key column in another table When selected, indicates a column that must be assigned a not null value When selected, indicates if a default value is assigned to the column when a Null value is inserted (not available for all DBMS)
Computed
Column property sheet Detail tab The Detail tab contains the following properties:
Property Description
Null Values
Species the number (or percentage) of column entries which contain null values. You can enter a number or percentage in this eld or derive its value from database statistics (see Updating Column Statistics on page 88).
87
Columns (PDM)
Property
Description
Distinct Values
Species the number (or percentage) of column entries which contain distinct values. You can enter a number or percentage in this eld or derive its value from database statistics (see Updating Column Statistics on page 88). For example, you generate a table with 2 columns and 10 rows. You set the percentage of distinct values to 100 % for Column 1 and to 80% for Column 2. This implies that 10 rows will have distinct values in Column 1, and 8 rows in Column 2. When you apply a test data prole with a list generation source to a column with a given percentage of distinct values, PowerDesigner uses the values from the test data prole list. If there are not enough values declared in the list, a warning message is displayed in the Output window to inform you that the distinct value parameter cannot be enforced due to lack of distinct values in the list of values.
Species the average length of a value. You can enter a number in this eld or derive its value from database statistics (see Updating Column Statistics on page 88). Test data prole selected from the list. Proles can use characters, numbers or date/time data types.
Computed Expression
For more information, see Using test data section in the Generating a Database from a PDM chapter. Computed expression typed directly in the Computed Expression pane or dened with the SQL Editor (accessed with the Edit tool) which helps you dene more complex expressions.
can also update the statistics for all tables by selecting Tools Update Statistics (see Reverse Engineering Database Statistics in the Reverse Engineering a Database into a PDM chapter).
Assume that you want to automatically ll a column with the total sales of widgets. To do this, you can create a computed column that will use the number of widgets multiplied by the widget price:
Column name Contents Action on data
Number of widgets sold Price of widgets when sold Total widget sales
While our example is very simple, the SQL Editor allows you to dene very complex computed column expressions.
For more information on the SQL Editor, see Using SQL tools in the
Working with Data Models chapter. O To create a computed column 1. Double-click a table to open its property sheet, and click the Columns tab. 2. Click the Add a Row tool, and then click the Properties tool to open the property sheet for the new column. 3. On the General tab, select the Computed checkbox, and then click the Detail tab. 4. Enter an expression in the Computed Expression box to dene the computed column. Alternatively,you can click the Edit with SQL Editor tool to use the SQL Editor.
89
Columns (PDM)
In our example, we use the asterisk (*) as an arithmetic operator to multiply the number of widgets by their price. 5. Click OK to return to the column property sheet. The expression is displayed in the Computed Expression pane. 6. Click OK in each of the dialog boxes.
Check parameters indicate data ranges and validation rules. You can set check parameters for domains, tables, and columns. O To select a data type for a column 1. Double-click a table to open its property sheet, and click the Columns tab. 2. Click the required column entry and then click the Properties tool to open its property sheet.
90
3. Select a data type from the Data Type list or click the Question mark button to open and choose a data type from the Standard Data Types dialog box. 4. If required, enter a data type length and precision.
Undened data type
If you do not want to select a data type immediately, you can choose the <undened> data type. When you generate the database, this data type is replaced by the default data type for your database, as dened in the DBMS. 5. Click OK in each of the dialog boxes.
Columns (PDM)
3. Select a domain from the Domain list and then click OK.
92
O To copy a column to another table 1. Double-click a table to open its property sheet, and click the Columns tab. 2. Click the Add Columns tool to open a selection box listing the columns attached to all other tables in the model.
3. Select one or more columns in the list and then click OK. The copied columns appear in the list of columns for the current table. 4. Click OK.
93
Columns (PDM)
You can always return to the default constraint name by clicking the User-Dened button. 3. Click OK in each of the dialog boxes.
For example, when you click the title bar Name, the columns are listed by column name alphabetically when the down arrow is indicated, and in reverse order when the up arrow is indicated. O To congure the display of the list of columns 1. Select Model Columns to open the List of Columns. 2. Click a property title bar to sort the list by the indicated property. 3. Click OK.
94
Keys (PDM)
A key is a column, or a combination of columns, that uniquely identies a row in a table. Each key can generate a unique index or a unique constraint in a target database. The physical diagram supports the following types of keys: Primary - Column or combination of columns whose values uniquely identify every row in a table. A table can have only one primary key Alternate - Column or combination of columns (not the same column or combination of columns as for a primary key) whose values uniquely identify every row in a table Foreign - Column or combination of columns whose values are required to match a primary key, or alternate key, in some other table
Example
The TITLE table shown below has a primary, alternate and foreign key:
TITLE_ID is the primary key and consists of the column TITLE ISBN which identies each book title in the table TITLE_NAME is an alternate key containing the columns TITLE NAME and TITLE TYPE. It allows each title to be identied by its name and type, The fact that it is an alternate key indicates that there is a constraint that no two titles of the same type can have the same name The TITLE table also contains the foreign key column PUBLISHER ID. This column references the primary key column in the Publisher table.
Creating a Key
The method for creating a key depends on the type of key. See the appropriate section: Primary keys on page 96 Alternate keys on page 98 Foreign keys on page 99
95
Keys (PDM)
Key properties
You can modify an objects properties from its property sheet. To open a key property sheet, go to the Keys tab of its parent table, or double-click its Browser entry. The General tab contains the following properties:
Property Description
Name
Species the name of the item, which should be clear and meaningful, and should convey the items purpose to non-technical users Species the technical name of the object, which is used for generating code or scripts, which may be abbreviated, and should not generally include spaces Species the descriptive comment for the key Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or user-dened Species the name of the table where the key is dened Species the name of the key constraint. PowerDesigner automatically creates a constraint name for a key, it is used during database creation and modication. You can modify the default name, you can also cancel these changes and go back to the default name Indicates if the key is the primary key of the current table. There must be only one primary key in a table, if you select the Primary Key check box in a key property sheet, it replaces an already existing primary key Indicates whether the key constraint is a clustered constraint (for those DBMS that support clustered indexes)
Code
Comment Stereotype
Primary key
Cluster
Primary keys
A primary key is the primary identier for a table, and is attached to one or more columns whose values uniquely identify every row in the table. Every table must have a primary key, composed of one or more of its columns. 96
Example
Employee number is the primary key for the table Employee. This means that each employee must have one unique employee number.
You can dene one or more columns as the primary key of a table from the list of columns. O To designate a primary key 1. Double-click a table in the diagram to open its property sheet. 2. Click the Columns tab, and select the check box in the P column for one or more columns in the list. 3. [optional] Click the Keys tab and rename the key or select it and click the Properties tool to access its property sheet. 4. Click OK. Rebuilding primary keys Rebuilding primary keys in a physical diagram updates primary keys for tables. Rebuilding primary keys is useful following the reverse engineering of a database in which all of the primary keys could not be reverse engineered, or if you did not select the rebuild option for primary keys when you reverse engineered the database. The rebuild option for primary keys creates primary keys for tables that have no key and a single unique index. You can choose to rebuild all primary keys in your model, or select the tables for which you want to rebuild the primary keys.
97
Keys (PDM)
O To rebuild primary keys 1. Select Tools Rebuild Objects Rebuild Primary Keys to open the Rebuild Primary Keys dialog box, which lists all the tables in the current model.
To rebuild the primary keys in package, select the package from the list at the top of the tab. To rebuild the primary keys in a sub-package, select the Include SubPackages icon next to the list, and then select a sub-package from the dropdown list. 2. Select the tables containing the primary keys that you want to rebuild.
Selecting or clearing all check boxes
You can select all check boxes, or clear all check boxes, by selecting the Select All tool, or Clear All tool, from the toolbar at the top of the tab. 3. Click OK.
Alternate keys
An alternate key is a key attached to one or more columns whose values uniquely identify every row in the table, but which is not a primary key. An alternate key can also be a foreign key. Each alternate key can generate a unique index or a unique constraint in a target database. 98
You can also select one or several columns and use the Create Key tool in the Columns tab of the table property sheet. O To designate an alternate key 1. Double-click a table in the diagram to open its property sheet. 2. Click the Keys tab, which lists all the keys dened for the table. 3. Click the Add a Row tool, and type a name for the newly created key.
Alternate key naming convention
The naming convention for an alternate key is AK followed by the number of the key column code; for example AK1_CUSNAME. 4. [optional] Type a constraint name in the Constraint Name column.If you do not specify a constraint name, PowerDesigner creates a default constraint name automatically.
Displaying additional property columns
If you do not see the Constraint Name column, display it with the Customize Columns and Filter tool. For more information, see Customizing object list columns and ltering lists section in the Objets chapter of the Core Features Guide . 5. Click the property tool and conrm the object creation in order to open the property sheet for the new key. 6. Click the columns tab, which lists all the columns to which the key is attached. At key creation, the list is empty. 7. Click the Add Columns tool to open a selection box listing all the columns in the table (except those attached to the primary key). 8. Select one or more columns and click OK in each of the dialog boxes.
Foreign keys
A foreign key is a primary key, or an alternate key, that migrates from another table. Depending on selected model options, a primary key can be automatically migrated to a child table as a foreign key at reference creation. The columns that are dened in a foreign key can also be user-specied at creation and changed at any time from the Joins tab of the reference property sheet.
Keys (PDM)
%TABLE%
For a full list of all variables that you can use in PowerDesigner, see the
appendix Variables in PowerDesigner. O To name a primary key constraint 1. Double-click a table in the diagram to open its property sheet. 2. Click the Keys tab, select the primary key, and click the Properties tool to open its property sheet.
100
3. Enter the required name in the Constraint Name box. The User-Dened button to the right of the Constraint box is pressed automatically. You can return to the default constraint name by re-clicking the User-Dened button. 4. Click OK in each of the dialog boxes. Naming an alternate key constraint You can use the following variable in the name of a alternate key constraint:
Variable Description
Code of the alternate key Name of the alternate key Code of the table
For a full list of all variables that you can use in PowerDesigner, see the
appendix Variables in PowerDesigner. O To name an alternate key constraint 1. Double-click a table in the diagram to open its property sheet. 2. Click the Keys tab, select an alternate key, and click the Properties tool to open its property sheet. 3. Enter the required name in the Constraint Name box. The User-Dened button to the right of the Constraint box is pressed automatically. You can return to the default constraint name by re-clicking the User-Dened button. 4. Click OK in each of the dialog boxes. Naming a foreign key constraint You can use the following variable in the name of a foreign key constraint:
101
Keys (PDM)
Variable
Description
Name of the reference Code of the reference Code of the parent table Code of the child table
For a full list of all variables that you can use in PowerDesigner, see the
appendix Variables in PowerDesigner. O To name a foreign key constraint 1. Double-click a reference in the diagram to open its property sheet. 2. Click the Integrity tab and enter the required name in the Constraint Name box. The User-Dened button to the right of the Constraint box is pressed automatically. You can return to the default constraint name by re-clicking the User-Dened button. 3. Click OK in each of the dialog boxes.
102
Indexes (PDM)
An index is a data structure associated with a table that is logically ordered by the values of a key. It improves database performance and access speed. You normally create indexes for columns that you access regularly, and where response time is important. Indexes are most effective when they are used on columns that contain mostly unique values.
Example
In a table called Author, you create indexes for the primary key Author ID and the column Author name, but not for the column City. The values for city, are not likely to be unique, nor searched regularly, and do not help reduce query time.
Creating an index
You can create the following types of index: A user-dened index - Associated with one or more columns An index linked to a key - Automatically updated when the key column or columns are modied. An index linked to a key is unique because it uses the same unique set of columns as the key. A function-based index - [if supported by the DBMS] Precomputes the value of a function or expression based on one or more columns and stores it in the index. The function or the expression will replace the index column in the index denition. Function-based indexes provide an efcient mechanism for evaluating statements that contain functions in their WHERE clauses.
Index naming conventions
Table code followed by PK; for example EMPLOYEE _PK Table code followed by FK; for example PROJECT _ FK Table code followed by AK; for example EMPLOYEE _ AK
A table contains a compound primary key. This is a primary key designated to more than one column in a table. You create an index and link it to the primary key. If one of the primary key columns is deleted, the corresponding index associated with the column is also deleted.
103
Indexes (PDM)
O To create an index 1. Double-click a table symbol to display its property sheet and click the Indexes tab. 2. Click the Add a Row tool and enter an index name and an index code.
3. Click the Properties tool to open the property sheet of the new index. 4. Type or select any appropriate index properties, and then click the Columns tab. 5. To create a user dened index: click the Add Columns tool, select one or more columns from the list, and then click OK
To create an index linked to a key:
select the primary key, an alternate key, or foreign key from the Columns denition list
To create a function-based index [if supported by the DBMS]: click the Add a Row tool, then click in the Expression column and select the ellipsis button to open the SQL Editor. Enter an expression in the editor and then click OK
104
6. Select Ascending or Descending in the Sort column. 7. Click OK in each of the dialog boxes.
Reverse engineering function-based index
An index column with an expression has a LONG data type that cannot be concatenated in a string statement during reverse engineering. The only way to bypass this limitation and concatenate this value is to use variables in the query executed to retrieve the adequate information. In the Oracle 8i and Oracle 8i2 DBMS, the query SqlListQuery dened in the Index category contains the following variable used to recover the index expression in a column with the LONG data type.
%SqlExpression.Xpr||i.table_name||i.index_name||c.column_ position||%
Function-based indexes dened on UPPER(column_name) or LOWER(column_name) can facilitate case-insensitive searches. You want to dene an index that will put all names in lowercase on the table EMPLOYEE in order to ease search. You can dene the following index
105
Indexes (PDM)
Then the DBMS can use it when processing queries such as:
SELECT * FROM EMPLOYEE WHERE LOWER(EMPLNAM)="brown"
For general information about creating objects, see the Objects chapter
in the Core Features Guide .
Index properties
You can modify an objects properties from its property sheet. To open an index property sheet, double-click its diagram symbol or its Browser entry. The following sections detail the property sheet tabs that contain the properties most commonly entered for indexes. The General tab contains the following properties:
Property Description
Name
Species the name of the item, which should be clear and meaningful, and should convey the items purpose to nontechnical users Species the technical name of the object, which is used for generating code or scripts, which may be abbreviated, and should not generally include spaces Species a descriptive label for the index Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or userdened Species the name of index owner. You choose an owner from a list of users, the index and table owners can be identical or different. An index can only have one owner at a time. This is normally the index creator. Some DBMS allow you to dene an index owner, either identical or different from the table owner. If the DBMS of the current model does not support index owners, the table owner will be automatically assigned to the index after switching to a DBMS that supports index owners.
Code
Comment Stereotype
Owner
Table
106
Property
Description
Type
[Sybase IQ, and Oracle only] Species the type of index. You can choose between: Bitmap [Oracle] In a bitmap index, a bitmap for each key value is used instead of a list of row Ids HG [Sybase IQ] HighGroup indexes are used for GROUP BY, COUNT(DISTINCT) and SELECT DISTINCT statements when data has more than 1000 unique values HNG [Sybase IQ] HighNonGroup indexes make equality comparisons, SUM and AVG calculations very fast when data has more than 1000 unique values. Nonequality comparisons can also be done LF [Sybase IQ] LowFast indexes are used for columns that have a very low number of unique values. This index also facilitates join index processing. It is one of the two indexes allowed for columns used in join relationships CMP [Sybase IQ] Compare indexes are used for columns that store the binary comparison (<, >, or =) of any two distinct columns with identical data types, precision, and scale WD [Sybase IQ] Is used to index keywords by treating the contents of a CHAR or VARCHAR column as a delimited list
Unique Cluster
Species whether an index is a unique index Species that the index is a clustered index. A table cannot have more than one clustered index. Note that clusters in Oracle 11 and higher are modeled as extended objects with a <<Cluster>> stereotype. For more information, see the DBMS-Specic Features chapter.
The following tabs are also available: Columns - lists the columns with which the index is associated (see Creating an index on page 103).
Rebuilding indexes
Rebuilding indexes in a physical diagram automatically updates any changes that you have made to primary keys, foreign keys, or alternate keys in your
107
Indexes (PDM)
model. O To rebuild indexes 1. Select Tools Rebuild Objects Rebuild Indexes to open the Rebuild Indexes dialog box.
2. Set the appropriate options. 3. [optional] Click the Selection tab to specify which tables you want to rebuild indexes for. 4. Click OK. If you selected the Delete and Rebuild mode, a conrmation box asks you to conrm your choice. Click Yes to conrm the deletion and rebuild of the selected references.
Rebuilding index options
Primary key
Rebuilds primary key indexes. The text box shows the naming convention for primary keys. By default this is %TABLE%_PK Rebuilds alternate key indexes. The text box shows the naming convention for alternate keys. By default this is %AKEY%_AK Rebuilds foreign key indexes. The text box shows the naming convention for foreign keys. By default this is %REFR%_FK
Other keys
108
Option
Description
Species the minimum number of estimated records in a table that are necessary before a foreign key index can be created. The estimated number of records is dened in the Number box in the table property sheet. If the table has no specied number of occurrences, the foreign key indexes are generated by default Species the extent of the rebuild. You can select: Delete and Rebuild deletes and rebuilds all indexes presently attached to primary, alternate, and foreign keys Add missing indexes preserves all indexes presently attached to primary, alternate, and foreign keys and adds any that are missing
Mode
You can use the following variables in the PK index names elds:
Variable Value
%TABLE%
Generated code of the table. This is the table code generated in the database. It may be truncated if the code contains characters not supported by the DBMS Table name Table code Table comment
You can use the following variables in the FK index name eld. The generated code of a variable is the code dened in the object property sheet, it may be truncated when generated if the code contains characters not supported by the DBMS
Variable Value
Generated code of the reference Generated code of the parent table Parent table name Parent table code Generated code of the child Child table name
109
Indexes (PDM)
Variable
Value
Child table code Parent table qualier Child table qualier Reference name Reference code
110
Defaults (PDM)
A default is a value that can be assigned to a column or a domain in the DBMS of the Sybase Adaptive Server Enterprise and Microsoft SQL Server families. You select a default from the Default list in the Check Parameters tab of a column or domain property sheet.
Example
The default object citydt is used to assign the same default value to all columns of type city.
Creating a default
You can create a default in any of the following ways: Select Model Defaults to access the List of Defaults, and click the Add a Row tool. Right-click the model or package in the Browser, and select New Default.
For general information about creating objects, see the Objects chapter
in the Core Features Guide .
Default properties
You can modify an objects properties from its property sheet. To open a default property sheet, double-click its diagram symbol or its Browser entry in the Defaults folder. The following sections detail the property sheet tabs that contain the properties most commonly entered for defaults. The General tab contains the following properties:
111
Defaults (PDM)
Property
Description
Name
Species the name of the item, which should be clear and meaningful, and should convey the items purpose to nontechnical users Species the technical name of the object, which is used for generating code or scripts, which may be abbreviated, and should not generally include spaces Species the descriptive label Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or userdened Species the name of default owner. You choose an owner from a list of users Species the value of default object that will be generated
Code
Comment Stereotype
Owner Value
Default property sheet Preview tab You can view the default creation order in the Preview tab of the default property sheet.
create default CITYDFLT as Dublin
2. Select a default in the Default list in the Value groupbox. Alternatively, you can type a default value in the listbox; this does not create a default object in the model, it only assigns a default value for the current column or domain. If you type a name that already exists in the list, the default object is attached to the column or domain. 3. Click OK in each of the dialog boxes.
Rebuilding defaults
You can generate defaults from domains and columns having default values. The Default Rebuild feature uses the default values to create default objects and attaches them to the appropriate domains and/or columns.
Upgrading models
When you open a model containing domains with default values and saved in a previous version of PowerDesigner, default objects corresponding to the default values are created in the model. Default objects are also created when you change the DBMS of a model containing domains with default values, to a DBMS that supports default objects. The opposite process occurs when you switch to a DBMS that does not support default objects: default objects are converted into default values.
Default name template
You can dene a template for the generated default names. This template has the D_%.U:VALUE% value and supports the following variables: DOMAIN for the code of the domain using the default COLUMN for the code of the column using the default TABLE for the code of the table that contains the column with a default You can dene one template for domain defaults and one for column defaults. O To rebuild defaults 1. Select Tools Rebuild Objects Rebuild Defaults to open the Default Rebuild dialog box. 2. Specify a default name template in the Domain and Column boxes. 3. [optional] Select the Reuse default with identical value check box this option will reuse default objects with identical value among columns and domains. If you do not select this option, rebuild creates one default per object.
113
Defaults (PDM)
4. [optional] Select the Delete and rebuild check box this option detaches the default objects attached to selected objects and deletes them if they are not used. If you select all objects, this option allows you to clean up the model from all existing defaults and recreate new default objects. 5. [optional] Click the Selection tab to specify domains and tables for default generation. 6. Click OK. The defaults are automatically created and attached to the domains and/or columns.
114
Domains (CDM/LDM/PDM)
Domains help you identify the types of information in your model. They dene the set of values for which a column/entity attribute is valid. Applying domains to columns/entity attributes makes it easier to standardize data characteristics for columns/entity attributes in different tables/entities. In a diagram, you can associate the following information with a domain: Data type, length, and precision Check parameters Business rules Mandatory property
Creating a domain
You can create a domain as follows: Select Model Domains to access the List of Domains, and click the Add a Row tool Right-click the model or package in the Browser, and select New Domain
For general information about creating objects, see the Objects chapter
in the Core Features Guide .
Domain properties
You can modify an objects properties from its property sheet. To open a domain property sheet, double-click its Browser entry in the Domains folder. The General tab contains the following properties:
Property Description
Name
Species the name of the item, which should be clear and meaningful, and should convey the items purpose to nontechnical users Species the technical name of the object, which is used for generating code or scripts, which may be abbreviated, and should not generally include spaces Species a descriptive label for the domain
Code
Comment
115
Domains (CDM/LDM/PDM)
Property
Description
Stereotype
Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or userdened [PDM only] Species the name of domain owner. You choose an owner from a list of users. A domain can only have one owner at a time. This is normally the domain creator Species the form of the data corresponding to the domain, such as numeric, alphanumeric, Boolean, or others. The <undened> data type indicates a domain without a data type. If an <undened> data type is present when you generate your database, it is replaced by the default data type for your database [where appropriate] Species the maximum number of characters. In the PhysDataType list of available data types (select Database Edit current database Script DataType PhysDataType), a variable indicates where you have to type a length or precision, as follows: %n - length %s - length with precision %p - decimal precision For example, if you are using Sybase Adaptive Server Anywhere and you choose the data type char(%n), you can choose a length of ten by typing char(10).
Owner
Data type
Length
[where appropriate] Species the number of places after the decimal point, for data values that can take a decimal point Species that domain values are mandatory for all columns/entity attributes using that domain (For Adaptive Server Enterprise, MS SQL Server and those DBMS that support it). When selected, indicates that the data is auto-incremented for columns using that domain [PDM only] (For those DBMS that support it). When selected, indicates if a default value is assigned to a column using the domain, when a Null value is inserted [PDM only] Species the test Data prole assigned to the domain
With default
Prole
116
The following tabs are also available: Standard Checks - contains checks which control the values permitted for the column/entity attribute (see Check Parameters (CDM/LDM/PDM) on page 174) Additional Checks - allows you to specify additional constraints (not dened by standard check parameters) for the column/entity attribute. Rules - lists the business rules associated with the column/entity attribute (see Business Rules (CDM/LDM/PDM) on page 179).
117
Domains (CDM/LDM/PDM)
Content
Length
Long Integer Byte Number Decimal Float Short Float Long Float Money Serial Boolean
int / INTEGER tinyint / SMALLINT numeric / NUMBER decimal / NUMBER oat / FLOAT real / FLOAT double precision / BINARY DOUBLE money / NUMBER numeric / NUMBER bit / SMALLINT
32-bit integer 256 values Numbers with a xed decimal point Numbers with a xed decimal point 32-bit oating point numbers Less than 32-bit point decimal number 64-bit oating point numbers Numbers with a xed decimal point Automatically incremented numbers Two opposing values (true/false; yes/no; 1/0)
118
Content
Length
Characters Variable Characters Long Characters Long Var Characters Text Multibyte Variable Multibyte Time data types
char / CHAR varchar / VARCHAR2 varchar / CLOB text / CLOB text / CLOB nchar / NCHAR nvarchar / NVARCHAR2
Character strings Character strings Character strings Character strings Character strings Multibyte character strings Multibyte character strings
Day, month, year Hour, minute, and second Date and time System date and time
119
Domains (CDM/LDM/PDM)
Content
Length
binary / RAW image / BLOB image / BLOB image / BLOB image / BLOB undened
Binary strings Binary strings Images in bitmap format (BMP) Images OLE links User-dened data type Undened. Replaced by the default data type at generation.
120
The Data Type check box is selected or not according to the options set to enforce non-divergence from a domain (see Enforcing non-divergence from a domain in a data model on page 121). 3. Select any other properties that you want to update (Check, Rules, Mandatory, Prole) for all columns/entity attributes using the domain. 4. Click one of the following buttons: Yes - The columns/entity attributes currently using the domain are modied according to the update No - The columns/entity attributes currently using the domain are not modied according to the update but the current modication is accepted if domain divergence is allowed in the model options (see Enforcing non-divergence from a domain in a data model on page 121). Cancel - The update is cancelled and nothing is changed
121
Domains (CDM/LDM/PDM)
O To enforce domain non-divergence in a data model 1. Select Tools Model Options to open the Model Options dialog box. In a PDM, you have to click the Column and Domain sub-category in the left-hand Category pane to display the Enforce non-divergence option:
2. Select the check boxes of the column/entity attribute properties that are not permitted to diverge from the domain denition. You can specify any or all of: Data type - data type, length, and precision Check - check parameters such as minimum and maximum values Rules business rules Mandatory mandatory property of the column [PDM only] Prole - test data prole If you subsequently modify in your domain any of the properties specied as non-divergent here, then the corresponding properties of the columns/entity attributes attached to that domain are automatically updated. Column/entity attribute properties specied as non-divergent appear dimmed and are non-editable in the List of Columns/Entity attributes and Column/Entity attribute property sheets. If you want to modify a non-divergent column/entity attribute property, you must detach the column/entity attribute from its domain. 3. Click OK to close the Model Options dialog box. 122
4. When you set the Enforce non-divergence options, you are asked if you want to apply domain properties to columns/entity attributes currently attached to the domain. If you click OK, the column/entity attribute properties are modied in order to be consistent with the properties of the domain to which they belong.
123
Sequences (PDM)
Sequences (PDM)
If your DBMS supports sequences, then you can create a sequence for a column. A sequence is like an advanced form of an auto-incremented column. Where the latter is a column whose values automatically increment by 1, sequences allow you to dene a more complex list of numbers. For example, you could dene a list of numbers ranging between two values with an increment by any number (integer) you want. Once you dene a sequence, you can apply and enable it to a column. The data type for the column receiving the sequence must be a numeric data type. Such auto-incremented columns can be used in a key for a PDM table.
For more information on data types, see Selecting a data type for a
column on page 90.
Example
Assume that you want to create a column listing the months of the year when quarterly reports are published: March, June, September, and December. The rst report is published on the third month, the second on the sixth, the third on the ninth and the last on the twelfth. You can dene the proper sequence by typing the following values for sequence option parameters:
Parameter name Description Value
March is the third month of the year Look three months ahead to identify the next month in the list Stop when you have reached the last month of the year
3 3 12
The sequence created with these parameter settings allows you to automatically create the list of months in a year when quarterly reports are published.
Creating a Sequence
There are two steps to using sequences: Create a sequence (including dening sequence options) Apply and enable a sequence to a column
124
O To create a sequence 1. Select Model Sequences to open the List of Sequences. 2. Click the Add a Row tool and type a name for the new sequence. 3. Double-click the arrow to the left of the new sequence to display its property sheet. 4. Click the Physical Options tab and enter any appropriate parameters. These options are DBMS-specic. For more information on using this tab, see Physical Options on page 188.
The above example shows the options and values to create a sequence of months in a year when quarterly reports are published. 5. [optional] Click the Apply To button to open a selection list and specify other sequences to which these same options will apply.
125
Sequences (PDM)
6. Click OK in each of the dialog boxes. O To apply and enable a sequence on a column 1. Open the property sheet of the column to which you want to apply the sequence. 2. On the General tab, select a sequence from the Sequence list. 3. Click OK to close the property sheet. 4. Select Tools Rebuild Objects Rebuild Triggers to open the Rebuild Triggers dialog box. 5. Click the Selection tab and select the table or tables containing the column to which you want to attach a sequence. 6. Click OK. The triggers are rebuilt and the sequence is enabled on the column.
Sequence properties
You can modify an objects properties from its property sheet. To open a sequence property sheet, double-click its Browser entry in the Sequences folder or its line in the List of Sequences. The following sections detail the property sheet tabs that contain the properties most commonly entered for sequences. 126
Name
Species the name of the item, which should be clear and meaningful, and should convey the items purpose to nontechnical users Species the technical name of the object, which is used for generating code or scripts, which may be abbreviated, and should not generally include spaces Species a descriptive label for the sequence Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or userdened Species the name of sequence owner. You choose an owner from a list of users. A column can only have one owner at a time. This is normally the column creator
Code
Comment Stereotype
Owner
The following tabs are also available: Physical Options - lists the physical options associated with the sequence (see Physical Options on page 188). For information about these options, see your DBMS documentation.
Changing the DBMS of a model which contains sequences and auto-incremented columns
If you create a sequence attached to a column in a DBMS supporting sequences, such as Oracle 8 and higher, Interbase or PostgreSQL, or create an auto-incremented column in a DBMS supporting this feature, and then decide to change the target DBMS, the following effects occur:
127
Sequences (PDM)
DBMS change
DBMS supporting sequences to a DBMS supporting auto-incremented columns DBMS supporting auto-incremented columns to a DBMS supporting sequences
The sequence disappears and the column to which it was attached becomes an auto-incremented column in the DBMS The auto-incremented column is deleted and replaced by a sequence object called S_TABLENAME which is attached to the original column
Autoincremented column
CDM
A serial data type for an entity property. The data type has the format NO%n where %n is a number indicating the length of the data type A serial data type for a class attribute. The data type has the format NO%n, where %n is a number indicating the length of the data type
OOM
128
Created
You can create an abstract data type of any kind supported by your DBMS. If you create an abstract data type of type JAVA, you can link it to a Java class in an OOM to access the Java class properties (see Linking an abstract data type to a Java class on page 133).
Reverse engineered
An abstract data type in a database can be reverse engineered into a PDM. If you also reverse engineer the JAVA classes into an OOM, then the abstract data types of the type JAVA in the PDM are automatically linked to the Java classes in the OOM (see Reverse-engineering a PDM linked to an OOM on page 137)
129
Type
Description
Example
Fixed length collection of elements Unxed length collection of objects Java class
VARRAY (Oracle 8 and higher) TABLE (Oracle 8 and higher) JAVA (Adaptive Server Anywhere, and Adaptive Server Enterprise) OBJECT (Oracle 8 and higher)
Object
Contains a list of attributes and a list of procedures Contains a list of attributes and a list of procedures Contains a list of attributes
SQLJ Object
SQLJ OBJECT (Oracle 9i and higher) NAMED ROW TYPE (Informix 9.x, and IBM DB2 5.2)
Structured Example
An abstract data type for the Gregorian calendar which has functions dened to do the following: Read and write roman numerals Convert dates from the Julian calendar to the Gregorian calendar Convert dates from the Gregorian calendar to the Julian calendar
See also Creating object and SQLJ object abstract data types on page 132. For general information about creating objects, see the Objects chapter
in the Core Features Guide .
abstract data type property sheet, double-click its Browser entry in the Abstract Data Types folder. The General tab contains the following properties:
Property Description
Name
Species the name of the item, which should be clear and meaningful, and should convey the items purpose to nontechnical users Species the technical name of the object, which is used for generating code or scripts, which may be abbreviated, and should not generally include spaces Species the descriptive label Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or userdened Species the name of abstract data type owner. You choose an owner from a list of users Species the dening group that includes the abstract data type
Code
Comment Stereotype
Owner Type
Depending on its type, an abstract data type denition can also include the following properties: Data type, Length, and Precision Size (for arrays) Linked class name (for Java types) File name and path, which contains the declaration of the class Authorization (for objects): Invoker Right attribute used for DDL generation Supertype (for objects): Parent abstract data type from which the current abstract data type can inherit the procedures Final and Abstract (for objects): When Final is checked, the current abstract data type cannot be used as supertype by another abstract data type. When Abstract is checked, the current abstract data type cannot be instantiated. Final and Abstract are mutually exclusive Java class (for SQLJ objects): Name of an external Java class to which the SQLJ object points. Beside the Java class box, there is a list to select a mapping interface (CustomDatum, OraData or SQLData) 131
An object abstract data type with a supertype can inherit non-nal procedures. You can use the Inherit Procedure tool in the Procedures tab of the abstract data type to select a non-nal procedure from a parent abstract data type. Inheritance only applies to non-nale procedures. For example, you want to create an Address object with Street, City, and ZipCode attributes, and a Location procedure. O To specify attributes and procedures for an object (or SQLJ object) abstract data type 1. Open the property sheet of the abstract data type and select either OBJECT or SQLJ_OBJECT from the type list. The Attributes and Procedures tabs are displayed. 2. Click the Attributes tab.
Object example
132
3. For each attribute, click the Add a Row tool, and: enter a Name and Code select a data type class from the Data Type list [optional] Select the Mandatory (M) checkbox 4. Click the Procedures tab:
5. For each procedure, click the Add a Row tool, and: enter a Name and Code [optional] Select the Final (F), Static (S) and/or Abstract (A) columns 6. Click OK in each of the dialog boxes.
133
O To link an abstract data type to a Java class 1. Create an abstract data type and select Java from the Type list on the General tab of its property sheet.
2. Click the Ellipsis button to the right of the Class box to open a Java class selection box, which lists all the Java classes that are available in the OOMs currently open in the Workspace.
134
3. Select a Java class and click OK. The abstract data type is now linked to the Java class, and the class name is displayed in the Class box. 4. Click the Properties button at the end of the Class box to open the property sheet of the Java class. If the related OOM is closed, then a shortcut property sheet for the Java class is displayed, and you must click the Properties button to the right of the Name box to display its actual property sheet..
135
If the related OOM is open, then the class property sheet is opened directly:
Reverse-engineering a PDM linked to an OOM You can reverse engineer a PDM from a database that contains Java classes and also reverse the Java classes into an OOM. The Java abstract data types in the PDM are automatically linked to the Java classes in the OOM as follows: You should reverse engineer the Java classes in the database that are used as data types for the columns and domains in an OOM Then reverse engineer the database into a PDM PowerDesigner automatically searches the open OOM for the Java classes that correspond to the JAVA abstract data types in the PDM and makes the corresponding links The Java classes that are reverse engineered into the PDM are created automatically as abstract data types of type JAVA. You can access the properties of these Java classes from the property sheets of the corresponding abstract data types in the PDM. For more information, see Linking an abstract data type to a Java class on page 133.
137
References (PDM)
References (PDM)
A reference is a link between a parent table and a child table. It denes a referential integrity constraint between column pairs for a primary key, or alternate key, and a foreign key, or between user specied columns in both tables. When column pairs are linked by a reference, each value in the child table column refers to an equivalent value in the parent table column. Within a reference, each column pair is linked by a join. Depending on the number of columns in the primary key, or alternate key, or the number of specied columns, a reference can contain one or more joins. A reference normally links primary key, or alternate key, columns to foreign key columns.
Example
The two tables SALE and STORE are linked by a reference. STORE is the parent table and SALE is the child table. The reference contains a join which links the primary key column STORE ID (the referenced column) to the foreign key column STORE ID (the referencing column).
Creating a reference
You can create a reference that links a primary key, or alternate key, to a foreign key, or user-specied columns in both parent and child tables. Depending on its properties, a reference can link a parent table and a child table in one of two ways:
Reference links Description
Primary key, alternate key and foreign keys User specied columns
Primary or alternate key in the parent table is linked to a foreign key in the child table One or more columns in the parent table are linked to corresponding columns in the child table. The linked columns in both tables are specied by the user, and are linked independently of primary key, alternate key, and foreign key columns
138
You can create a reference in any of the following ways: Use the Reference tool in the diagram Palette. Select Model References to access the List of References, and click the Add a Row tool. Right-click the model or package in the Browser, and select New Reference.
For general information about creating objects, see the Objects chapter
in the Core Features Guide . Automatic reuse and migration of columns When you create a reference, PowerDesigner can automatically: Reuse an appropriate existing column in the child table as the foreign key column Migrate the primary key column in the parent table to create a foreign key column in the child table O To auto-reuse and/or auto-migrate columns 1. Select Tools Model Options to open the Model Options dialog box. 2. Select the Reference sub-category in the left-hand Category pane to display the Reference tab.
139
References (PDM)
3. Specify your choices for column reuse and migration as follows: To auto-reuse existing columns in child tables as foreign key columns when creating references - select the Auto-reuse columns check box. Note that the column in the child table must have the same code as the migrating primary key column, and cannot already be a foreign key column for it to be suitable for reuse. If you want to reuse a child table column that is already a foreign key column, you must do this manually from the Joins tab of the reference property sheet. To auto-migrate primary key columns in parent tables for use as foreign key columns in child tables - select the Auto-migrate columns check box. This will also enable the column properties check boxes, allowing you to specify which of the parent column properties to migrate. To auto-migrate the properties of parent table primary key columns - select the appropriate check boxes: Domains Check (check parameters) Rules (business rules) Last position (migrated columns should be added at the end of the table column list. If the Last position option is not selected, migrated columns are inserted between key columns and other columns which implies that a child table must be dropped and recreated each time you add a reference and modify an existing database.) Note that, during intermodel generation, whether or not the Auto-migrate columns check box is selected, any selected column property is migrated from the PK to the FK. 4. Ensure that the Default link on creation option is set to Primary key. 5. Click OK to close the Model Options dialog box. Examples The following examples illustrate how using the auto-reuse columns and auto-migrate columns options affects the creation of references.
Matching child table column exists
The following table shows the results of migrating primary key columns to a child table that contains a matching column for one of the primary key columns. The original two tables are also shown below:
140
Auto-reuse
Automigrate
Result
Selected
Selected
Col_1 is reused and Col_2 is created T1_Col_1 is created and Col_2 is created Col_1 is reused and Col_2 is not created No column is reused and no column is created
Not selected
Selected
Selected
Not selected
Not selected
Not selected
The following table shows the results of migrating primary key columns to a child table that contains a matching child table column that is already a foreign key column for another table. The original two tables are also shown below:
Auto-reuse
Automigrate
Result
Selected
Selected
T1_Col_1 is created and Col_2 is created T1_Col_1 is created and Col_2 is created No columns are reused or created No columns are reused or created
Not selected
Selected
Selected
Not selected
Not selected
Not selected
Notes:
141
References (PDM)
By default, only the properties of the primary key column are migrated to the foreign key. If the primary key column is attached to a domain, the domain will not be migrated to the new foreign key column unless the Enforce non-divergence option model option is selected (see Enforcing non-divergence from a domain in a data model on page 121). The following table shows the results of changing references when you have selected the auto-migrate columns option:
Action Result
Migrate primary key in parent table to foreign key in child table Delete unused foreign key columns Modify reference join
Migrate primary key in parent table to foreign key in child table Delete unused foreign key columns Modify reference join
Action Result
Migrate primary key in parent table to foreign key in child table Delete unused foreign key columns Modify reference join
Reference properties
You can modify an objects properties from its property sheet. To open a reference property sheet, double-click its diagram symbol or its Browser entry in the References folder. The following sections detail the property sheet tabs that contain the properties most commonly entered for references. The General tab contains the following properties:
142
Property
Description
Name
Species the name of the item, which should be clear and meaningful, and should convey the items purpose to nontechnical users Species the technical name of the object, which is used for generating code or scripts, which may be abbreviated, and should not generally include spaces Species a descriptive label for the reference Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or userdened Species the parent table of the reference. This table contains the primary key, or alternate key, linked by the reference. You can use the tools to the right of the list to create an object, browse the complete tree of available objects or view the properties of the currently selected object Species the role of the parent table in the reference. The text is displayed in the diagram, near the parent table Species the child table of the reference. This table contains the foreign key linked by the reference Species the role of the child table in the reference. The text is displayed in the diagram, near the child table When selected, indicates to generate the reference in the database
Code
Comment Stereotype
Parent table
Reference property sheet Joins tab A join is a link between a column in a parent table and a column in a child table (column pair) that is dened within a reference. A join can link primary, alternate or foreign key, or user-specied columns in the parent and child tables that are independent of key columns. O To dene joins in a reference 1. Double-click a reference in the diagram to open its property sheet, and then click the Joins tab. 2. Select a key in the Parent Key list to create joins on its columns. If you
143
References (PDM)
select <NONE>, the column lists are empty and you must specify your own columns to join. The columns linked by the joins are listed in the Parent Table and Child Table columns.
You can change the foreign key column linked by a join by clicking the column in the Child Table list, and selecting another column from the list. 3. [optional] If you selected <NONE> from the Parent Key list, click the Parent Table Column and select a column from the list, then click the Child Table Column and select a child column. 4. [optional] Select the Auto arrange join order check box to sort the list by the key column order. If this option is not selected, you can re-arrange the columns using the arrow buttons. 5. Click OK. 144
Enabling the Auto arrange join order check box To enable this check box, add an EnableChangeJoinOrder item to the
Reference category in the DBMS denition le and set the value to YES. See the DBMS Resource File Reference chapter of the Customizing and Extending PowerDesigner manual.
Default joins at reference Join creation is determined by the following Model Options: creation
Default Link on Creation Auto-migrate Columns Result
Primary Key
Joins created between primary and foreign key columns. Joins created and linked to primary key columns, but are incomplete. Foreign key columns must be specied manually. No joins created. Parent and child table column pairs must be specied manually. No joins created. Parent and child table column pairs must be specied manually.
User-dened
Selected
Not selected
For any reference you can choose to link a primary key, or alternate key, to a corresponding foreign key. When you select a key from the Joins tab of the reference property sheet, all the key columns are linked to matching foreign key columns in the child table.
Changing a foreign key column link
A foreign key column can be changed to link to another parent table column, either within the key relationship, or independent of it.
Reuse and Migration option for a selected reference
You can use the following buttons on the Joins tab to reuse or migrate columns linked by joins.
145
References (PDM)
Tool
Description
Reuse Columns - Reuse existing child columns with same code as parent table columns Migrate Columns - Migrate key columns to foreign key columns. If columns do not exist they are created Cancel Migration - Delete any migrated columns in child table
Reference property sheet Integrity tab Referential integrity is a collection of rules that govern data consistency between primary keys, alternate keys and foreign keys. It dictates what happens when you update or delete a value in a referenced column in the parent table, and when you delete a row containing a referenced column from the parent table. The Integrity tab contains the following properties:
Property Description
Name of the referential integrity constraint. Maximum length is 254 characters Species how referential integrity will be implemented. You can choose between: Declarative- Referential integrity constraints are dened for particular references. When the reference is generated the target DBMS evaluates the reference validity and generates appropriate error messages Trigger - Referential integrity constraints are implemented by triggers based on the integrity constraints dened in the reference property sheet. The trigger evaluates reference validity and generates appropriate user-dened error messages
146
Property
Description
Cardinality
Indicates the minimum and maximum number of instances in a child table permitted for each corresponding instance in the parent table. The following values are available by default: 0..* - A parent can have zero or more children. There is no maximum. 0..1 - A parent can have zero or one children. 1..* - A parent can have one or more children. There is no maximum. 1..1 A parent must have exactly one child Alternately, you can enter your own integer values in one of the following formats: x..y - A parent can have between x and y children. x - A parent can have exactly x children. x..y, a..b - A parent can have between x and y or between a and b children. You can use * or n to represent no limit. Examples: 2..n There must be at least 2 children. 10 - There must be exactly 10 children. 1..2, 4..n There must be one, two, four or more children.
User-dened
147
References (PDM)
Property
Description
Update constraint
How updating a key value, in the parent table affects the foreign key value in the child table. Depending on the implementation and DBMS, you can choose between: None - Update or deletion of a value in the parent table has no effect on the child table. Restrict - A value in the parent table cannot be updated or deleted if one or more matching child values exists Cascade - Update or deletion of a value in the parent table causes an update or delete of matching values in the child table Set null - Update or deletion of a value in the parent table sets matching values in the child table to NULL Set default - Update or deletion of a value in the parent table sets matching values in the child table to the default value
How deleting a row in the parent table affects the child table Each foreign key value in the child table must have a corresponding key value, in the parent table A foreign key value can change to select another value in the referenced key in the parent table [Sybase SQL Anywhere 5.0 and 5.5 only] Veries referential integrity only on the commit, instead of verifying it after row insertion. You can use this feature to control circular dependencies Indicates whether the reference constraint is a clustered constraint (for those DBMS that support clustered indexes)
Cluster
Rebuilding references
You can rebuild references to create default references between PK columns in one table and columns with identical code and data type in another table. Note that rebuilding is not possible between two tables with PK columns. Rebuilding references is useful following the reverse engineering of a database in which all of the references could not be reverse engineered.
148
O To rebuild references 1. Select Tools Rebuild Objects Rebuild References to open the Rebuild References dialog box. 2. Select a mode: Delete and Rebuild - All existing references are deleted, and new references built based on matching key columns Preserve - All existing references are kept, and new references are built based on new matching key columns 3. [optional] Click the Selection tab and specify the tables for which you want to rebuild references. By default, all tables are selected.
To rebuild references between tables in a package, select the package from the list at the top of the tab. To rebuild references between tables in a sub-package, select the Include Sub-Packages icon next to the list, and then select a sub-package from the dropdown list. 4. Click OK. If you selected the Delete and Rebuild mode, a conrmation box asks you to conrm your choice. Click Yes to conrm the deletion and rebuild of the selected references.
149
References (PDM)
150
O To drag a reference to a different table 1. Click a reference symbol. 2. Press and hold CTRL while dragging one of the symbol ends to a new table. You can set the global display mode for references by clicking Tools Model Options and selecting a notation from the list. PowerDesigner supports Relational, CODASYL, Conceptual and IDEF1X notations.
151
Views (PDM)
Views (PDM)
A view is an alternative way of looking at the data in one or more tables. It is made up of a subset of columns from one or more tables. You dene a SQL query for each view.
Creating a view
You can create a view in any of the following ways: Use the View tool in the diagram Palette. Select Model Views to access the List of Views, and click the Add a Row tool. Right-click the model or package in the Browser, and select New View. Select Tools Create View. For more details, see Creating a view from the Tools menu on page 156. You can, optionally, pre-select one or more tables and views in the diagram to create a view automatically populated with their columns.
For general information about creating objects, see the Objects chapter
in the Core Features Guide .
View properties
You can modify an objects properties from its property sheet. To open a view property sheet, double-click its diagram symbol or its Browser entry in the Views folder. The following sections detail the property sheet tabs that contain the properties most commonly entered for views. The General tab contains the following properties:
Property Description
Name
Species the name of the item, which should be clear and meaningful, and should convey the items purpose to nontechnical users Species the technical name of the object, which is used for generating code or scripts, which may be abbreviated, and should not generally include spaces Species a descriptive label for the view
Code
Comment
152
Property
Description
Stereotype
Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or userdened Species the name of view owner. You choose an owner from a list of users. A view can only have one owner at a time. This is normally the view creator Species the use of the view: Query only denes a view for consultation only, view cannot update tables; Updatable denes a view for consultation and update, view can update tables; and With Check options implements controls on view insertions Species the multidimensional type of the view, that is Dimension or Fact For those DBMS that support it, allows you to dene the type of a view. You can select materialized query table, materialized view, summary table, or XML Includes view generation as part of database generation script When selected, makes sure the view query is not parsed by PowerDesigner internal parser. This protects the view query from any update using model objects and keeps its syntax as dened by user. Otherwise, the view query is parsed and modied according to model values
Owner
Usage
Generate User-dened
153
Views (PDM)
The name, code, description and data type of the view column are those of the corresponding column in the linked table or view. It implies the view is not linked to another object. The name and code of the view column comes from the column name in the rst query in the view denition. For example, MyView is dened by the following queries:
If the view is user-dened
select Name, Comment from Property union select Signature, Body from Method
Only the two columns of the rst query are used to create the corresponding view columns:
In this case, if you modify the view column code, the view creation script will reect the change. In our example, if you rename Name in ClientName, the view creation script is the following:
create view MYVIEW (ClientName, "Comment") as select Name, Comment from Property
When you select a column in the list of view columns and click the Properties tool in the toolbar, the view column property sheet is displayed. You can dene the following properties from the view column property sheet:
154
Property
Description
Name
Species the name of the view column. This name is automatically calculated. If you choose to modify the default name, the User-dened button is selected and the Custom Name column displays the user-dened name. You can recover the default name by clicking again the User-dened button Species the code of the view column. The code is automatically calculated. If you choose to modify the default code, the User-dened button is selected and the Custom Code column displays the user-dened code. You can recover the default code by clicking again the User-dened button Species the comment of the view column. This comment is automatically calculated from the column comment in the original table or view. If you choose to modify the default comment, the User-dened button is selected. You can recover the default comment by clicking again the Userdened button View column stereotype View column data type. This data type is automatically calculated from the column data type in the original table or view. If you choose to modify the default data type, the User-dened button is selected. You can recover the default data type by clicking again the User-dened button Maximum length of the data type Maximum number of places after the decimal point
Code
Comment
Length Precision
You can also dene notes and business rules on a view column.
User-dened name or code
You can modify the name and the code of a view column from the list. If you need to recover the name or code default value, you have to clear the corresponding cell in the list, the default name or code is automatically restored.
View property sheet SQL Query tab The SQL Query tab displays the SQL code for all the queries associated with the view. You can edit this code directly in this tab or access the property sheets of individual queries. For more information, see Creating, editing, and deleting queries associated with views on page 157.
155
Views (PDM)
View property sheet Triggers tab The Triggers tab is only displayed if your DBMS supports triggers on views. View triggers can make the view behave like a table. You can dene a trigger to re when one or more attributes of a table view column are modied. O To create a trigger on a view 1. Open the view property sheet and click the Triggers tab. 2. Click the Add a Row tool, and then click the Properties tool to open the property sheet of the newly-created trigger. 3. Click the Denition tab. The trigger time type will be set to instead of. 4. Write a trigger from scratch or select a trigger template. For more details about writing triggers, see the chapter Building Triggers and Procedures View property sheet Preview tab The Preview tab displays the SQL code associated with the view. For more information, see Previewing SQL statements in the Working with Data Models chapter.
156
Select the appropriate objects and then click OK. A view symbol is displayed in the diagram. It displays all the columns in each of the tables and views selected for the view. The names for the tables and views appear at the bottom of the view symbol.
157
Views (PDM)
Any number of queries may be associated with a view, and the totality of their SQL statements is shown in this tab, linked by any of the standard SQL constructs, such as Union, etc. Editing query code in the SQL Query tab You can edit the code shown in the SQL Query tab in any of the following ways: Edit the code directly in the tab Click the Edit with SQL Editor tool to open the code in PowerDesigners built-in SQL Editor. The SQL Editor provides a more complete query denition environment than the SQL query tab, including access to standard SQL constructs and syntax tools for functions and operators (see Dening queries with the SQL Editor in the Working with Data Models chapter). Click the Edit with tool (CTRL+E) to open the code in your favorite editor Any edits you make in the SQL Query tab will propagate to the property sheets of the associated individual queries (see Opening the property sheet of a query on page 159).
Query list
The individual queries associated with the view are available from the Query
158
list at the bottom of the SQL Query tab. You can create and delete queries using the tools at the bottom of the tab. O To create a new query in the Query list 1. Click the Add a query tool to the right of the Query list (you can specify the way in which the new query will be linked with the other queries by clicking the arrow to the right of the tool and selecting one of the constructs listed below). The new querys property sheet opens. 2. Enter the query code and click OK. The new query is added to the Query list in the View property sheet SQL Query tab, and its code is added to the tab. The following SQL constructs are available for linking queries in PowerDesigner (depending on your DBMS):
Construct Result Example
Displays all the data retrieved by both the queries, except where results are repeated. Displays all the data retrieved by both the queries, including repeated results. Displays only the data retrieved by both the queries. Displays only the data retrieved by one or other of the queries, but not by both.
SELECT 1: ABC SELECT 2: BCD Result: ABCD SELECT 1: ABC SELECT 2: BCD Result: ABCBCD SELECT 1: ABC SELECT 2: BCD Result: BC SELECT 1: ABC SELECT 2: BCD Result: AD
Intersect
Minus
O To delete a query from the Query list 1. Select the query in the Query list. 2. Click the Delete tool to the right of the Query list. The query is removed from the Query list and its code deleted from the tab. Opening the property sheet of a query Each query associated with a view has its own property sheet, which contains the following tabs: 159
Views (PDM)
SQL (see Query property sheet SQL tab on page 160) Tables (see Query property sheet Tables tab on page 160) Columns (see Query property sheet Columns tab on page 161) Where (see Query property sheet Where tab on page 161) Group By (see Query property sheet Group By tab on page 162) Having (see Query property sheet Having tab on page 162) Order By (see Query property sheet Order By tab on page 163) You can manipulate each of these clauses using the lists in these tabs, and any changes you make will propagate to the other tabs and the SQL Query tab of the parent view (see Editing query code in the SQL Query tab on page 158). O To open a querys property sheet from the Query list 1. Select the query in the Query list. 2. Click the Properties tool to the right of the Query list. Query property sheet SQL tab This tab displays the SQL code for the query. You can edit the code of an individual query in its SQL tab in any of the following ways: Edit the code directly in the tab Click the Edit with SQL Editor tool to open the code in PowerDesigners built-in SQL Editor (see Dening queries with the SQL Editor in the Working with Data Models chapter). Click the Edit with tool (CTRL+E) to open the code in your favorite editor Any edits you make in the SQL tab will propagate to the querys clause tabs and the SQL Query tab of the parent view (see Editing query code in the SQL Query tab on page 158). Query property sheet Tables tab This tab lists the tables in the FROM clause, which specify where the query data will be drawn from.
160
You can add or delete tables as appropriate, and reorder the tables in the list using the arrows at the bottom of the tab.Any changes you make will propagate to the querys SQL tab and to the SQL Query tab of the parent view. O To add a table 1. Click in the rst empty row in the list. 2. Select a table from the list. To enter a more complex expression via the SQL Editor, click the ellipsis button to the right of the list. 3. [optional] Enter an alias for the table in the Alias column. Query property sheet Columns tab This tab lists the columns in the SELECT clause, which specify what data will be displayed in the query. You can add or delete columns as appropriate, and reorder the columns in the list using the arrows at the bottom of the tab. Any changes you make will propagate to the querys SQL tab and to the SQL Query tab of the parent view. O To add a column 1. Click in the rst empty row in the list. 2. Select a column from the list. You can add all the columns in a table by selecting a list entry with the table name followed by an asterisk. To enter a more complex expression via the SQL Editor, click the ellipsis button to the right of the list. 3. [optional] Enter an alias for the column in the Alias column. Query property sheet Where tab This tab lists the expressions in the WHERE clause, which restrict the data retrieved by the query. You can add or delete expressions as appropriate, and reorder the expressions in the list using the arrows at the bottom of the tab. Any changes you make will propagate to the querys SQL tab and to the SQL Query tab of the parent view.
161
Views (PDM)
O To add an expression 1. Click in the rst empty row in the list. 2. [optional] Enter a prex in the Prex column. 3. In the rst Expression column, select a column from the list. To enter a more complex expression via the SQL Editor, click the ellipsis button to the right of the list. 4. In the Operator column, select an operator from the list. 5. In the second Expression column, select a column from the list. To enter a more complex expression via the SQL Editor, click the ellipsis button to the right of the list. 6. [optional] Enter a sufx in the Sufx column. Query property sheet Group By tab This tab lists the columns in the GROUP BY clause, which control how the data retrieved by the query will be grouped. You can add or delete columns as appropriate, and reorder the columns in the list using the arrows at the bottom of the tab. Any changes you make will propagate to the querys SQL tab and to the SQL Query tab of the parent view. O To add a column 1. Click in the rst empty row in the list. 2. Select a column from the list. To enter a more complex expression via the SQL Editor, click the ellipsis button to the right of the list. Query property sheet Having tab This tab lists the expressions in the HAVING clause, which restrict the data returned by a query with a GROUP BY clause. You can add or delete expressions as appropriate, and reorder the expressions in the list using the arrows at the bottom of the tab. Any changes you make will propagate to the querys SQL tab and to the SQL Query tab of the parent view.
162
O To add an expression 1. Click in the rst empty row in the list. 2. [optional] Enter a prex in the Prex column. 3. In the rst Expression column, select a column from the list. To enter a more complex expression via the SQL Editor, click the ellipsis button to the right of the list. 4. In the Operator column, select an operator from the list. 5. In the second Expression column, select a column from the list. To enter a more complex expression via the SQL Editor, click the ellipsis button to the right of the list. 6. [optional] Enter a sufx in the Sufx column. Query property sheet Order By tab This tab lists the columns in the ORDER BY clause, which control the way in which the data retrieved by the query will be sorted. You can add or delete columns as appropriate, and reorder the columns in the list using the arrows at the bottom of the tab. Any changes you make will propagate to the querys SQL tab and to the SQL Query tab of the parent view. O To add a column 1. Click in the rst empty row in the list. 2. In the Column column, select a column from the list. To enter a more complex expression via the SQL Editor, click the ellipsis button to the right of the list. 3. In the Sort Direction column, select either ASC or DESC.
In DB2 CS7, you design a query table using a view with the summary table type. In later versions of DB2, you should use the materialized query table type.
163
Views (PDM)
In Oracle, you design a query table using a view with the materialized view type. Materialized view is the new recommended name for snapshots that were used before version 8i.
164
If you change the DBMS of a model containing query tables, these are converted into regular views.
Physical options
Query tables support physical options. When you select a query table type in the view property sheet, the Options tab automatically is displayed to let you dene physical options for view generation.
A view identied as Book Sales can have two extended dependencies indicating that the view depends on the Title and Sale tables. The diagram displays their extended dependencies and stereotypes.
165
Views (PDM)
For more information on extended model denitions, see Extended Model Denitions in the Working with Data Models chapter.
If you create a reexive and/or circular set of extended dependencies with the <<DBCreateAfter>> stereotype, an error message is displayed
166
during the check model. If you choose to ignore this error, the views will be generated in alphabetical order, without taking into account the generation order, which could cause errors in the creation of views in the database.
Example
You create the view DEPARTMENT STORE from the table STORE. The view retrieves information from the table as you can check in the SQL Query tab of the view property sheet:
You decide to create another view called COMPUTER COUNTER to show only part of the department store offer. This view is created from the view DEPARTMENT STORE, and retrieves information from it. By default views are generated in alphabetical order, so the generation of COMPUTER COUNTER will fail since the view DEPARTMENT STORE from which it depends is not generated. To bypass this problem, you can create a extended dependency with the <<DBCreateAfter>> stereotype from COMPUTER COUNTER to DEPARTMENT STORE.
This allows you to set an order in the generation of views: DEPARTMENT STORE will be generated before COMPUTER COUNTER.
167
Views (PDM)
You can create an extended dependency between views from the list of views or from the diagram.
For more information on how to create views from a list, see Dening a
generation order for stored procedures section in the Building Triggers and Procedures chapter. O To dene a generation order for views from the diagram 1. Select the Extended Dependencies tool in the palette. 2. Click inside the dependent view and while holding down the mouse button, drag the cursor into the inuent view. Release the mouse button. 3. Double-click the extended dependency link. The dependent view property sheet opens to the Extended Dependencies tab. you can check that the inuent view is displayed in the Inuent Object column of the list of extended dependencies. 4. Click inside the Stereotype column, click the down arrow and select <<DBCreateAfter>> in the list.
5. Click OK.
For general information about creating objects, see the Objects chapter
in the Core Features Guide .
For more information about manipulating view references, see Changing a table at either end of a reference on page 150 and Modifying a reference graphically on page 150. View reference properties
You can modify an objects properties from its property sheet. To open a view reference property sheet, double-click its diagram symbol or its Browser entry in the View References folder.
169
170
Property
Description
Name
Species the name of the item, which should be clear and meaningful, and should convey the items purpose to nontechnical users Species the technical name of the object, which is used for generating code or scripts, which may be abbreviated, and should not generally include spaces Species a descriptive label for the view reference Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or userdened Species the parent table or view of the view reference. You can use the tools to the right of the list to create an object, browse the complete tree of available objects or view the properties of the currently selected object Species the role of the parent table or view in the view reference. The text is displayed in the diagram, near the parent table or view Species the child table or view of the view reference. You can use the tools to the right of the list to create an object, browse the complete tree of available objects or view the properties of the currently selected object Species the role of the child table or view in the view reference. The text is displayed in the diagram, near the child table or view
Code
Comment Stereotype
Parent
Parent role
Child
Child role
A view reference also includes joins, that are links between parent columns and child columns.
171
Example
French_Store is a view of table Store. You dene a join between Store_ID in the table and STORE_STORE_ID in the view. Customer_Orders is a view of table Orders. You dene a join between Order_No in the table and ORDER_ORDER_N in the view. You create a view reference between French_Store and Customer_Order in which you dene a join between ORDER_ORDER_STORE and STORE_STORE_ID. This is to establish a correspondence between the store ID and the store where the order is sent. If you create a view from French_Store and Customer_Orders, you can check in the SQL query tab of the view that the SELECT order takes into account the join dened between the views. The SELECT statement will retrieve orders sent to French stores only.
In the Joins tab of a view reference property sheet, you can use the Reuse Columns tool to reuse existing child columns with same code as parent columns.
172
O To dene joins in a view reference 1. Double-click a view reference in the diagram to display the view reference property sheet. 2. Click the Joins tab to display the Joins tab. 3. Click the Reuse Columns tool to reuse existing child columns with same code as parent columns.
or
Click the Add a Row tool. A join is created but you have to dene the parent and child columns. 4. Click in the Parent Column column and select a column in the list. 5. Click in the Child Column column and select a column in the list.
6. Click OK.
173
Common data constraints which dene a data range. For example minimum and maximum values for a column SQL expression dening a data constraint using the %MINMAX%, %LISTVAL%, and %RULES% variables that are instantiated with standard parameter values Business rule that is dened as a server expression, and is attached to one of the following listed objects
Validation rule
Lowest acceptable numeric value Highest acceptable numeric value Value selected from a list of default values or typed in the listbox. The list of values is dened in the Script\Keywords\ReservedDefault entry of the DBMS denition le Data format (for example, 9999.99) Standard measure Forces all alphabetical characters to lowercase Forces all alphabetical characters to uppercase
174
Parameter
Description
Cannot Modify
Protects from changes, results in a non-modiable column/entity attribute in the table when generated in the database Authorized values String that identies an authorized value in the list
Example
A table/entity in a data model for a clothing shop may contain check parameters dened for a column/entity attribute SIZE, which depend on the check parameters dened on another column/entity attribute CLOTHING TYPE, as clothing size for a skirt in one country may be different from the same size in another country. In this case an expression is required to create a constraint which uses check parameters dened for both columns/entity attributes. O To dene additional check parameters 1. Open the property sheet of a domain or column/entity attribute and click the Additional Checks tab.
2. Type a SQL expression, which may include any of the following variables: %MINMAX% - Minimum and maximum values dened in Values groupbox on Standard Checks tab %LISTVAL% - Customized values dened in List Values groupbox on Standard Checks tab %RULES% - Validation rule expression dened on Expression tab of the Rules property sheet 3. Click OK to return to the model diagram.
176
Code of the column to which the business rule applies Code of the domain to which the business rule applies Code of the table to which the business rule applies Minimum and maximum values for the column or domain List values for the column or domain Server validation rules for the column or domain
For more information on dening business rules, see Business Rules (CDM/LDM/PDM) on page 179.
O To use a validation rule in check parameters 1. Open the property sheet of a table, domain, or column, and click the Rules tab. 2. Click the Add Objects button to open a selection box, and select a business rule in the list. 3. Click OK in each of the dialog boxes.
Validation rule expressions
You must click the Rules button to modify the expression attached to a validation rule. You can also modify validation rule expressions from the list of business rules, by clicking the Dene button.
177
178
179
Name Code
The name of the item which should be clear and meaningful, and should convey the items purpose to non-technical users The technical name of the item used for generating code or scripts, which may be abbreviated, and should not generally include spaces Descriptive label for the rule Sub-classication used to extend the semantics of an object.
Comment Stereotype
180
Property
Description
Type
Species the nature of the business rule. You can choose between: Constraint a check constraint on a value. In a PDM, constraint business rules can be generated in the database. For example, The start date should be inferior to the end date of a project. Denition a property of the element in the system. For example; A customer is a person identied by a name and an address. Fact a certainty in the system. For example, A client may place one or more orders. Formula a calculation. For example, The total order is the sum of all the order line costs. Requirement a functional specication. For example, The model is designed so that total losses do not exceed 10% of total sales. Validation a constraint on a value. For example, The sum of all orders for a client must not be greater than that clients allowance.
181
3. Select one or more business rules and click OK. The business rules are added to the object and appear in the list of business rules for the object. 4. Click OK to return to the model diagram.
U Column in the List of business rules
When you apply a business rule to an object, the U (Used) column beside this business rule is automatically checked in the List of business rules to indicate that the business rule is used by at least one object in the model. The U column allows you to visualize unused business rules, you can then delete them if necessary.
and columns in a database for the DBMS that support this feature. During generation, the variable %RULES% is evaluated in order to generate a single constraint in the SQL script. This constraint is a concatenation of all check parameters dened in the Check tab of a table property sheet, and all validation business rules applied to the current table. You can preview the result of the concatenation of checks and validation business rules in the Preview page of a table property sheet.
For more information on the check parameters of a table, see Naming a table constraint on page 67.
If you want to dene distinct check constraints on tables and columns, you have to dene constraint business rules and attach them to objects. This type of business rule allows to generate multiple check constraints on an object in the database. This feature is only available for DBMS supporting multiple check constraints, and provided the EnableMultiCheck entry in the General category of the DBMS is set to Yes.
For more information on DBMS entries, see the DBMS Resource File
Reference chapter in the Customizing and Extending PowerDesigner manual.
Example
Check parameter (in the Check page of the table) Validation business rule
This check veries that the customer number is different from the employee number PROJ_NUM to check that the column project number is not null EMP_NUM to check that the employee number is not null
DATE_CONSTY to check that the start date of the project is inferior to the end date of the project
183
When you display the table code preview, you can verify that the check
parameters and validation business rules are concatenated into a single constraint, whereas the constraint business rule is displayed as a different constraint in the script.
Creating a constraint business rule O To create a constraint business rule in a PDM 1. Select Model Business Rules to open the List of Business Rules, and click the Add a Row tool to create a new rule. 2. Enter a name and a code for the new rule, and click the Properties tool to open its property sheet: 3. Select Constraint in the Type list, and then click the Expression tab. 4. Enter an expression in the Server page.
184
5. Click OK to save your changes and return to the model diagram. Applying a constraint business rule to a table or a column You can attach a constraint business rule to a table or a column. You cannot reuse a constraint business rule between different objects, so you must create as many as needed for your model objects. When you attach a constraint business rule to an object, the code of the business rule will be used as the constraint name. If you wish to enforce code uniqueness for constraints in your model, you have to set the UniqueConstName entry in the General category of the DBMS to Yes. In such case, the code of the constraint generated from validation business rules and the code of the constraint business rules must be unique in the model.
For more information on DBMS entries, see the DBMS Resource File
Reference chapter in the Customizing and Extending PowerDesigner manual. O To attach a constraint business rule to a table or column 1. Open the table or columns property sheet and click the Rules tab. 2. Click the Add Objects tool to open a list of available business rules.
185
3. Select a constraint business rule from the selection list and click OK to attach it to the object.
4. [optional] Click Apply to conrm the attachment of the rule and then click the Preview tab to verify that the constraint has been created in the script: 5. Click OK to return to the diagram. Generating a constraint business rule Depending on the type of DBMS, the following is generated regarding check constraints:
186
Database type
Generation result
Database does not support any check constraints Database does not support multiple check constraints Database supports multiple check constraints
No constraint is generated
Constraint business rules, check parameters, and validation business rules are concatenated into a single constraint expression First, the check parameters and validation business rules are generated into a single constraint, then the constraint business rules are generated into different constraints. Constraints are thus ordered
Reverse engineering a constraint business rule During reverse engineering, the constraint order is taken into account: The rst constraint is retrieved as check parameters (in the Check page of the table property sheet) Each constraint following the initial constraint is retrieved as a constraint business rule
187
Physical Options
Physical Options
A physical option is a parameter (included at the end of a Create statement) that denes how an object is optimized or stored in a database. Physical options are not supported by all databases, and vary by DBMS. In ASA 6, for example, you can dene physical options for tables, columns, indexes, tablespaces, and databases. Other DBMSs provide options for keys, storages, and sequences. The syntax for a physical option depends on the DBMS. For example:
DBMS Tablespace option syntax
Tablespace In
For more information about the syntax of physical options and how they
are controlled in the DBMS resource le, see Physical Options in the DBMS Resource File Reference chapter of the Customizing and Extending PowerDesigner manual. When you change DBMS, the physical option settings are applied as far as possible to the new DBMS. If a specic physical option was selected in the model, the default value is preserved for the option in the new DBMS. Unselected physical options are reset with the new DBMS default values. PowerDesigner allows you to set: Default physical options for all the objects in the model (see Dening default physical options on page 188) Physical options for a specic object, which override the default physical option values (see Dening physical options for individual objects on page 191)
188
Physical option default values can also be reverse engineered from a database into a PDM. You can view the script for a physical option in the Preview tab for the object for which it is dened. O To dene default physical options 1. Select Database Default Physical Options to display the Default Physical Options dialog box. There is a tab for each kind of object that supports physical options. The Table tab opens by default:
2. The Syntax tab in the left pane lists the physical options available in the DBMS, and the right pane contains the physical options that have been selected for the object. 3. To add an option for the object, select it in the list in the Syntax pane and click the Add tool between the panes to copy it to the Items pane. To add only a sub-parameter for the option, expand the option in the Syntax pane, select the required parameter and then click the Add tool. 4. To set a value for a physical option parameter, select the parameter in the list in Items pane and enter or select the appropriate value in the eld that is displayed below the pane. The entered value will then be displayed against the parameter in the Items list.
189
Physical Options
5. Repeat the above steps as many times as necessary to specied all your required physical options. By default, these options will be applied to all tables in the model. To specify that the options should apply to only certain of the existing tables, click the Apply to button to display a selection dialog. Select the tables that you want to apply the options to from the list and then click OK. 6. Select the other tabs to specify physical options for other option types. (Note that the Apply to button is not available on the Database tab). 7. Click OK to close the Default Physical Options dialog box. The following tools are available for adding and removing physical options to an object:
Tool Action when clicked
Adds physical option selected in Syntax tab (left pane) to Items tab (right pane) Aligns a selected physical option in the Items tab with the corresponding physical option in the Syntax tab Removes physical option selected in Items tab
190
Dening physical options for individual objects You can set physical options for selected objects to override the default
physical options (see Dening default physical options on page 188).
There are two different interfaces for specifying physical options for
individual objects, both of which are accessible through tabs on the objects property sheet: Physical Options (Common) this tab is displayed by default (along with the Partition tab, if applicable), and lists the most commonly-used physical options in the format of a standard property sheet tab. You can enter values for the necessary option parameters and click OK Physical Options (All) this tab is hidden by default, and lists all the available physical options for the object in a tree format. To display this tab, click the Property Sheet Menu button and select Customize Favorite Tabs Physical Options (All). You should follow the procedure in Dening default physical options on page 188, to modify the appropriate options.
You can choose a tablespace or storage already dened in the model as a value for a tablespace or storage that you dene for a table. These are listed in a list below the right pane in the Options tab. In DB2 OS/390, tablespaces are, by default, prexed by the name of the database attached to the model (see the DBMS-Specic Features chapter). For more information on dening tablespaces and storages, see the Generating a Database from a PDM chapter.
DBMS-specic information
The following table lists the objects for which physical options are available when working with a particular DBMS:
191
Physical Options
Database
Sybase AS Anywhere Sybase AS Enterprise IBM DB2 for Common Server IBM DB2 for OS/390 Microsoft SQL Server Oracle
Table, Index, Database, Tablespace Table, Index, Key, Database Table, Column, Index, View, Storage, Tablespace Table, Column, Index, Database, Storage, Tablespace Table, Index, Key, Database Table, Key, Index, View, Join Index, Sequence, Database, Tablespace, Storage
192
CHAPTER 4
This chapter describes how to build multidimensional diagrams, and how to create and modify the associated objects. .
Contents
Topic: Multidimensional Diagram Basics Cubes (PDM) Dimensions (PDM) Attributes (PDM) Facts (PDM) Measures (PDM) Hierarchies (PDM) Associations (PDM)
193
Sales data can have the dimensions product, region, customer, and store. Facts, for example, the sales totals, are viewed through the user-dened dimensions. When you retrieve the sales total of a particular product for a particular region, you are viewing the sales total through the product and region dimensions. The most common dimension is time because the purpose of multidimensional analytical queries is to nd trends.
194
195
Cube
Collection of measures related to aspects of the business and used to carry out a decision support investigation. See Cubes (PDM) on page 198. Axis of investigation of a cube (time, product, geography). See Dimensions (PDM) on page 209. [none] [none] Used to qualify a dimension. For example, attribute Year qualies the Date dimension. See Attributes (PDM) on page 211. Group of measures used among cubes. See Facts (PDM) on page 214. Variable linked to a fact, used as the focus of a decision support investigation. See Measures (PDM) on page 216. Organizational structure that describes a traversal pattern though a dimension. See Hierarchies (PDM) on page 218. Association that relates a cube to a dimension. See Associations (PDM) on page 220.
Dimension
Attribute
Fact Measure
[none] [none]
[none] [none]
Hierarchy
[none]
[none]
Association
To create a new PDM with a multidimensional diagram, select File New, choose Physical Data Model from the Model type list, choose Multidimensional Diagram as the rst diagram, and click OK.
197
Cubes (PDM)
Cubes (PDM)
A cube is a collection of measures (see Measures (PDM) on page 216) corresponding to values stored into each of its data cells. The measures are organized into dimensions (see Dimensions (PDM) on page 209) to provide for faster retrieval and drill-down. Usually a cube is associated with a fact that allows to dene and share measures among cubes. In a multidimensional diagram, the cube represents an OLAP cube. Cubes need to be created and populated via a text le in the OLAP engine. This text le contains a query used to extract data from a data warehouse or operational database to ll the cubes in the OLAP engine, and is dened in the Query tab of the cubes property sheet.
Creating a cube
You can create a cube in any of the following ways: Use the Cube tool in the diagram Palette. Select Model Cubes to access the List of Cubes, and click the Add a Row tool. Right-click the model or package in the Browser, and select New Cube. Rebuild a cube from a fact table or view dened in a physical diagram (see Retrieving Multidimensional Objects on page 199).
For general information about creating objects, see the Objects chapter
in the Core Features Guide .
Cube properties
You can modify an objects properties from its property sheet. To open a cube property sheet, double-click its diagram symbol or its Browser entry in the Cubes folder. The following sections detail the property sheet tabs that contain the properties most commonly entered for cubes. The General tab contains the following properties:
198
Property
Description
Name
Species the name of the item, which should be clear and meaningful, and should convey the items purpose to nontechnical users Species the technical name of the object, which is used for generating code or scripts, which may be abbreviated, and should not generally include spaces Species a descriptive label for the cube Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or userdened Species the fact used by the cube. You can use the tools to the right of the list to create an object, browse the complete tree of available objects or view the properties of the currently selected object
Code
Comment Stereotype
Fact
The following tabs are also available: Fact Measures - lists the Measures linked to the fact used by the cube (see Measures (PDM) on page 216). Queries - displays the SQL statement required to generate the cube data text le that is used to populate the OLAP cube.
Cubes (PDM)
Parent tables or views become Dimension tables or views The new type is indicated in the Dimensional Type eld in the objects property sheet, and a type icon is displayed in the upper left corner of its symbol:
Fact table Dimension table
O To retrieve multidimensional objects 1. Select Tools Multidimension Retrieve Multidimensional Objects to open the Multidimensional Objects Retrieval Wizard. 2. Specify the objects to be retrieved. By default both Facts and Dimensions will be retrieved.
Sybase AS IQ v12.0 and higher
If you are working with Sybase AS IQ v12.0 or higher, you can also select to automatically rebuild join indexes after retrieving multidimensional objects. For more information, see IQ join indexes in the DBMS-Specic Features chapter. 3. [optional] Click the Selection tab to specify which tables to retrieve multidimensional objects from.. 4. Click OK to retrieve the multidimensional objects.. The selected tables are assigned a multidimensional type. Rebuilding Cubes Once the fact and dimension tables of the data warehouse schema are designed, you can use this information to build the multidimensional cubes. The Rebuild Cubes Wizard transforms fact tables or views into cubes, and dimension tables or views into dimensions. You can then design the cubes taking into account the different analysis axes of the dimensions. These cubes will serve to generate the text les used to create and populate the OLAP engine. The Rebuild Cubes feature works only if there are tables in the physical diagram with a multidimensional type (Fact or Dimension). You can assign types either manually (see Table property sheet General tab in the Building Physical Diagrams chapter) or via the Multidimensional Objects Retrieval Wizard (see Retrieving Multidimensional Objects on page 199). 200
The Rebuild Cubes Wizard creates multidimensional objects in a new or existing multidimensional diagram as follows:
Physical object After rebuild cubes, creates
Fact table
A fact with the name of the fact table. A cube with the name of the fact table.
Column in a Fact table (except foreign keys) Dimensions tables attached to the fact table
A dimension, named through the concatenation of the dimension tables along the path to the child table, from the furthest to the closest. A hierarchy that becomes the default hierarchy, and which contains attributes corresponding to the primary key columns of the tables converted into a dimension
Column in a Dimension table (except foreign keys) Reference between a fact and a dimension table
An attribute, named through the concatenation of the dimension table name and column name if column names are ambiguous. Otherwise the name is identical to the name of the column. A cube dimension association
201
Cubes (PDM)
O To rebuild cubes 1. Select Tools Multidimension Rebuild Cubes to open the Cube Rebuild Wizard:
2. Specify a rebuild mode. You can choose between the following options: Delete and Rebuild all cubes are deleted and rebuilt, including those to which you have made modications. Preserve only those cubes that have not been modied are deleted and rebuilt. Any cubes that you have modied are preserved. 3. [optional] Click the Selection tab to specify which tables or views will be used to rebuild cubes. Only those tables and views that have a multidimensional type are available for rebuilding. 4. Click OK to rebuild cubes. A message in the Output window informs you that the rebuild is successful. The cube and dimension are created and displayed in a multidimensional diagram.
202
The link between the operational database and the data warehouse or data mart database is a relational to relational mapping.
203
Cubes (PDM)
O To generate an extraction script 1. In the Physical Diagram, select Database Generate Extraction Script to open the Extraction Script Generation dialog box.
2. Specify a destination directory for the generated le, and select the Check Model check box if you want to verify the PDM syntax before generation. The name of the script is identical to the name of the data source. 3. [optional] Click the Options tab and specify any appropriate options. For more information, see Extraction Script Generation Options tab on page 204. 4. [optional] Click the Selection tab, and select the tables that you want to use in the script generation. 5. Click OK to generate the script les in the specied directory. Extraction Script Generation Options tab The Options tab allows you to specify the format for the script.
204
Title Encoding
Inserts the database header and the name of the tables before each select query. Encoding format to use for generation. You should select the encoding format that supports the language used in your model and the database encoding format. Denes the character case in the generated text le. When selected, disallows the use of accents.
205
Cubes (PDM)
In a PDM multidimensional diagram, each cube is associated with a query. There is one cube per mapping and per data source. The query dened on a cube is used to extract data from a data warehouse or operational database to populate the cubes in the OLAP database. The link between the data warehouse database and the OLAP database is a relational to multidimensional mapping.
Lists the attributes of the cube Lists the attribute values Contains the values stored in the fact measures
206
O To generate cube data 1. In the multidimensional diagram, select Tools Generate Cube Data. The Generate Cube Data dialog box is displayed.
2. Dene a destination directory for the generated le in the Directory box. 3. Select the generation options in the Options tab. 4. Select the cubes and data sources for which you want to generate a le from the sub- tabs in the Selection tab. 5. Click OK. The generated les are stored in the destination directory you have dened.
Cube data generation options
You can customize the format of the generated text les from the Generate Cube Data dialog box.
207
Cubes (PDM)
Option
Description
When selected, includes the name of the attribute at the beginning of the generated text le Extension of the generated text le, you can choose between .txt and .csv Separator used between columns String delimiter Encoding format to use for generation. You should select the encoding format that supports the language used in your model and the database encoding format Denes the character case in the generated text le When selected, disallows the use of accents
208
Dimensions (PDM)
A dimension is an axis of analysis in a multidimensional structure. The dimension is made of an ordered list of attributes that share a common semantic meaning in the domain being modeled. Each attribute designates a unique position along the axis.
The dimension can be mapped to tables or views: this mapping allows to transfer operational data to the dimension.
Creating a dimension
You can create a dimension in any of the following ways: Use the Dimension tool in the diagram Palette. Select Model Dimensions to access the List of Dimensions, and click the Add a Row tool. Right-click the model or package in the Browser, and select New Dimension.
For general information about creating objects, see the Objects chapter
in the Core Features Guide .
Dimension properties
You can modify an objects properties from its property sheet. To open a dimension property sheet, double-click its diagram symbol or its Browser entry in the Dimensions folder. The following sections detail the property sheet tabs that contain the properties most commonly entered for dimensions. The General tab contains the following properties:
209
Dimensions (PDM)
Property
Description
Name
Species the name of the item, which should be clear and meaningful, and should convey the items purpose to non-technical users Species the technical name of the object, which is used for generating code or scripts, which may be abbreviated, and should not generally include spaces Species a descriptive label for the dimension Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or user-dened Species the dimension hierarchy used by default for a cube to perform its consolidation calculations. The hierarchy used by the cube is dened on the cube dimension association
Code
Comment Stereotype
Default Hierarchy
The following tabs are also available: Attributes - lists the attributes that qualify the dimension (see Attributes (PDM) on page 211). Hierarchies - lists the hierarchies used to organize the dimension attributes (see Hierarchies (PDM) on page 218). Mapping - denes the mapping between the current dimension and a table or a view in a data source.
210
Attributes (PDM)
An attribute is used to qualify dimensions (see Dimensions (PDM) on page 209) used in queries. For example, the Time dimension can contain attributes Year, Quarter, Month, and Week.
Creating an attribute
You can create an attribute in any of the following ways: Open the Attributes tab in the property sheet of a dimension, and click the Add a Row tool. Right-click a dimension in the Browser, and select New Attribute.
For general information about creating objects, see the Objects chapter
in the Core Features Guide .
Attribute properties
You can modify an objects properties from its property sheet. To open an attribute property sheet, double-click its Browser entry. The following sections detail the property sheet tabs that contain the properties most commonly entered for attributes. The General tab contains the following properties:
211
Attributes (PDM)
Property
Description
Name
Species the name of the item, which should be clear and meaningful, and should convey the items purpose to non-technical users Species the technical name of the object, which is used for generating code or scripts, which may be abbreviated, and should not generally include spaces Species a descriptive label for the attribute Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or user-dened Parent dimension of the attribute
Code
Comment Stereotype
Dimension
Attribute property sheet Detail Attributes tab A detail attribute participates in the denition of an attribute. Detail attributes appear in the list of dimension attributes, but you can use them to further dene a given attribute. For example, attributes Cust_Name and Cust_Address appear in the list of dimension attributes, however they are used as detail attributes of attribute Cust_ID.
212
O To dene a detail attribute 1. Open the property sheet of a dimension, and click the Attributes tab. 2. Select an attribute in the list, click the Properties tool to open its property sheet, and then click the Detail Attributes tab. 3. Click the Add Detail Attributes tool to open a Selection dialog listing the attributes available in the model, select one or more, and then click OK.
4. Click Apply.
213
Facts (PDM)
Facts (PDM)
A fact corresponds to the focus of a decision support investigation. It is a set of measures (see Measures (PDM) on page 216) manipulated by a cube (see Cubes (PDM) on page 198). For example, Sale, Revenue, Budget could be facts.
Creating a fact
You can create a fact in any of the following ways: Select Model Facts to access the List of Facts, and click the Add a Row tool. Right-click the model or package in the Browser, and select New Fact.
For general information about creating objects, see the Objects chapter
in the Core Features Guide .
Fact properties
You can modify an objects properties from its property sheet. To open a fact property sheet, double-click its Browser entry in the Facts folder. The following sections detail the property sheet tabs that contain the properties most commonly entered for facts. The General tab contains the following properties:
214
Property
Description
Name
Species the name of the item, which should be clear and meaningful, and should convey the items purpose to non-technical users Species the technical name of the object, which is used for generating code or scripts, which may be abbreviated, and should not generally include spaces Species a descriptive label for the fact Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or user-dened
Code
Comment Stereotype
The following tabs are also available: Measures - lists the measures manipulated by the cube with which the fact is associated (see Measures (PDM) on page 216). Mapping - contains the mapping between the fact and a table or a view in a data source.
215
Measures (PDM)
Measures (PDM)
A measure is a variable that corresponds to the focus of an investigation. Measures describe the meaning of the analytical values stored in each data cell of a cube (see Cubes (PDM) on page 198). Measures are most of the time numeric values like for example Price or Total. Measures can also be the result of an operation or calculation as indicated in the formula box of the measure property sheet.
Creating a measure
You can create a measure in any of the following ways: Open the Measures tab in the property sheet of a fact, and click the Add a Row tool. Right-click a fact in the Browser, and select New Measure.
For general information about creating objects, see the Objects chapter
in the Core Features Guide .
Measure properties
You can modify an objects properties from its property sheet. To open a measure property sheet, double-click its diagram symbol or its Browser entry. The following sections detail the property sheet tabs that contain the properties most commonly entered for measures. The General tab contains the following properties:
216
Property
Description
Name
Species the name of the item, which should be clear and meaningful, and should convey the items purpose to nontechnical users Species the technical name of the object, which is used for generating code or scripts, which may be abbreviated, and should not generally include spaces Species a descriptive label for the measure Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or userdened Species the parent fact of the measure Indicates if the measure is a computed expression and allows to dene this expression
Code
Comment Stereotype
Fact Formula
217
Hierarchies (PDM)
Hierarchies (PDM)
A hierarchy denes one of two paths through a dimension (see Dimensions (PDM) on page 209): an organizational path - describes a traversal pattern through a dimension, from the most general to the most specic attribute of the dimension. It is an ordered subset of the attributes. a consolidation path - represents a consolidation of attributes. For example, a Time dimension with a base periodicity of days might have a hierarchy specifying the consolidation of days into weeks, weeks into months, months into quarters, and quarters into years.
Creating a hierarchy
You can create a hierarchy in any of the following ways: Open the Hierarchies tab in the property sheet of a dimension, and click the Add a Row tool. Open the Attributes tab in the property sheet of a dimension, and click the Create Hierarchy tool. Right-click a dimension in the Browser, and select New Hierarchy.
For general information about creating objects, see the Objects chapter
in the Core Features Guide .
Hierarchy properties
You can modify an objects properties from its property sheet. To open a hierarchy property sheet, double-click its Browser entry. The following sections detail the property sheet tabs that contain the properties most commonly entered for hierarchies. The General tab contains the following properties:
218
Property
Description
Name
Species the name of the item, which should be clear and meaningful, and should convey the items purpose to non-technical users Species the technical name of the object, which is used for generating code or scripts, which may be abbreviated, and should not generally include spaces Species a descriptive label for the hierarchy Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or user-dened Species the parent dimension of the hierarchy
Code
Comment Stereotype
Dimension
The following tabs are also available: Attributes - lists the attributes associated with the hierarchy (see Attributes (PDM) on page 211).
219
Associations (PDM)
Associations (PDM)
An association relates a cube (see Cubes (PDM) on page 198) to the dimension (see Dimensions (PDM) on page 209) that denes it. It shows the axis of investigation of the dimension in the cube. For example, the Sale cube is linked to the Time dimension by the Sale Time association to analyze sales through the time dimension.
Creating an association
You can create an association in any of the following ways: Use the Association tool in the diagram Palette. Select Model Associations to access the List of Associations, and click the Add a Row tool. Right-click the model or package in the Browser, and select New Association.
For general information about creating objects, see the Objects chapter
in the Core Features Guide .
Association properties
You can modify an objects properties from its property sheet. To open an association property sheet, double-click its diagram symbol or its Browser entry in the Associations folder. The General tab contains the following properties:
220
Property
Description
Cube
Species the cube origin of the association. You can click the Properties tool to view the properties of the currently selected object Species the destination dimension of the association. You can use the tools to the right of the list to create an object, browse the complete tree of available objects or view the properties of the currently selected object Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or userdened Species the hierarchy used by the cube for the consolidation calculation. You can click the Properties tool to view the properties of the currently selected object
Dimension
Stereotype
Hierarchy
221
CHAPTER 5
This chapter presents triggers and procedures used to generate database constraints.
Topic: Triggers (PDM) Trigger Templates (PDM) Trigger Template Items (PDM) Stored Procedures and Functions (PDM) Procedure Templates (PDM) SQL Code Denition Toolbars Creating SQL/XML Queries with the Wizard Generating Triggers and Procedures page 224 240 248 255 266 270 271 275
223
Triggers (PDM)
Triggers (PDM)
A trigger is a segment of SQL code associated with a table or a view, and stored in a database. It is invoked automatically whenever there is an attempt to modify data in the associated table with an insert, delete, or update command. Triggers enhance the security, efciency, and standardization of databases. You can use triggers to enforce referential integrity, where declarative constraints are not sufcient. You can also use triggers to implement sequences for columns.
Trigger templates and template items
A trigger template is a pre-dened form for creating triggers. PowerDesigner ships templates for each supported DBMS. Depending on the current DBMS, there are pre-dened templates for insert, update, and delete trigger types. A template item is a reusable block of SQL script that can implement referential integrity, or do any other work on database tables. PowerDesigner ships template items for each supported DBMS. A template item is inserted into a trigger template script, or a trigger script. The template item calls a corresponding SQL macro which can implement an insert, update, delete, or error message constraint on one or more tables in the database. You can use the PowerDesigner templates and template items, copy and edit them, or create your own from scratch. For more information, see Trigger Templates (PDM) on page 240.
tables. To verify this, double-click the table symbol to open its property sheet, and then click the Triggers tab. If the triggers are not present you will need to rebuild your triggers manually.
225
Triggers (PDM)
2. Click the Add a Row tool to create a new trigger, and type a name and code. 3. Click Apply to commit the creation of the new trigger, and then click the Properties tool to open its property sheet. 4. Click the Denition tab, and select a trigger template from the Template list. The time and event elds will be set and the template code copied into the denition box.
5. [optional] Modify the trigger denition code. You can add trigger template items, use PDM variables and macros and various other tools available from the toolbar (see SQL Code Denition Toolbars on page 270). If you edit the code, then the trigger will be marked as user-dened and will be excluded from most forms of rebuilding (see Rebuilding Triggers on page 229). 6. You can also modify the triggers other properties. For a full list of the properties available, see Trigger properties on page 228. 7. Click OK in each of the dialog boxes. Creating a trigger from scratch You can create a trigger without basing it on a template. However, we recommend that you use a template as this will simplify reuse of your code and make your triggers more portable.
226
O To create a trigger from scratch 1. Double-click a table symbol to open its property sheet, and then click the Triggers tab. 2. Click the Add a Row tool to create a new trigger, and type a name and code. 3. Click Apply to commit the creation of the new trigger, and then click the Properties tool to open its property sheet. 4. Click the Denition tab.
5. Enter the trigger denition code. You can add trigger template items, use PDM variables and macros and various other tools available from the toolbar (see SQL Code Denition Toolbars on page 270). The trigger will be marked as user-dened and will be excluded from most forms of rebuilding (see Rebuilding Triggers on page 229). 6. You can also modify the triggers other properties. For a full list of the properties available, see Trigger properties on page 228. 7. Click OK in each of the dialog boxes.
Editing triggers in Eclipse
When using the PowerDesigner Eclipse plug-in, you can right-click a trigger in the Browser and select Edit in SQL Editor from the contextual menu to open it in the Eclipse SQL Editor. You can optionally connect to your database in order to obtain auto-completion for table names. The trigger denition is added as a .SQL le to the Generated SQL Files list in the Workspace Navigator.
227
Triggers (PDM)
Trigger properties
You can modify an objects properties from its property sheet. To open a trigger property sheet, double-click its Browser entry in the Triggers folder. The following sections detail the property sheet tabs that contain the properties most commonly entered for triggers. The General tab contains the following properties:
Property Description
Name Code
The name of the item which should be clear and meaningful, and should convey the items purpose to non-technical users The technical name of the item used for generating code or scripts, which may be abbreviated, and should not generally include spaces Descriptive label for the trigger Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or userdened Name of trigger owner. You choose an owner from a list of users. A trigger can only have one owner at a time. This is normally the trigger creator Table attached to trigger Indicates to generate trigger [Read-only] Indicates that the trigger denition is modied by user. You modify a trigger denition when you change the trigger template script in the Denition tab of the trigger
Comment Stereotype
Owner
Trigger property sheet Denition tab The Denition tab allows you to enter code for the trigger. It contains the following properties:
228
Property
Description
Template User-dened
Template on which the trigger is based This button is automatically depressed when you modify the denition of a trigger, that is to say the trigger template code. You can click the User-Dened button to restore the trigger denition as it is provided in the template Time attribute of the template. The content of the list depends on the DBMS Event attribute of the template. The content of the list depends on the DBMS Firing order of trigger
You can customize the trigger time and event, and you can also handle multiple events on a single trigger. The time and event lists are lled with the values dened in the trigger template and the values dened in the Time and Event entries in the Trigger category of the DBMS editor. For example, if you dene Select as an event in the DBMS denition le, it will appear in the list of events. For more information about triggers with multiple event, see Dening triggers with multiple events on page 239. For information about the Denition tab toolbar, see SQL Code Denition Toolbars on page 270.
Trigger property sheet Preview tab The Preview tab displays the SQL code associated with the trigger. For more information, see Previewing SQL statements in the Working with Data Models chapter. Trigger property sheet Template Items tab The Template Items tab lists the trigger template items available for use in the trigger denition. For more information, see Trigger Template Items (PDM) on page 248.
Rebuilding Triggers
You rebuild triggers in order to ensure that: They are attached to all tables joined by a reference where referential integrity is implemented by a trigger 229
Triggers (PDM)
Any changes to a trigger template or trigger template item are cascaded down to all associated triggers PowerDesigner can rebuild triggers either: Automatically, whenever a relevant change is made, if you have enabled the Automatically rebuild triggers model option Manually, when you select Tools Rebuild Objects Rebuild Triggers The Rebuild Triggers function creates new triggers based on template items that correspond to trigger referential integrity dened for references and sequence implementation for columns. The Rebuild Triggers function does not use pre-dened template items which are not applicable to trigger referential integrity or sequence implementation.
Delete and Rebuild all triggers attached to templates are deleted and rebuilt, including those to which you have made modications Preserve only those triggers attached to templates that have not been modied are deleted and rebuilt. Any triggers that you have modied are preserved. 3. The Trigger selection box shows an expandable tree view of trigger types. There are three levels in this tree: All trigger types supported by the current DBMS All trigger templates corresponding to the trigger types All template items dened for each trigger template For example, in the list below, the two template items InsertChildParentExist and InsertTooManyChildren are used in the BeforeInsertTrigger template that is, in turn, used in all triggers with a time of Before and an event type of Insert:
You can select which trigger types, trigger templates, and template items will be rebuilt by expanding the appropriate nodes and selecting or clearing the check boxes as required. 4. [optional] Click the Error Messages tab to dene the types of error messages to generate. For more information about this tab, see the Creating and generating user-dened error messages on page 278 section.
231
Triggers (PDM)
5. [optional] Click the Selection tab. to specify which tables to rebuild the triggers for. 6. Click OK to begin the rebuild process. Progress is shown in the Output window. You can view the triggers that have been created from the Triggers tab of the table property sheet, or from the List of Triggers. Which Triggers are Rebuilt? Whether you use the automatic model option or rebuild triggers manually, all triggers that are based on a trigger template are rebuilt. These include: The default PowerDesigner triggers that are used to maintain referential integrity between tables Any other triggers that you have created via a user-dened trigger template
Triggers are rebuilt when a change in the DBMS family is made
If you change the target DBMS family, for example from Sybase to Oracle or IBM DB2, triggers are automatically rebuilt.
User-dened triggers
When a trigger based on a trigger template is modied, it becomes user-dened. The Rebuild Triggers function does not create a trigger corresponding to a trigger template attached to a user-dened trigger if you select the Preserve mode. If you wish to recreate a trigger based on the same trigger template you can: Click the User-dened button in the Denition tab of the trigger property sheet to reset your edits. This removes the changes performed on the trigger and reapplies the trigger template Select <None> in the trigger template list in the Denition tab of the trigger property sheet. This detaches the trigger template from the user-dened trigger. The next time you will rebuild triggers, a new trigger based on the previously mentioned trigger template will be created For example, Trigger1 is based on template TrigTpl1. You modify Trigger1 so PowerDesigner turns it into a user-dened trigger. If you want to recreate a trigger based on TrigTpl1 you can click the User-dened button in the Denition tab of the Trigger1 property sheet: you restore the trigger template code, but you lose the modications on the trigger. You can also keep the changes performed on the trigger by selecting <None> in the trigger template list in the Denition tab of the trigger property sheet. The
232
trigger template is detached from the trigger and a new trigger based on this trigger template will be created the next time you rebuild triggers.
Modifying Triggers
PowerDesigner provides various methods for editing a trigger. You can: Edit the code directly in the Denition tab of its property sheet. Attach a predened trigger template or create and attach your own reusable trigger templates Insert predened trigger template item code or create your own reusable trigger template items
Always work on a copy of your DBMS denition le
If you modify the denition of a DBMS trigger template or template item, you are modifying the DBMS denition le. We recommend that you only ever work on a copy of the original DBMS denition le. O To modify a trigger 1. Open the trigger property sheet in one of the following ways: Open the relevant table property sheet click the Triggers tab, select the trigger from the list, and then click the Properties tool Select Model Triggers Triggers to open the List of Triggers, select the trigger from the list, and then click the Properties tool In the Browser, nd the entry for the trigger, right-click it, and select Properties from the contextual menu 2. Click the Denition tab to display the trigger code.
233
Triggers (PDM)
3. Enter the trigger denition code. You can attach a trigger template, add template items, use PDM variables and macros and various other tools available from the toolbar (see SQL Code Denition Toolbars on page 270). The trigger will be marked as user-dened and will be excluded from most forms of rebuilding (see Rebuilding Triggers on page 229), if you select the Preserve mode. 4. You can also modify the triggers other properties. For a full list of the properties available, see Trigger properties on page 228. 5. Click OK in each of the dialog boxes. Inserting a template item into a trigger or trigger template Template items are inserted in a trigger or trigger template denition using a dot followed by the template item name. For example, the following script contains two template items InsertChildParentExist and
InsertTooManyChildren:
/* Before insert trigger "%TRIGGER%" for table "[%QUALIFIER%]%TABLE%" */ create trigger %TRIGGER% before insert order %ORDER% on [%QUALIFIER%]%TABLE% referencing new as new_ins for each row begin declare user_defined_exception exception for SQLSTATE 99999; declare found integer; .InsertChildParentExist .InsertTooManyChildren end /
O To add a template item to a trigger or trigger template 1. Open the property sheet of the trigger or trigger template that you want to modify, and then click the Denition tab. 2. Click at the point in the code where you want to insert the trigger template item, and then click one of the following tools: Add Trigger Item From DBMS to open a selection box containing a list of trigger template items dened in the DBMS denition le Add Trigger Item From Model to open a selection box containing a list of trigger template items dened in the model
234
3. Select the item to insert and then click OK to return to the denition tab. The trigger template item will be inserted in your code. It will also appear in the list on the Template Items tab.
Declaring a template item in a trigger denition Certain DBMS require that a cursor and variables are declared for each template item before the template item name is used in the script. This can be a statement that calls a corresponding procedure. You can use the following format to declare a template item: Decl template item name. 235
Triggers (PDM)
For example, the trigger denition for Oracle 8 contains the .DeclInsertChildParentExist statement which declares the following .InsertChildParentExist template item:
-Before insert trigger "[%QUALIFIER%]%TRIGGER%" for table "[%QUALIFIER%]%TABLE%" create trigger [%QUALIFIER%]%TRIGGER% before insert on [%QUALIFIER%]%TABLE% for each row declare integrity_error exception; errno integer; errmsg char(200); dummy integer; found boolean; .DeclInsertChildParentExist begin .InsertChildParentExist -- Errors handling exception when integrity_error then raise_application_error(errno, errmsg); end; /
236
pre-dened DBMS trigger templates from the Trigger Templates tab of the DBMS property sheet. O To change trigger naming conventions in a DBMS trigger template 1. Select Database Edit Current DBMS to open the DBMS denition le in the Resource Editor, and then click the Trigger Template tab. 2. Click a trigger template in the list, and then click the Properties tool to open its property sheet . 3. Type a new trigger name in the Trigger Name text box at the bottom of the tab. For example, mytempl_%TABLE% 4. Click OK in each of the dialog boxes.
Informix does not accept code in trigger templates. The template InsertTrigger calls the procedure in the form of the variable %PROC%, as follows:
-- Insert trigger "[%QUALIFIER%]%TRIGGER%" for table "[%QUALIFIER%]%TABLE%" create trigger [%QUALIFIER%]%TRIGGER% insert on [%QUALIFIER%]%TABLE% referencing new as new_ins for each row (execute procedure %PROC%(.FKCOLN("new_ ins.%COLUMN%", "", ",", "));") /
237
Triggers (PDM)
-- Insert procedure "%PROC%" for table "[%QUALIFIER%]%TABLE%" create procedure %PROC%(.FKCOLN("new_%.14L:COLUMN% %COLTYPE%", "", ",", ")") .DeclInsertChildParentExist .DeclInsertTooManyChildren define errno integer; define errmsg char(255); define numrows integer; .InsertChildParentExist .InsertTooManyChildren end procedure; /
Multiple triggers
Some DBMSs allow you to have multiple triggers of the same type (time and event) dened for any given table. Triggers of the same type are triggers that are invoked for the same insert, update, or delete event.
Example
A company is considering large numbers of candidates for new positions in various posts. You want to ensure that all new employees will have a salary that is within the range of others working in the same eld, and less than his or her prospective manager. On an EMPLOYEE table, you create two BeforeInsert triggers ,
tibTestSalry1_EMPLOYEE to verify that a proposed salary falls within the correct range, and tibTestSalry2_EMPLOYEE to verify that the
For a specied table, you can indicate the order that a trigger executes, or res, within a group of triggers of the same type.
238
O To indicate trigger order 1. Click the Denition tab from the trigger property sheet. 2. Select a number from the Order dropdown list box to indicates the position in the ring order that the trigger res. 3. Click OK in each of the dialog boxes.
239
All models sharing the DBMS Current model only Current model only
For more information on the DBMS share and copied denition les,
see the Generating a Database from a PDM chapter.
Modifying DBMS template items
By modifying a DBMS template item, you modify the template item denition in the current DBMS. You should only modify a DBMS that is a copy of the DBMS shipped with PowerDesigner.
For more information on working with DBMS resource les, see the
DBMS Resource File Reference chapter of the Customizing and Extending PowerDesigner manual.
240
or
To create a model trigger template: select Model Triggers Trigger Templates to open the List of User-Dened Trigger Templates:
241
2. Click on one of the following tools: Create from DBMS trigger template opens a selection box listing all the trigger templates available in the current DBMS. Select a check box for the type of trigger template that you want to use as the basis for your new template and click OK to return to the trigger template list. The duplicate DBMS template has been added to the list. Add a Row adds a new blank template to the list. 3. Type a new name and code for the new template and click Apply to commit its creation. 4. Click the Properties tool to open the property sheet of the new trigger template:
242
5. Click the Denition tab and enter or modify the denition code. You can add trigger template items, use PDM variables and macros and various other tools available from the toolbar. For more information, see SQL Code Denition Toolbars on page 270. 6. You can also modify other of the trigger templates properties. For a full list of the properties available, see Trigger template properties on page 245. 7. Click OK in each of the dialog boxes. If you have created DBMS trigger template, a conrmation box will appear, asking if you want to save the changes to the DBMS. Click Yes to conrm the template creation.
243
Template type
With insert Before insert After insert When called by InsertTrigger When called by BeforeInsertTrigger When called by AfterInsertTrigger
With update Before update After update When called by UpdateTrigger When called by BeforeUpdateTrigger When called by AfterUpdateTrigger
With delete Before delete After delete When called by DeleteTrigger When called by BeforeDeleteTrigger When called by AfterDeleteTrigger
244
O To modify a trigger template 1. Open the trigger template property sheet in one of the following ways: 2. To modify a DBMS trigger template: select Database Edit Current DBMS to open the DBMS denition le in the resource editor, and then click the Trigger Templates tab. 3. To modify a model trigger template: select Model Triggers Trigger Templates to open the List of User-Dened Trigger Templates. 4. Click a trigger template in the list, and then click the Properties tool to open its property sheet. 5. Click the Denition tab and modify the trigger denition code. You can add trigger template items, use PDM variables and macros and various other tools available from the toolbar. For more information, see SQL Code Denition Toolbars on page 270. 6. You can also modify other of the trigger templates properties. For a full list of the properties available, see Trigger template properties on page 245. 7. Click OK in each of the dialog boxes. If you have created DBMS trigger template, a conrmation box will appear, asking if you want to save the changes to the DBMS. Click Yes to conrm the template creation.
Name
The name of the item which should be clear and meaningful, and should convey the items purpose to non-technical users The technical name of the item used for generating code or scripts, which may be abbreviated, and should not generally include spaces Descriptive label for the trigger template
Code
Comment
245
Property
Description
Current DBMS Time attribute of the trigger template. The list displays the values dened in the trigger templates and template items of the current DBMS Event attribute of the trigger template. The list displays the values dened in the trigger templates and template items of the current DBMS Name of trigger associated with template For those DBMS that support view triggers, it allows you to dene if the trigger template applies to table or view triggers
Trigger event
Trigger template property sheet Denition tab The Denition tab contains a eld for entering its denition code. For information about editing this code, see Modifying Triggers on page 233. Trigger template property sheet Template Items tab The Template Items tab list the template items that are dened in the trigger template and that will be generated when a trigger is generated from the template. A template item that is deleted from the Template Items tab is not deleted from the trigger template denition. You can therefore limit the template items available for generation by removing template items from the Template Item tab, without having to remove them from the trigger template denition.
Rebuild triggers
When you use Rebuild Triggers to automatically create triggers for selected tables, the template items that are listed on this tab are those available for generation. Whether they are generated or not depends on the following: Template items are generated in a trigger if they match the trigger implemented referential integrity dened for a reference attached to the table Template items are generated in a trigger if they are user-dened, regardless of trigger referential integrity constraints
Adding template items to You can add any template item from the model or DBMS to the Trigger trigger template denition template denition by clicking an Add Trigger Item tool from the Denition
246
tab of the trigger template property sheet, and selecting a trigger item. It is automatically added to the Template Items tab.
247
A trigger template for Sybase Adaptive Server Anywhere 6 contains the .InsertChildParentExist template item, which corresponds to the following denition:
.FOREACH_PARENT() /* Parent "[%PQUALIFIER%]%PARENT%" must exist when inserting a child in "[%CQUALIFIER%]%CHILD%" */ if (.JOIN("new_ins.%FK% is not null", "", " and", ") then") begin set found = 0; select 1 into found from dummy where exists (select 1 from [%PQUALIFIER%]%PARENT% where .JOIN("%PK% = new_ins.%FK%", "and ", "", ");") if found <> 1 then message Error: Trigger(%TRIGGER%) of table [%QUALIFIER%]%TABLE%; message Parent code must exist when inserting a child!; signal user_defined_exception; end if; end end if; .ENDFOR
248
O To create a trigger template item 1. To create a DBMS trigger template item: select Database Edit Current DBMS to open the DBMS denition le in the resource editor, and then click the Trigger Template Items tab:
or
To create a model trigger template item: select Model Triggers Trigger Template Items to open the List of User-Dened Trigger Template Items:
2. Click on one of the following tools: Create from DBMS trigger item opens a selection box listing all the trigger template items available in the current DBMS. Select a 249
check box for the type of item that you want to use as the basis for your new item and click OK to return to the trigger template item list. The duplicate DBMS template item has been added to the list. Add a Row adds a new blank template item to the list. 3. Type a new name and code for the new template item and click Apply to commit its creation. 4. Click the Properties tool to open the property sheet of the new template item:
5. Click the Denition tab and enter or modify the denition code. You can use PDM variables and macros and various other tools available from the toolbar. For more information, see SQL Code Denition Toolbars on page 270. 6. You can also modify other of the trigger template items properties. For a full list of the properties available, see Trigger template properties on page 245. 7. Click OK in each of the dialog boxes. If you have created DBMS trigger template item, a conrmation box will appear, asking if you want to save the changes to the DBMS. Click Yes to conrm the template creation.
250
Template Items tab of trigger property sheet Template Items tab of trigger template property sheet
You can modify the code for these pre-dened template items, but they cannot be deleted or renamed. The PowerDesigner pre-dened template items that are available depend on the current DBMS.
Insert constraints
The template items below implement referential integrity in insert trigger templates.
Template item Integrity constraint Description
Mandatory parent
DeclInsertChildParentExist InsertChildParentExist
Parent must exist when inserting a child Cannot insert a child if maximum cardinality has been reached Select a value for the column from a list of sequences
DeclInsertTooManyChildren InsertTooManyChildren
Cannot exceed maximum cardinality constraint Select value in sequence list for column
DeclInsertSequenceColumn InsertSequenceColumn
251
Update constraints
The template items below implement referential integrity in update trigger templates.
Template item Integrity constraint Description
DeclUpdateChildParentExist UpdateChildParentExist
Mandatory parent
Parent must exist when updating a child Cannot modify parent code in child Cannot modify parent if child exists Modify parent code in all children Cannot modify column Set parent code to null in all children Set parent code to default in all children Cannot update a child if maximum cardinality has been reached
Change parent DeclUpdateChildChangeParent not allowed UpdateChildChangeParent DeclUpdateParentRestrict UpdateParentRestrict DeclUpdateParentCascade UpdateParentCascade DeclUpdateChangeColumn UpdateChangeColumn DeclUpdateParentSetNull UpdateParentSetNull DeclUpdateParentSetDefault UpdateParentSetDefault DeclUpdateTooManyChildren UpdateTooManyChildren Cannot exceed maximum cardinality constraint Restrict on update Cascade on update Non-modiable column Set null on update Set default on update
Delete constraints
The template items below implement referential integrity in delete trigger templates.
Template item Integrity constraint Description
DeclDeleteParentRestrict DeleteParentRestrict
Restrict on delete
252
Template item
Integrity constraint
Description
Delete parent code in all children Delete in parent sets child to null Delete in parent sets child to default
Constraint messages
You can insert the following template items in any trigger template. They generate error messages that indicate the violation of an integrity constraint.
Template item Description
UseErrorMsgText UseErrorMsgTable
Error handling without a message table Error handling with a message table
253
toolbar. For more information, see SQL Code Denition Toolbars on page 270. 6. You can also modify other of the trigger template items properties. For a full list of the properties available, see Trigger template properties on page 245. 7. Click OK in each of the dialog boxes. If you have created DBMS trigger template item, a conrmation box will appear, asking if you want to save the changes to the DBMS. Click Yes to conrm the template creation.
Name Code
The name of the item which should be clear and meaningful, and should convey the items purpose to non-technical users The technical name of the item used for generating code or scripts, which may be abbreviated, and should not generally include spaces Descriptive label for the template item Current DBMS
Comment DBMS
The following tabs are also available: Denition - allows you to enter the SQL code for the template item. For information about the tools available, see SQL Code Denition Toolbars on page 270. Declaration - contains the declaration for the template item in trigger scripts. For information about the tools available, see SQL Code Denition Toolbars on page 270.
254
For general information about creating objects, see the Objects chapter
in the Core Features Guide . You can create a procedure based on one of the PowerDesigner templates or on a template of your own. O To create a procedure 1. Double-click a table symbol to open its property sheet, and then click the Procedures tab. 2. Click the Add a Row tool to create a new procedure, and type a name and code.
255
3. Click Apply to commit the creation of the new procedure, and then click the Properties tool to open its property sheet. 4. Click the Denition tab:
5. [optional] Select a procedure template from the Template list (see Procedure Templates (PDM) on page 266). 6. Modify the procedure denition code. You can use PDM variables and macros and various other tools available from the toolbar (see SQL Code Denition Toolbars on page 270). 7. You can also modify the procedures other properties. For a full list of the properties available, see Procedure properties on page 256. 8. Click OK in each of the dialog boxes.
Editing procedures in Eclipse
When using the PowerDesigner Eclipse plug-in, you can right-click a procedure in the Browser or diagram and select Edit in SQL Editor from the contextual menu to open it in the Eclipse SQL Editor. You can optionally connect to your database in order to obtain auto-completion for table names. The procedure denition is added to the Generated SQL Files list in the Workspace Navigator.
Procedure properties
You can modify an objects properties from its property sheet. To open a procedure property sheet, double-click its diagram symbol or its Browser entry in the Procedures folder. The following sections detail the property sheet tabs that contain the properties most commonly entered for procedures. 256
Name
Species the name of the item which should be clear and meaningful, and should convey the items purpose to nontechnical users. Species the technical name of the item used for generating code or scripts, which may be abbreviated, and should not generally include spaces. Species a descriptive label for the procedure. Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or userdened. Species the name of the procedure owner. Species the table to which the procedure is attached. You can use the tools to the right of the list to create an object, browse the complete tree of available objects or view the properties of the currently selected object.
Code
Comment Stereotype
Owner Table
The following tabs are also available: Denition - allows you to enter the SQL code for the procedure. For information about the tools available, see SQL Code Denition Toolbars on page 270.
257
The Extended Dependencies tab of the trigger or procedure property sheet lists the objects upon which it depends. The stereotype <<DBCreateAfter (computed)>> species that PowerDesigner has determined that the trigger or procedure can only be created after these objects.
The Dependencies tab of the Employee table property sheet shows that ProcChangeLocation is dependent upon it.
258
If you were to perform an impact analysis prior to deleting the Employee table, you would be warned of the dependency of the procedure upon it.
259
Creating procedure dependencies manually Since procedures have diagram symbols, you can manually add dependencies for them. To do this, use the Link/Extended Dependency tool in the palette. In the diagram below, I have added a dependency from ProcChangeLocation to a new procedure, ProcOccupancy:
260
Since ProcOccupancy is not directly referenced in ProcChangeLocation, I needed to manually add the stereotype <<DBCreateAfter>> to the dependency in the ProcChangeLocation property sheet Extended Dependencies tab:
Rebuilding trigger and procedure dependencies Trigger and procedure dependencies are rebuilt automatically after the following actions:
261
Importing a PDM created with a former version of PowerDesigner Reverse engineering a database into a PDM Merging PDMs You can also manually rebuild trigger and procedure dependencies at any time. O To rebuild trigger and procedure dependencies 1. Select Tools Rebuild Objects Rebuild Triggers and Procedures Dependencies to open the Procedures Dependencies window. 2. Specify a rebuild mode for each of Procedures and Triggers. You can choose between the following options: Delete and Rebuild all triggers and/or procedures attached to templates are deleted and rebuilt, including those to which you have made modications Preserve only those triggers and/or procedures attached to templates that have not been modied are deleted and rebuilt. Any triggers and/or procedures that you have modied are preserved.
3. [optional] Click the Selection tab and specify the tables, views, procedures, and (for Oracle only) database packages for which you want to rebuild dependencies. By default all are selected. 4. Click OK to begin the rebuild process. 262
When you generate an OOM from a PDM, the procedures attached to a table become operations with the <<procedure>> stereotype in the generated class. By attaching procedures to tables, you are able to dene class operations in the generated OOM. When you generate a PDM from an OOM, class operations with the <<procedure>> stereotype become stored procedures attached to the generated table. The operation body is generated as a comment in the procedure denition. You can attach a table to a procedure from the property sheet of a procedure or the property sheet of a table. O To attach a stored procedure to a table 1. Open the table property sheet and click the Procedures. 2. Click the Add Objects tool to open a selection box, choose the the stored procedure you want to attach to the table and click OK. The stored procedure is displayed in the list of stored procedures.
263
3. Click OK. Rebuilding procedures attached to tables You can rebuild procedures attached to tables at any time.
264
O To rebuild procedures attached to tables manually 1. Select Tools Rebuild Objects Rebuild Table Stored Procedures to open the Rebuild Table Stored Procedures window.
2. Specify a rebuild mode. You can choose between the following options: Delete and Rebuild all procedures attached to tables are deleted and rebuilt Add missing table stored procedures adds procedures to any selected tables that do not presently have them. 3. [optional] Click the Selection tab to specify for which tables you want to rebuild stored procedures. 4. Click OK to begin the rebuild process.
265
For more information on the DBMS share and copied denition les,
see the Generating a Database from a PDM chapter.
Modifying DBMS template items
By modifying a DBMS template, you modify its denition in the current DBMS. You should only modify a DBMS if you have already made a copy of the DBMS denition le provided with PowerDesigner.
For more information on working with DBMS resource les, see the
DBMS Resource File Reference chapter of the Customizing and Extending PowerDesigner manual.
266
O To create a procedure template 1. Select Database Edit Current DBMS to open the DBMS denition le in the resource editor, and then click the Procedure Templates tab:
2. Click the Add a Row tool to add a new blank template to the list. 3. Type a new name and code for the new template and click Apply to commit its creation. 4. Click the Properties tool to open the property sheet of the new procedure template:
5. Click the Denition tab and enter or modify the denition code. You can
267
use PDM variables and macros and various other tools available from the toolbar (see SQL Code Denition Toolbars on page 270). 6. You can also modify other of the procedure templates properties. For a full list of the properties available, see Procedure template properties on page 269. 7. Click OK in each of the dialog boxes. A conrmation box will appear, asking if you want to save the changes to the DBMS. Click Yes to conrm the template creation.
a SQL Delete statement a SQL Insert statement a SQL Select statement a SQL Update statement
the toolbar. For more information, see SQL Code Denition Toolbars on page 270. 4. You can also modify other of the procedure templates properties. For a full list of the properties available, see Procedure template properties on page 269. 5. Click OK in each of the dialog boxes. A conrmation box will appear, asking if you want to save the changes to the DBMS. Click Yes to conrm the template creation.
Name
The name of the item which should be clear and meaningful, and should convey the items purpose to non-technical users. The technical name of the item used for generating code or scripts, which may be abbreviated, and should not generally include spaces. Descriptive label for the procedure template. Current DBMS. Species whether the template denes procedures or functions. Species the format of the resulting procedure names. Species whether the resulting procedure will be linked to a table.
Code
The following tabs are also available: Denition - contains a eld for entering its denition code. For information about editing this code, see Modifying a procedure template on page 268.
269
Add Trigger Item From Model - [Triggers and trigger templates only] Opens a dialog box to select a trigger template item dened in the model for insertion in the trigger denition. Add Trigger Item From DBMS - [Triggers and trigger templates only] Opens a dialog box to select a trigger template item dened in the DBMS denition le for insertion in the trigger denition. Operators - Lists logical operators for insertion in the trigger denition. Functions - Lists group, number, string, date, conversion and other functions for insertion in the trigger denition. Macros - Lists macros for insertion in the trigger denition. For more information on macros, see the Writing SQL Statements in PowerDesigner appendix. Variables - Lists variables for use with operators and functions for insertion in the trigger denition. You can also use formatting variables that have a syntax that can force a format on their values, as follows: Force values to lower-case or upper-case characters Truncate the length of values For more information on variables, see PDM variables in the Writing SQL Statements in PowerDesigner chapter. Edit with SQL Editor - Opens the SQL Editor dialog box. Provides object types and available objects for insertion in the trigger denition. SQL/XML Wizard - Opens the SQL/XML Wizard to build a SQL/XML query from a table or a view and insert it in the trigger denition (see Creating SQL/XML Queries with the Wizard on page 271). Insert SQL/XML Macro - Opens a dialog box to select a global element in an XML model open in the workspace with the SQL/XML extended model denition. Inserts a SQL/XML macro referencing the selected element in the trigger denition.
270
2. Click the SQL/XML Wizard tool to launch the wizard at the Tables and Views Selection page:
271
3. Select the tables and views that you want to include in your query and click Next to go to the XML Hierarchy Design page:
On this tab, you construct the XML hierarchy that you want to generate: The left-hand pane lists the tables and views that you have selected
272
The right-hand pane displays the XML hierarchy to be generated, containing a default root element. 4. You can build your XML hierarchy using the following techniques: Specify whether columns will be generated as elements or attributes by using the radio buttons above the panes. Drag and drop a table, view, or column onto a node in the XML hierarchy. You must respect the PDM hierarchy: You cannot create an XML hierarchy between two elements if there is no reference between their corresponding tables, and a parent table cannot be placed beneath one of its children. Right-click a table, view, or column and select Add from the contextual menu to add it to the last selected node in the XML hierarchy. Rename an element or attribute by clicking its node and typing a new name. Create new elements and attributes not in the PDM, and Sequence, Choice and All group particles, by right-clicking an XML node and selecting New object from the contextual menu. Delete an XML node by right-clicking it and selecting Delete from the contextual menu. 5. When you have nished building your hierarchy, click Next to go to the Query tab:
6. Review your query and click Back, if necessary, to make revisions in your hierarchy. When you are satised, click Finish to close the wizard and insert the SQL/XML query in the trigger denition 273
274
275
The procedure from which you start the extended dependency is the dependent procedure and the procedure at the other end of the link is the inuent procedure. The inuent procedure will be generated before the dependent procedure.
Circular extended dependencies
If you create a reexive and/or circular set of extended dependencies with the <<DBCreateAfter>> stereotype, an error message is displayed during the check model. If you choose to ignore this error, the stored procedures will be generated in alphabetical order, without taking into account the generation order, which could cause errors in the creation of stored procedures in the database. A publisher may decide to sell certain books at a reduced rate (15%) when a customers order is above 10 000$. In this model, one stored procedure GENERAL CHECK globally veries orders: check books availability, check the order amount, check if discount rate is calculated, and applies discount rate to order bill. During the execution of this stored procedure, the procedure DISCOUNT CALC is called to calculate the 15% discount rate. It is important to generate GENERAL CHECK before DISCOUNT CALC; you can dene an extended dependency to set the generation order between these two objects. To do so, you have to open the property sheet of the dependent stored procedure, click the Extended Dependencies tab and create an extended dependency with the <<DBCreateAfter>> stereotype with the inuent stored procedure.
Example
276
O To dene a generation order for stored procedures 1. Select Model Procedures to display the List of Stored Procedures. 2. Select a dependent stored procedure in the list and click the Properties tool. The property sheet of the stored procedure is displayed. 3. Click the Extended Dependencies tab to display the Extended Dependencies tab. 4. Click the Add Objects tool. 5. Select the Procedure tab in the Add Object selection dialog box. 6. Select the inuent stored procedure check box and click OK. 7. Select the <<DBCreateAfter>> stereotype in the Stereotype list. 8. Click OK. The inuent stored procedure is displayed in the Inuent Object column of the list of extended dependencies of the dependent stored procedure.
277
Number of the error message that is referenced in the trigger script Text of message
2. Generate the table in your database. 3. Select Database Execute SQL. A dialog box asks you to identify a data source and connection parameters. 4. Select a data source and ll in connection parameters. 5. Click Connect. An SQL query editor box is displayed. 6. Type an SQL statement to insert a message number and text in the appropriate columns. You can use the following format for example: insert into table values (error number,error message) insert into ERR_MSG values (1004,The value that you are
trying to insert does not exist in the referenced table)
278
7. Click Execute. A message box tells you that the command has been successfully executed. 8. Click OK. You return to the SQL query box. 9. Click Close. Generating a user-dened error message You can choose to generate a user-dened error message from the trigger generation parameters box. O To generate a user-dened error message 1. Select Tools Rebuild Objects Rebuild Triggers. The Rebuild Triggers dialog box is displayed. 2. Click the Error Messages tab. The Error Messages tab is displayed. 3. Select the User-dened radio button. 4. Type the name of the table that contains the error message in the Message Table Name box. 5. Type the name of the column that contains the error number in the Message Number box. 6. Type the name of the column that contains the error message text in the Message Text column. Below is an example of the details for a table called ERR_MSG.
279
7. Click the General tab and select the mode and triggers to create. 8. Click the Selection tab and select the tables for which you want to create triggers.
For more information on rebuilding triggers, see section Rebuilding Triggers on page 229.
9. Click OK. The trigger rebuilding process is shown in the Output window. Select Database Generate Database to open the Database Generation window. 10. Select generation parameters as required. 11. Click OK.
280
CHAPTER 6
This chapter explains how to manage access to the database using privileges and permissions, and dening users, groups, roles, and object synonyms.
Topic: Introducing database access Users (PDM) Roles (PDM) Groups (PDM) Synonyms (PDM) page 282 283 298 300 302
281
During reverse engineering by script, the permission and privilege grant orders are reverse engineered only if the user, group, or role already exist in the model or, in the case of a new model, if the user, group, or role creation orders are in the same script. These restrictions do not apply to reverse engineering from a live database connection.
282
Users (PDM)
A user is a database object that identies a person who can login or connect to the database. Users may have: a role that species their responsibilities (see Roles (PDM) on page 298) membership in a group that species their rights (see Groups (PDM) on page 300) privileges that control their level of access (see Granting system privileges on page 286) permissions that allow them to perform actions on objects (see Granting object permissions on page 290)
Note
Not all DBMSs support the concepts of user, role and group.
Creating a user
You can create a user in any of the following ways: Select Model Users and Roles Users to access the List of Users, and click the Add a Row tool. Right-click the model or package in the Browser, and select New User.
For general information about creating objects, see the Objects Core Features Guide . User properties
You can modify an objects properties from its property sheet. To open a user property sheet, double-click its Browser entry in the Users folder. The following sections detail the property sheet tabs that contain the properties most commonly entered for users. The General tab contains the following properties:
283
Users (PDM)
Property
Description
Name of the user Code of the user used as identier in the database Descriptive label for the user Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or userdened Password that may be used for database connection
Password
The following tabs are also available: Privileges - lists the system privileges granted to the user (see Granting system privileges on page 286). Permissions - lists the operations that the user is permitted to perform on various database objects (see Granting object permissions on page 290).
284
O To attach an object to a user 1. Open the property sheet of the object. 2. Select a user in the Owner list. You can create a new user by clicking the ellipsis button to the right of the Owner list.
3. Click OK. Specifying default owners for object types You can specify a default owner for each type of object that supports the concept of ownership. The default owner will automatically be linked to all the objects of this type that you create after making this change. O To specify a default owner for tables 1. Select Tools Model Options and then select Table and View in the left-hand pane. 2. Select a user in the Default owner list in the Table groupbox. You can create a new user by clicking the ellipsis button to the right of the Default owner list. 3. Click OK.
285
Users (PDM)
For more information, see Setting PDM Model Options in the Customizing the PDM Environment chapter.
In some DBMS, system privileges are called permissions. In this manual, the term privilege is used for any right granted to a user, a group, or a role. Permissions are dened for objects.
System privileges vary according to the DBMS you are using. The list of privileges also includes predened roles (like connect, or resource) for an easier use. System privileges are granted to a user. A user with administrative prole is also allowed to revoke a privilege in order to prevent a user from performing certain actions over the database content. The list of predened system privileges allowed in the current DBMS is available in the System entry under Script\Object\Privileges in the DBMS resource le. The Privileges category also contains entries used to provide the syntax for the different order corresponding to the DBMS privileges. Granting system privileges to a user, role, or group The procedure for dening privileges is identical for users, groups, and roles.
Adding a system privilege
You can add a system privilege to the list of available privileges from the DBMS editor. To do so, select Database Edit Current DBMS, expand categories Script\Objects\Privileges and type each new system privilege on a new line at the end of the list of privileges in the Value box
Inherited privileges
By default, a user belonging to a group or having a role inherits the group or role privileges. Inherited privileges appear in the Privileges tab of the user property sheet.
286
When you select specic privileges for the user, the list of privileges displays the user privilege above the group privilege. The following table summarizes the different privilege combinations:
Privilege combination Description
O To grant system privileges to a user, role, or group 1. Open the property sheet of a user, role, or group, and click the Privileges tab. 2. Click the Add Objects tool to open a selection box listing all the privileges available in the DBMS.
3. Select one or more privileges and click OK to add them to the list of privileges of the user, role, or group. By default, privileges are granted.
287
Users (PDM)
In the example below, the privileges in red are granted to the group to which the user belongs.
4. [optional] To change the state of a privilege, click in the State column until the desired state is displayed, or select one of the Privilege state tools at the bottom of the tab: Grant [default] Assigns the privilege to the user. Grant with admin option - Assigns the privilege to the user, and allows the recipient to pass on the privilege to other users; groups, or roles. For example, you assign the CREATE TABLE privilege for user Designer_1 and then click the Grant With Admin Option button to permit Designer_1 to grant this privilege to other users. Revoke Revokes the privilege inherited from a group or role for the current user or group. This option is only available when the user has inherited a privilege from a group or a role. None - Cancels any state and cleans up the current cell.
288
5. Click OK. Generating privileges You can generate privileges to a script or to a live database connection. O To generate privileges 1. Select Database Generate Database to open the Database Generation window, and specify the standard options, including whether you want to generate to a script or to a live database connection.
Users (PDM)
3. [optional] Click the Selection tab and select the Users sub-tab at the bottom of the tab. Select the users that you want to generate for. 4. Click OK to begin the generation.
To observe information contained in object To insert rows into object To alter table with ALTER TABLE command To delete rows from object To create indexes in tables and foreign key referencing tables To update row in object To create an index with the CREATE INDEX command To execute procedure or function
The owner of an object (see Assigning an owner to an object on page 284) automatically has permission to carry out any operation on that object. These permissions do not appear in the Permissions tab of the object property sheet but they are implemented during generation and reverse engineering.
Granting permissions to a user, role, or group The procedure for dening privileges is identical for users, groups, and roles.
Inherited permissions
A user belonging to a group or having a role with permissions inherits these permissions. You can display or hide users with inherited permissions using the following tools in the upper part of the Permissions tab:
290
Tool
Action
When you select specic permissions for the user, the list of permissions displays the user permission above the group permission. The following table summarizes the different permission combinations:
Permission combination Description
Permission granted to group and overloaded by with admin option Permission granted to group and revoked with cascade to user
O To grant permissions to a user, role, or group 1. Open the property sheet of a user, role, or group, and click the Permissions tab. The columns in the list show the permissions available for a given type of object in the current DBMS. A sub-tab is displayed for each type of object supporting permissions in the current DBMS. 2. Click the Add Objects tool to open a selection box listing all the objects of the present type in the model. 3. Select one or more objects and click OK to add them to the list of permissions of the user, role, or group. If the current user belongs to a group with permissions on the selected objects, these permissions appear in red in the list.
291
Users (PDM)
4. [optional] To change the state of a permission, click in the appropriate column until the desired state is displayed, or select one of the Permission state tools at the bottom of the tab: Grant Assigns the permission to the user. Grant with admin option - Assigns the permission to the user, and allows the recipient to pass on the permission to other users; groups, or roles. Revoke Revokes the permission inherited from a group or role for the current user or group. This option is only available when the user has inherited a permission from a group or a role. Revoke with cascade Revokes the permission inherited from a group or role for the current user or group and revokes any permission granted by the user. None - Cancels any state and cleans up the current cell.
292
5. [optional] For tables, you can specify permissions on individual columns (see Dening column permissions on page 295). 6. Click OK. Granting permissions for an object from its property sheet You can also grant permissions for an object directly in its property sheet. O To dene permissions from the object property sheet 1. Open the property sheet of the object and click the Permissions tab. The columns in the list show the permissions available for the object in the current DBMS. Sub-tabs allow you to grant permissions to Users, Roles, and Groups. 2. Click the Add Objects tool to open a selection box listing all the users (or roles or groups) in the model. 3. Select one or more users and click OK to add them to the list of users with permissions on the object. If the user belongs to a group with permissions on the object, these permissions appear in red in the list.
293
Users (PDM)
4. [optional] To change the state of a permission, click in the appropriate column until the desired state is displayed, or select one of the Permission state tools at the bottom of the tab:
294
5. [optional] For tables, you can specify permissions on individual columns (see Dening column permissions on page 295). 6. Click OK. Dening column permissions You can ne tune the permissions on a table by specifying permissions on a column-by-column basis. The available column permissions are specied in the DBMS resource le. Note that any new or modied permission may not be supported during generation or reverse-engineering.
295
Users (PDM)
O To dene column permissions 1. Open the property sheet of a table, click the Permissions tab, and select a user, group or role:
2. Click the Ellipsis button beside the Columns box to open the Column Permissions dialog box. The columns in the list show the permissions available for each of the tables columns.
296
3. Click inside a column cell until the desired state is displayed, or select one of the Permission state tools at the bottom of the tab. 4. Click OK to close the Column Permissions dialog box and return to the property sheet. The cells corresponding to selected column permissions contain ellipsis symbols. Click on one of these symbols to display the associated column permissions information in the Columns box.
5. Click OK.
297
Roles (PDM)
Roles (PDM)
A role is a predened prole that can be assigned to users, or roles in those DBMS that support this concept. Roles are reverse engineered in your model and you can also create user-dened roles. Roles may have: privileges that control their level of access (see Granting system privileges on page 286) permissions that allow them to perform actions on objects (see Granting object permissions on page 290)
Creating a role
You can create a role in any of the following ways: Select Model Users and Roles Roles to access the List of Roles, and click the Add a Row tool. Right-click the model or package in the Browser, and select New Role.
For general information about creating objects, see the Objects Core
Features Guide .
Role properties
You can modify an objects properties from its property sheet. To open a role property sheet, double-click its Browser entry in the Roles folder. The following sections detail the property sheet tabs that contain the properties most commonly entered for roles. The General tab contains the following properties:
Property Description
Name of the role Code of the role used as identier in the database Descriptive label for the role Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or userdened
The following tabs are also available: Privileges - lists the system privileges granted to the role (see Granting system privileges on page 286). 298
Permissions - lists the operations that the role is permitted to perform on various database objects (see Granting object permissions on page 290).
5. Click OK.
299
Groups (PDM)
Groups (PDM)
Groups are used to facilitate the granting of privileges and permissions to users. They prevent the time-consuming and error-prone process of assigning privileges and permissions individually to each user. Groups may have: privileges that control their level of access (see Granting system privileges on page 286) permissions that allow them to perform actions on objects (see Granting object permissions on page 290)
Creating a group
You can create a group in any of the following ways: Select Model Users and Roles Groups to access the List of Groups, and click the Add a Row tool. Right-click the model or package in the Browser, and select New Group.
For general information about creating objects, see the Objects Core
Features Guide .
Group properties
You can modify an objects properties from its property sheet. To open a group property sheet, double-click its Browser entry in the Groups folder. The following sections detail the property sheet tabs that contain the properties most commonly entered for groups. The General tab contains the following properties:
Property Description
Name of the group Code of the group used as identier in the database Descriptive label for the group Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or userdened Password that may be used for database connection
Password
300
The following tabs are also available: Privileges - lists the system privileges granted to the group (see Granting system privileges on page 286). Permissions - lists the operations that the group is permitted to perform on various database objects (see Granting object permissions on page 290).
Synonyms (PDM)
Synonyms (PDM)
A synonym is an alternative name for various types of objects (table, view, sequence, procedure, function, synonym or database package). Synonyms are created to: Mask the name and owner of an object Provide location transparency for remote objects of a distributed database Simplify SQL statements for database users
Example
For example, table SALES_DATA is owned by user JWARD. A standard select statement on this table would be:
SELECT * FROM jward.sales_data
The database administrator can create a synonym for this table and owner and call it SALES. In this case, the SQL statement is simplied in the following way:
SELECT * FROM sales
In PowerDesigner synonyms are created for base objects. The base object is the object used to create a synonym. Base objects support multiple synonyms while each synonym must have only one base object. You can view the synonyms depending on a base object in the Dependencies tab of the base object property sheet. If you delete the base object of a synonym, the synonym is deleted as well.
Creating a synonym
You can create a synonym as follows:
302
O To create a synonym 1. Select Model Synonyms to open the List of Synonyms. 2. Click the Create Synonyms tool to open a selection box listing all the available objects in the model on various sub-tabs.
3. Select one or more objects and click OK. Synonyms for each of the selected objects are created in the List of Synonyms. By default, a synonym has the same name as its base object. If the Base Object column is not shown in the list, click the Customize Columns and Filter tool, select Base Object in the list of available columns, and click OK.
303
Synonyms (PDM)
4. Click in the Name column of one of the rows and enter a new name for the synonym. Alternatively, you can click the Properties tool to open the property sheet of the synonym and edit its name and other properties there.
For general information about creating objects, see the Objects Core
Features Guide .
Synonym properties
You can modify an objects properties from its property sheet. To open a synonym property sheet, double-click its Browser entry in the Synonyms folder. The General tab contains the following properties:
Property Description
Name of the synonym (usually corresponding to a simplied name of the base object) Code of the synonym Additional information about the synonym
304
Property
Description
Stereotype
Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or userdened Name of the synonym owner. You choose an owner from a list of users. A synonym can only have one owner at a time Name of the object origin of the synonym. The Ellipsis button displays a selection dialog box that lets you select objects among all the models opened in the current workspace and belonging to the same DBMS family as the current DBMS Allows to dene a synonym as public (accessible to all database users) or private (available to a specic user) For those DBMS that support it (for example DB2) you can create an alias instead of a synonym. In PowerDesigner synonyms and aliases are managed in the same way whereas their behavior in the database may be different
Visibility Type
For more information on aliases, see the DB2 documentation. Creating a view for a synonym
You can create views for synonyms in the same way as you create views for tables. The view query displays the content of the object used for the synonym. For example, the ORDERS_PROD_DEPT table has a synonym ORDERS:
If you create a view for the ORDERS synonym, the view query displays the select order of the table content:
305
Synonyms (PDM)
O To create a view from a synonym 1. Ensure that no objects are selected in the diagram and select Tools Create View to open a selection box listing all the available objects in the model. 2. Click the Synonyms tab and select one or more synonyms to add to the view. 3. Click OK. The view is created in the diagram.
For more information about creating views, see Views (PDM) in the
Building Physical Diagrams chapter.
Generating synonyms
You can generate synonyms from the Database Generation dialog box. For more information, see Generating a Database section in the Generating a Database from a PDM chapter.
For more information about reverse engineering, see the Reverse Engineering a Database into a PDM chapter.
307
CHAPTER 7
This chapter describes how to create, generate and reverse engineer web services in the following databases: Sybase Adaptive Server Anywhere 9 and over Sybase Adaptive Server Enterprise 15 and over Sybase IQ12.6 and over IBM DB2 v8.1 and over
Contents
Topic: Introducing Web Services Web Services (PDM) Web Operations (PDM) Web Parameters (PDM) Testing Web Services Generating Web Services Reverse Engineering Web Services
309
Web services are made of a set of operations. Each operation contains a SQL query for retrieving data from a database. 310
This structure is compatible with the denition of web services in the supported databases.
Import Web service as service provider
You can import a web service as a service provider into a Business Process Model (BPM) to dene the links between a concrete implementation of service interfaces and operations and their abstract denition.
specic name identifying the query (e.g. Customer/List, Customer/Name). In that case, the name of the table is called the local path (which is dened on the General tab of the web service property sheet). PowerDesigner treats HTTP web operations which share a local path as belonging to the web service with that local path name. [ASA and IQ only] A web service invoked in a SOAP request can have a SOAP or a DISH type. PowerDesigner treats SOAP web services for these databases as web operations belonging to a DISH web service.
Implementation (SQL statement)
When you create a web service, you must type a SQL statement to select which data you want to retrieve from the database in the Implementation tab of the property sheet of its web operation(s). For DISH web services, SQL statements are dened in the SOAP web services bearing their prex name.
For general information about creating objects, see the Objects Core
Features Guide .
312
Name
Name of the web service. Used in URIs to access the web service. It can neither start with a slash nor contain two consecutive slashes Code of the web service Descriptive label for the web service Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or user-dened Name prexing the web service. If you type a path, the User-Dened tool (beside the Local path box) is pushed-in. Click the User-Dened tool to recover the original path. The default value is the name of the web service
Local path
313
Property
Description
Service type
[ASA, ASE, and IQ only] Species the type of web service. You can choose from: DISH - [ASA and IQ only] acts as a proxy for a group of SOAP services and generates a WSDL (Web Services Description Language) le for each of its SOAP services. When you create a DISH service, you must specify a prex name (on the Extended Attributes tab) for all the SOAP services to which the DISH service applies. PowerDesigner treats SOAP web services as Web operations (see Web Operations (PDM) on page 316) of DISH web services. HTML [ASA and IQ only] the result of the SQL statement or procedure is formatted as an HTML document (with a table containing rows and columns). RAW - the result of the SQL statement or procedure is sent without any additional formatting. SOAP - [ASE only] generates a WSDL (Web Services Description Language) le. XML - the result of the SQL statement or procedure is sent in XML. By default, the result is converted into XML RAW format.
Web service property sheet Operations tab This tab lists the web operations associated with the web service (see Web Operations (PDM) on page 316). Web service property sheet Sybase tab Only available with ASA, ASE, and IQ. This tab displays the following properties:
314
Property
Description
Port number Server name Name prex (dish services only) Database name
Species the port number for the test URL. Species the server name for the test URL. [ASA and IQ only] Species the name prex for DISH services. [ASE only] Species the database name for the test URL.
Web service property sheet Security tab Only available with ASA and IQ. This tab displays the following properties:
Property Description
If selected, only HTTPS connections are accepted. If cleared, both HTTP and HTTPS connections are accepted If selected, all users must provide a name and a password. When cleared, a single user must be identied When authorization is required, you can select <None> or a list of user names. When authorization is not required, you must select a user name. Default value is <None>, which means all users are granted access
Web service property sheet Namespaces tab Only available with IBM DB2. This tab displays a list of namespaces with their prex, URI and comment. An XML Schema can be specied where elements and data types used in web parameters and result columns are dened.
315
For general information about creating objects, see the Objects Core
Features Guide .
Name
Name of the web operation. In URIs, it comes after the name of the web service followed by a slash. It can neither start with a slash nor contain two consecutive slashes Code of the web operation Descriptive label for the web operation Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or userdened Code of the web service containing the web operation. You can click the Properties tool (beside the web Service box) to display the web service property sheet [ASE 15 only] Species the owner of the operation.
316
Property
Description
Operation Type
[IBM DB2 only] Species the type of operation. You can choose from the following: call - invokes a stored procedure with parameters and result columns for the web operation query - retrieves relational data using the SQL select statement in the Implementation tab retrieveXML - retrieves an XML document from relational data. The mapping of relational data to XML data is dened by a DAD le with SQL or RDB as MappingType storeXML - stores an XML document as relational data. The mapping of XML data to relational data is dened by a DAD le, with RDB as MappingType update - executes the SQL update statement with optional parameters. Parameters can be created from the Parameters tab in the web operation property sheet
Web operation property sheet Parameters tab This tab lists the web parameters associated with the web operation. These parameters are part of the SQL statement dened on the Implementation tab. They can be created on this tab, before generating a web service, or reverse engineered from a web service (ASA, ASE, and IQ only). You can use the following tools to add parameters on this tab:
Tool Name Description
Add a Row
Insert a Row
Inserts a parameter above the current line in the list. [ASA, ASE, and IQ only] Display the parameters resulting from the reverse engineering of the web service .
Web operation property sheet Implementation tab This tab displays the SQL statement for the web service. You can use the following tools to type the SQL statement:
317
Tool
Name
Description
Operators
Functions
Provides group, number, string, date, conversion and other functions Provides macros to accelerate the creation of a SQL statement Provides variables for use with operators and functions Opens the SQL Editor dialog box. Provides object types and available objects to insert in the SQL statement Opens the SQL/XML Wizard to build a SQL/XML query from a table or a view, and insert it in the SQL statement Opens a dialog box to select a global element in an XML model open in the workspace with the SQL/XML extended model denition. Inserts a SQLXML macro referencing the selected element in the SQL statement
Macros
Variables
For example:
318
Web operation property sheet Result Columns tab This tab lists the result columns associated with the web operation (see Web Operation Result Columns on page 320). You can use the following tools to add result columns on this tab:
Tool Name Description
Add a Row
Insert a Row
Inserts a result column above the current line in the list. Display the result columns resulting from the execution of the SQL statement in the database.
Web operation property sheet Security tab Only available with ASA, and IQ. This tab displays the following properties:
Property Description
If selected, only HTTPS connections are accepted. If cleared, both HTTP and HTTPS connections are accepted If selected, all users must provide a name and a password. When cleared, a single user must be identied When authorization is required, you can select <None> or a list of user names. When authorization is not required, you must select a user name. Default value is <None>, which means all users are granted access
Web operation property sheet Sybase tab Only available with ASE. This tab displays the following properties:
319
Property
Description
Alias Secure
Species the user-dened database alias. Species the form of security. You can choose between: Clear Use standard HTTP SSL Use HTTPS
Name of the result column Code of the result column Descriptive label for the result column [IBM DB2 only] Select an XML schema data type from the list, or click the Select Object tool to open a selection dialog box where you select a global element in an XML model open in the workspace [IBM DB2 only] Checked and greyed when a global element is attached to a result column
Is element
320
For general information about creating objects, see the Objects Core Features Guide . Web parameter properties
You can modify an objects properties from its property sheet. To open a web parameter property sheet, double-click its Browser entry in the Parameters folder beneath its parent web operation. The General tab contains the following properties:
Property Description
Name of the web parameter. Code of the web parameter. Descriptive label for the web parameter. Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or userdened. Name of the web operation containing the web parameter. Select in if you want the web parameter to be an input parameter. Select in/out if you want the web parameter to be both an input and output parameter. Select out if you want the web parameter to be an output parameter.
321
Property
Description
[ASE only] Species a default value for the parameter. [For IBM DB2] Select an XML schema data type from the list, or click the Select Object tool to open a selection dialog box where you select a global element in an XML model open in the workspace. [For ASE] Select a datatype from the list.
Is element
[IBM DB2 only] Checked and greyed when a global element is attached to a web parameter.
322
323
324
2. Click the Import an Extended Model Denition tool to open the Extended Model Denition Selection dialog box, select DADX in the list of extended model denitions and click OK. DADX is displayed in the List of Extended Model Denitions. 3. Click OK to return to the main window. 4. Select Tools Extended Generation to open the Generation dialog box with DADX selected in the Targets tab.
5. Click the Select a Path button, to the right of the Directory box, and specify a path for the DADX les. 6. Click the Selection tab, and select the web services for which you want to generate a DADX le.
325
7. Click OK to begin generation. When generation is complete, the Result dialog box will be displayed with the paths of the DADX les.
8. Select the path of a DADX le and click Edit. The DADX le is displayed in the editor window.
326
9. Click Close in the Result dialog box. You can now use the DADX les for SOAP requests in IBM DB2 UDB web services Object Runtime Framework (WORF).
327
Database PowerDesigner
Customers/Name Customers
HTML HTML
Name
Database HTTP web services without a common local path are grouped as PowerDesigner web operations of an HTTP web service named raw, xml or html:
Software Web service name Type Web operation name
Database PowerDesigner
Customers html
HTML HTML
Customers
Database SOAP web services with a prex name are considered as PowerDesigner web operations of a DISH web service with the prex name:
328
Software
Type
Database PowerDesigner
SOAP DISH
Name
Database SOAP web services without a prex name are considered as PowerDesigner web operations of a DISH web service without a prex name:
Software Web service name Type Web operation name
Database PowerDesigner
Customers WEBSERVICE_1
SOAP DISH
Customers
Database DISH web services with or without a prex name are considered identically in PowerDesigner:
Software Web service name Type Web operation name
Database PowerDesigner
DISH DISH
329
CHAPTER 8
331
332
The options on this tab affect all the objects in the model, including those already created, while changes to the object-specic options on the sub-category tabs only affect objects created subsequently. You can set the following options on this tab:
Option Description
Species that the names and codes for all objects are case sensitive, allowing you to have two objects with identical names or codes but different cases in the same model. If you change case sensitivity during the design process, we recommend that you check your model (Tools Check Model) to verify that your model does not contain any duplicate objects.
Displays a Requirements tab in the property sheet of every object in the model, which allows you to attach requirements to objects in your model. These attached requirements are kept synchronized with your requirements model. For more information, see the Requirements Modeling guide.
Enforce nondivergence
Enforces non-divergence between a domain denition and the attributes using the domain. You can select any or all of the following attribute properties: Data type - Data type, length, and precision Check - Check parameters, such as minimum and maximum Rules - Business rules Mandatory - Attribute mandatory property When you apply these options, you are asked if you want to apply domain properties to attributes currently attached to the domain. If you click OK, the attribute properties are modied for consistency with the domain. When you modify the properties of a domain, the properties of the attributes attached to it are updated provided they are selected here. When you select an attribute property under Enforce nondivergence, that property cannot be modied in the lists of attributes and the property sheets of attributes. If you want to modify an attribute property that is dened as non-divergent, you must detach the attribute from its domain, or clear the appropriate Enforce non-divergence model option.
333
Option
Description
Species that the complete data type is displayed in entity symbols. Species a default data type to apply to domains and attributes if none is selected for them. You can choose between the following notations: Entity / Relationship [Default used throughout this manual] Entity/relationship notation connects entities with links representing one of four relationships between them. These relationships have properties that apply to both entities involved in the relationship Merise - uses associations instead of relationships E/R + Merise - both entity/relationship and Merise are used in the same model IDEF1X - data modeling notation for relationships and entities. In this notation, each set of relationship symbols describes a combination of the optionality and cardinality of the entity next to it Barker inheritances are represented by placing the child entities inside the parent entity symbol, and relationships are drawn in two parts, each reecting the multiplicity of the associated entity role. For more information about these notations, see Supported CDM/LDM notations on page 361
Requires that data items or relationships have unique codes [LDM only] Allows n-n relationships to be displayed.
334
Option
Description
Allow reuse
Allows the reuse of one data item as an attribute for more than one entity provided the attributes have same name and data type and do not belong to a primary key. When deselected or when the attribute belongs to a primary key, the data item cannot be reused. In this case, if the Unique code check box is selected, a new data item with identical name but different code is created, otherwise a new data item with identical name and code is created. When you delete an entity or entity attributes, these options determine whether or not the corresponding data items are also deleted, as follows: Both deletes the entity attribute. Unique Code only deletes the entity attribute. Allow Reuse only deletes the entity attribute and the corresponding data item (if it is not used by another entity). None deletes the entity attribute and the corresponding data item.
Setting Migration Settings (LDM only) To set migration settings, select Tools Model Options, and select the Migration settings sub-category in the left-hand Category pane.
Option Description
Enables the domain, the checks or the rules to be kept when an attribute is migrated.
335
Option
Description
Species the naming convention for migrated foreign identiers. You can select one of the default templates from the list or enter your own using the following variables: %PARENT% - Name/Code of the parent entity %ATTRIBUTE% - Name/Code of the parent attribute %IDENTIFIER% - Name/Code of the identier constraint attached to the relationship %RELATIONSHIP% - Name/Code of the relationship %PARENTROLE% - Role of the entity that generated the parent entity, this variable proceeds from the conceptual environment. If no role is dened on the relationship, %PARENTROLE% takes the content of %PARENT% to avoid generating an attribute with no name The following example checks the %PARENTROLE% value; if it is equal to the parent name (which is the replacement value) then the template %.3:PARENT%_%ATTRIBUTE% will be used, otherwise template %PARENTROLE% will be used because the user has entered a parent role for the relationship: Note that customized naming templates reappear in the generation dialog box the next time you open it, but are not saved to the list of predened templates.
Use template
Controls when the primary identier attribute name template will be used. You can choose between the following radio buttons: Always use template. Only use template in case of conict.
These options are available for relationships and automatic for inheritances, except the Only use template in case of conict option, which is always triggered.
336
Setting Model Settings To set Model Settings, select Tools Model Options or right-click the diagram background and select Model Options from the contextual menu.
The options on this tab affect all the objects in the model, including those already created, while changes to the object-specic options on the sub-category tabs only affect objects created subsequently. You can set the following options on this tab:
Option Function
Species that the names and codes for all objects are case sensitive, allowing you to have two objects with identical names or codes but different cases in the same model. If you change case sensitivity during the design process, we recommend that you check your model (Tools Check Model) to verify that your model does not contain any duplicate objects.
337
Option
Function
Displays a Requirements tab in the property sheet of every object in the model, which allows you to attach requirements to objects in your model. These attached requirements are kept synchronized with your requirements model. For more information about requirements, see the Requirements Modeling guide.
Notation
Species the use of one of the following notation types for the model. You can choose between: Relational - Arrow pointing to primary key. This option is the default, and is used in this manual.
IDEF1X - Cardinality and mandatory status displayed on reference, primary columns in separate containers and dependent tables with rounded rectangles.
When you change notation, all symbols in all diagrams are updated accordingly. If you switch from Merise to IDEF1X, all associations are converted to relationships.
Table and view model options To set model options for tables and views, select Tools Model Options, and select the Table & View sub-category in the left-hand Category pane.
338
339
Species a default owner for the tables in your model from the list of users (see the section Creating a user in the Managing Database Users chapter). To create a User, click on the ellipsis button to open the List of Users, and click the Add a Row tool. If the user specied is subsequently deleted, this option (and the ownership of all associated objects) will be reset to none.
Species a default owner for the views in your model from the list of users (see the section Creating a user in the Managing Database Users chapter). To create a User, click on the ellipsis button to open the List of Users, and click the Add a Row tool. If the user specied is subsequently deleted, this option (and the ownership of all associated objects) will be reset to none.
Species that the owner of a table or view is ignored for identication purposes. Since, by default, both the name/code and the owner are considered during a uniqueness check, this option enables you to enforce distinct names for these objects. For example, if a model contains a table called Table_1, which belongs to User_1, and another table, also called Table_1, which belongs to User_2, it will, by default, pass a uniqueness check because of the different owners.
Column and domain model options To set model options for columns and domains, select Tools Model Options, and select the Column & Domain sub-category in the left-hand Category pane.
340
Enforce nondivergence Default data type Column: Mandatory by default Domain: Mandatory by default
Species that columns attached to a domain must remain synchronized with the selected properties, any or all of: Data type, Check, Rules, Mandatory, and Prole. Species a default data type to be applied to columns and domains. Species that columns are created, by default, as mandatory. Species that domains are created, by default, as mandatory.
Reference model options To set model options for references, select Tools Model Options, and select the Reference sub-category in the left-hand Category pane.
341
Unique code
Requires that references have unique codes. If this option is not selected then different references can have the same code (except when two references share the same child table). Enables the reuse of columns in a child table as foreign key columns if the following conditions are satised: Child column has same code as migrating primary key column Child column is not already a foreign key column Data types are compatible For more information, see Automatic reuse and migration of columns in the Building Physical Diagrams chapter.
Auto-reuse columns
342
Option
Function
Auto-migrate columns
Enables the automatic migration of primary key columns from the parent table as foreign key columns to the child table. If you select both Auto-migrate columns and any of the following sub-options, then the relevant column property of the PK will also be migrated to the FK at reference creation: Domain Check Rules Last position For more information, see Automatic reuse and migration of columns in the Building Physical Diagrams chapter.
Mandatory parent
Species that the relationship between child and parent tables is, by default, mandatory, i.e., each foreign key value in the child table must have a corresponding key value, in the parent table. Species that a foreign key value can change to select another value in the referenced key in the parent table. Species that referential integrity is checked only on commit, rather than immediately after row insertion. This feature can be useful when working with circular dependencies. Not available with all DBMSs. Propagates changes made to the name, code, stereotype, or data type of a parent table column to the corresponding child column. Species how reference links are created. You can select either: Primary key automatically create links from primary key to foreign key columns at creation User-dened manually create your own links
343
Option
Function
Default implementation
Species how referential integrity is implemented in the reference. You can select either: Declarative referential integrity is dened by constraint in foreign declarations Trigger referential integrity is implemented by triggers For more information on referential integrity, see Reference property sheet Integrity tab in the Building Physical Diagrams chapter.
Controls how updating a key value in the parent table will, by default, affect the foreign key value in the child table. Depending on your DBMS, you can choose from some or all of the following settings: None no effect Restrict cannot update parent value if one or more matching child values exist (no effect) Cascade - update matching child values Set null - set matching child values to NULL Set default set matching child values to default value
Controls how deleting a key value in the parent table will, by default, affect the foreign key value in the child table. Depending on your DBMS, you can choose from some or all of the following settings: None no effect Restrict cannot delete parent value if one or more matching child values exist (no effect) Cascade - delete matching child values Set null - set matching child values to NULL Set default set matching child values to default value
Sequence model options To set model options for sequences, select Tools Model Options, and select the Sequence sub-category in the left-hand Category pane.
344
Default Owner
Species a default owner for the sequences in your model from the list of users (see the section Creating a user in the Managing Database Users chapter). To create a User, click on the ellipsis button to open the List of Users, and click the Add a Row tool. If the user specied is subsequently deleted, this option (and the ownership of all associated objects) will be reset to none.
Index model options To set model options for indexes, select Tools Model Options, and select the Index sub-category in the left-hand Category pane. You can set the following options on this tab:
Option Function
Species a default owner for the table indexes in your model from the list of users (see the section Creating a user in the Managing Database Users chapter). To create a User, click on the ellipsis button to open the List of Users, and click the Add a Row tool. If no default user is specied here, then the owner of the parent table is used by default. If the user specied is subsequently deleted, this option (and the ownership of all associated objects) will be reset to none.
Species a default owner for the view indexes in your model from the list of users (see the section Creating a user in the Managing Database Users chapter). To create a User, click on the ellipsis button to open the List of Users, and click the Add a Row tool. If no default user is specied here, then the owner of the parent view is used by default. If the user specied is subsequently deleted, this option (and the ownership of all associated objects) will be reset to none.
Join index model options To set model options for join indexes, select Tools Model Options, and select the Join Index sub-category in the left-hand Category pane.
345
Default owner
Species a default owner for the join indexes in your model from the list of users (see the section Creating a user in the Managing Database Users chapter). To create a User, click on the ellipsis button to open the List of Users, and click the Add a Row tool. If the user specied is subsequently deleted, this option (and the ownership of all associated objects) will be reset to none.
Procedure model options To set model options for procedures, select Tools Model Options, and select the Procedure sub-category in the left-hand Category pane. You can set the following options on this tab:
Option Function
Default owner
Species a default owner for the procedures in your model from the list of users (see the section Creating a user in the Managing Database Users chapter). To create a User, click on the ellipsis button to open the List of Users, and click the Add a Row tool. If the user specied is subsequently deleted, this option (and the ownership of all associated objects) will be reset to none.
Trigger model options To set model options for triggers, select Tools Model Options, and select the Trigger sub-category in the left-hand Category pane. You can set the following options on this tab:
346
Option
Function
Option
Function
Species a default owner for the table triggers in your model from the list of users (see the section Creating a user in the Managing Database Users chapter). To create a User, click on the ellipsis button to open the List of Users, and click the Add a Row tool. If no default user is specied here, then the owner of the parent table is used by default. If the user specied is subsequently deleted, this option (and the ownership of all associated objects) will be reset to none.
Species a default owner for the view triggers in your model from the list of users (see the section Creating a user in the Managing Database Users chapter). To create a User, click on the ellipsis button to open the List of Users, and click the Add a Row tool. If no default user is specied here, then the owner of the parent view is used by default. If the user specied is subsequently deleted, this option (and the ownership of all associated objects) will be reset to none.
Automatically rebuilds the triggers on the child and parent tables of a reference when you: change the implementation of a reference change the referential integrity rules of a reference implemented by a trigger change the child or parent table of a reference implemented by a trigger (new and old) create or delete a reference implemented by a trigger change the maximum cardinality of the references Note: If this option is not selected, you can manually instruct PowerDesigner to rebuild triggers at any time by selecting Tools Rebuild Objects Rebuild Triggers.
Database package model options To set model options for database packages, select Tools Model Options, and select the Database Package sub-category in the left-hand Category pane.
347
Default owner
Species a default owner for the database packages in your model from the list of users (see the section Creating a user in the Managing Database Users chapter). To create a User, click on the ellipsis button to open the List of Users, and click the Add a Row tool. If the user specied is subsequently deleted, this option (and the ownership of all associated objects) will be reset to none.
For information about changing the format of symbols, see Format display preferences in the Customizing your Modeling Environment chapter of the Core Features Guide . The following sections list the options available to customize the information displayed on a data model object symbols. Note that the objects available to be customized in the Display Preferences
348
Click the Default button to display default display preferences. Click the Set As Default button to set current display preferences as default selections. Association display preferences (CDM) To set display preferences for associations in a CDM, select Tools Display Preferences, and select the Association sub-category in the left-hand Category pane.
Association
Preference Display description
Displays the name of the association. Controls the maximum number of attributes displayed in symbol. Displays the stereotype of the association. Displays the comment of the association. When selected, all other check boxes are deselected, except for Stereotype.
Display description
Displays the data types of association attributes. Displays the domains of association attributes. You can only display domains when the Data types check box is selected. Displays the domain of association attributes. For details of how this and the Data types preferences interact, see Entity display preferences (CDM/LDM) on page 351. Displays the letter M beside mandatory association attributes. Displays the stereotype of association attributes.
Mandatory Stereotype
Association display preferences (PDM) To set display preferences for associations in a PDM, select Tools Display Preferences, and select the Association sub-category in the left-hand 349
Category pane.
Preference Description
Displays the name of the association. Displays the name of the hierarchy used to compute the cube Displays the stereotype of the association.
Association Link display preferences (CDM) To set display preferences for association links, select Tools Display Preferences, and select the Association Link sub-category in the left-hand Category pane.
Preference Description
Displays the role of the association link Displays the cardinality of the association link Displays the stereotype of the association link
Cube display preferences (PDM) To set display preferences for cubes, select Tools Display Preferences, and select the Cube sub-category in the left-hand Category pane.
Preference Description
Displays fact measures. When selected, you can additionally specify whether to display all fact measures, or to limit them to a given number. Displays cube facts. Displays the stereotype of the cub. You can also display the stereotype of the cube measures and facts.
Dimension display preferences (PDM) To set display preferences for dimensions, select Tools Display Preferences, and select the Dimension sub-category in the left-hand Category pane.
350
Preference
Description
Attributes
Displays the dimension attributes. When selected, you can additionally specify whether to display all attributes, or to limit them to a given number. Displays dimension hierarchies. When selected, you can also specify whether to display <Default> beside the default hierarchy in dimension symbols. Displays the stereotypes of dimensions. You can also display the stereotype of the dimension attributes and hierarchies.
Hierarchies
Indicators of Hierarchy
Displays the hierarchies indicators of dimension attributes. When selected, you can also specify whether to display the hierarchy level of dimension attributes.
Entity display preferences (CDM/LDM) To set display preferences for entities, select Tools Display Preferences, and select the Entity sub-category in the left-hand Category pane.
Entity
351
Preference
Display description
Attributes
Species whether Attributes are displayed on entity symbols. If selected, you can choose between displaying: All attributes - All attributes:
Display limit - Number of attributes shown depends on dened value. For example, if set to 5:
Identiers
All identier attributes for the entity are listed at the bottom of the entity symbol:
Stereotype Comment
Stereotype of the entity. Comment of the entity. When selected, all other check boxes are deselected, except for Stereotype:
Entity attributes
352
Preference
Display description
Data types
Data
type
for
each
entity
attribute:
Domain for each entity attribute. You can only display domains when the Data type check box is selected. Domain of an attribute in an entity. This display option interacts with the selection for Data types. As a result, there are four display options: Data types - Displays only the data type, if any:
Data types and Domain - Displays both data type and domain, if any:
Data types and Replace by domains - Displays either data type or domain, if any, and domain if both are present:
Mandatory
attribute:
353
Preference
Display description
Identier indicators
<pi> indicators are displayed next to primary identiers and <ai> indicators next to non-primary
identiers:
Stereotype
Entity identiers
Preference Display description
Stereotype
Inheritance display preferences (CDM/LDM) To set display preferences for inheritances, select Tools Display Preferences, and select the Inheritance sub-category in the left-hand Category pane.
Preference Description
Name Stereotype
Displays the name of the inheritance Displays the stereotype of the inheritance
Package display preferences (CDM/LDM/PDM) To set display preferences for packages, select Tools Display Preferences, and select the Package sub-category in the left-hand Category pane.
Preference Description
Stereotype Comment
Displays the stereotype of the package Displays the comment of the package
Procedure display preferences (PDM) To set display preferences for procedures, select Tools Display Preferences, and select the Procedure sub-category in the left-hand Category pane. 354
Preference
Description
Owner Stereotype
Reference display preferences (PDM) To set display preferences for dimensions, select Tools Display Preferences, and select the Reference sub-category in the left-hand Category pane.
Preference Description
Displays the name or code of the reference depending on whether the Name or Code radio button is selected Displays the referential integrity constraint name Displays the statement of linked columns between the two tables Displays the update and delete referential integrity constraints as follows: upd() - Update del() - Delete cpa - Change Parent Allowed A letter between the parentheses indicates the type of constraint, as follows: ( ) - None (R) - Restrict (C) - Cascade (N) - Set null (D) - Set default The referential integrity label shown below indicates the following: Cascade on update Set null on delete Cardinality is 0..n (any number of children is acceptable).
355
Preference
Description
Displays the stereotypes of references Displays the role names for parent and child tables of references Displays the minimum and maximum number of instances in a child table that can appear for each corresponding instance in the parent table. The default cardinality labels for PowerDesigner indicate the minimum and maximum number of children as follows: [minimum ..maximum ] For example, the cardinality label [0..n] indicates that any number of children is acceptable.
Implementation
When a reference symbol displays text, the text position is based on the position of handles. You can add a handle on the reference symbol by pressing CTRL while you click the symbol. Relationship display preferences (CDM/LDM) To set display preferences for relationships, select Tools Display Preferences, and select the Relationship sub-category in the left-hand Category pane.
356
Preference
Display description
Displays the name of the relationship* Displays the role of each direction in the relationship [LDM only] Displays the statement of linked attributes between the two entities Displays the minimum and maximum number of instances that the rst entity can have relative to the second entity Displays the letter D on the dominant entity side of the relationship Displays the stereotype of the relationship
Table display preferences (PDM) To set display preferences for tables, select Tools Display Preferences, and select the Table sub-category in the left-hand Category pane.
Preference Description
Columns
Displays table columns. When selected, you can choose between displaying all columns, only primary key columns, only key columns, or limit the number of columns displayed to a given number. Displays all indexes dened for table columns Displays all keys dened on table Displays all triggers dened for table Displays name of table owner Displays stereotype of the table. You can also display the stereotype of columns, keys, indexes, and triggers Displays comment of the table. When selected, all other check boxes are deselected, except for Stereotype
You can display information about columns in each table. Keys and indexes are represented by indicators in the table symbol. Each key and index indicator is assigned a number. You can use these numbers to keep track of the different groups of alternate keys, foreign keys, and indexes in your model. You can display the following column information in a table symbol:
357
Preference
Displays
Example
Data types
Domain codes for each column attached to a domain Domain of an attribute in the table. This display option interacts with the selection for Data types. As a result, there are four display options See Display domain and data type for options and examples
Key Indicators
<pk>, <fk>, and <ak> indicators next to primary key, foreign key, and alternate key columns respectively. When the Keys preference is also selected, the key names are listed at the bottom of the table symbol
Index indicators
<i(n )> indicator next to indexed columns. When the Indexes preference is also selected, the index names and corresponding numbers are listed at the bottom of the table symbol
NULL/NOT NULL
358
You can display foreign key numbers next to their corresponding foreign key names on the references links between the appropriate parent and child tables.
You can display the domain of an attribute in the symbol of a table. There are four display options available:
Preference Displays Example
Data types
Domains
Both data type and domain, if they exist If domain exists and data type does not exist, then displays domain. If domain does not exist and data type exists, then displays data type.
Default options
Click the Default button to display default table display preferences. Click the Set As Default button to set current display preferences as default selections.
Table notation
For information about changing the notation of tables, see Setting Model Settings on page 337.
View display preferences (PDM) To set display preferences for views, select Tools Display Preferences, and select the View sub-category in the left-hand Category pane.
359
Preference
Description
Columns
Displays the columns in the view. When selected, you can choose between displaying all the columns, or to limit them to a given number. Displays the tables in the view. For those DBMS that support query tables, displays the indexes in the views of type materialized view, summary table or snapshot. Displays the names of view owners. Displays the stereotypes of views. Displays the comments associated with views. When selected, all other check boxes except for Stereotype are deselected.
Tables Indexes
Displays the view column names. Displays the SQL expressions for view columns. Displays the data type for view columns. For those DBMS that support query tables, displays the indicator next to indexed columns.
View reference display preferences (PDM) To set display preferences for views, select Tools Display Preferences, and select the View reference sub-category in the left-hand Category pane.
Preference Description
Displays the name or code of view references. Displays the statement of linked columns between the two tables or views. Displays the stereotype of view references Displays the role names for parent and child tables or views of view references.
360
In the Entity/relationship notation, entities are represented as rectangles and divided in three compartments: name, attributes, and identiers.
361
Inheritance symbols indicate if they are complete and if they have mutually exclusive children:
Complete Mutually exclusive Symbol
No
No
Yes
No
No
Yes
Yes
Yes
IDEF1X notation
In the Idef1x notation, entity names are displayed outside the symbol, and dependent entities are drawn with round corners.
362
Yes
No
Barker notation
In the Barker notation, entities are drawn with round corners, and inheritances are displayed by placing children inside the parent entity.
363
Only attributes are listed and a symbol species whether each attribute is a key, a mandatory or an optional attribute as follows:
For more information on the DBMS denition le, see the DBMS
Resource File Reference chapter in the Customizing and Extending PowerDesigner manual.
Not certied resource le
Some resource les are delivered with Not Certied in their names. Sybase will perform all possible validation checks, however Sybase does not maintain specic environments to fully certify these resource les. Sybase will support the denition by accepting bug reports and will provide xes as per standard policy, with the exception that there will be no nal environmental validation of the x. Users are invited to assist Sybase by testing xes of the denition provided by Sybase and report any continuing inconsistencies.
364
Changing the target DBMS When you create a PDM, you select a target DBMS (see Creating a PDM in the Building Physical Diagrams chapter). You can change the DBMS of a model at any time. You may be required to change the DBMS if you open a PDM and the associated DBMS le has been deprecated, or is otherwise unavailable. In this case the Choose DBMS dialog box will open, inviting you to select a DBMS from the list. If you change the target DBMS, the model may be altered to conform with the new DBMS as follows: All data types specied in your model will be converted to their equivalents in the new DBMS. For more information about data types, see Script/Data Type Category in the DBMS Resource File Reference chapter of the Customizing and Extending PowerDesigner manual. Any objects not supported by the new DBMS will be deleted Certain objects, whose behavior is heavily DBMS-dependent may lose their values. You can choose to preserve the values associated with the following database objects, if they are supported by the new DBMS: Triggers and stored procedures note that triggers are always rebuilt when you change DBMS. Physical options - if the syntax of an option is incompatible with the new DBMS, the values will be lost, even if you have selected to preserve the physical option. For example, the physical option in used by ASA is not supported by Oracle and any values associated with that option will be lost. Database objects: databases, storages, tablespaces, abstract data types, sequences Extended attributes
365
O To change the target database for a PDM 1. Select Database Change Current DBMS to open the Change the Target DBMS dialog box:
2. Select a target DBMS from the list. 3. Select one of the following radio buttons: Share the DBMS denition use the original DBMS le in the Resource Files\DBMS directory. Any changes made to the DBMS are shared by all linked PDMs. Copy the DBMS denition in model make a copy of the original DBMS le in the Resource Files\DBMS directory. The current DBMS is independent of the original DBMS, so modications made to the DBMS in the DBMS directory are not available to the PDM. The copied object language is saved with the PDM and cannot be used without it. For more information on DBMS properties and customizing a DBMS, see the DBMS Resource File Reference chapter in the Customizing and Extending PowerDesigner manual. 4. [optional] Click the DBMS Preserve Options tab, which displays options for database objects that can be preserved or lost when the target DBMS is changed:
366
5. Select check boxes for the objects and options that you want to preserve.
Preserve options selected by default
If you are changing target database within a database family, for example between Sybase ASE 12.5 and 15, all preserve options available are selected by default. The database objects not supported by the old and new target databases are disabled. 6. Click OK. A message box opens to tell you that the target database has been changed. 7. Click OK to return to the model with the new DBMS.
367
Share
Current extended model denition constantly refers to the extended model denition stored in the Resource Files\Extended Model Denitions directory. Any changes made to the extended model denition are shared by all linked XEM Current extended model denition is a unique copy of the extended model denition stored in the Resource Files\Extended Model Denitions directory. The current extended model denition is independent of the original one, so modications made to the extended model denition in the Resource Files\Extended Model Denitions directory are not available to the copied XEM. This one is saved with the PDM and cannot be used without it
Copy
Model Denitions in the Resource Files and the Public Metamodel chapter of the Customizing and Extending PowerDesigner manual.
369
X X X
X X X
X X X
O To generate a model from a CDM, LDM, or PDM 1. Select Tools, and then one of the following to open the appropriate Model Generation Options Window: Generate Conceptual Data Model. . . Ctrl+Shift+C Generate Logical Data Model. . . Ctrl+Shift+L Generate Physical Data Model. . . Ctrl+Shift+P Generate Object-Oriented Model. . . Ctrl+Shift+O Generate XML Model. . . Ctrl+Shift+M 2. On the General tab, select a radio button to generate a new or update an existing model, and complete the appropriate options. 3. [optional PDM-PDM generation only] Click the DBMS Preserve Options tab and set any appropriate options. 4. [optional] Click the Detail tab and set any appropriate options. We recommend that you select the Check model checkbox to check the model for errors and warnings before generation. 5. [optional] Click the Target Models tab and specify the target models for any generated shortcuts. 6. [optional] Click the Selection tab and select or deselect objects to generate. 7. Click OK to begin generation.
Generation options
For detailed information about the options available on the various tabs of the Generation window, see the Linking and Synchronizing Models chapter of the Core Features Guide . 370
Class Attribute -
Table Table column Primary or foreign key depending on independent or dependent relationship Alternate key Reference
Persistent entities (OOM) All entities are generated as persistent classes with the Generate table
persistence mode. When the Generate check box of an entity is not selected, the generated class has the Migrate columns persistence mode.
Changing the name of a column automatically
Two columns in the same table cannot have the same name. If column names conict due to foreign key migration, PowerDesigner automatically renames the migrated columns. The new name is composed of the rst three letters of the original entity name followed by the code of the attribute. Generating PDM table keys from CDM entity identiers The type of key that is generated in the PDM depends on the cardinality and type of dependency dened for a relationship in the CDM. Primary identiers generate primary and foreign keys. Other identiers that are not primary identiers generate alternate keys: A primary key is a column or columns whose values uniquely identify a row in a table. 371
A foreign key is a column or columns that depend on and migrate from a primary key column in another table. An alternate key is a column or columns whose values uniquely identify a row in a table, and is not a primary key.
Independent one-to-many relationships
In independent one-to-many relationships, the primary identier of the entity on the one side of the relationship is generated as a: Primary key in the table generated by the entity on the one side of the relationship Foreign key in the table generated by the entity on the many side of the relationship The following CDM shows an independent relationship. Each division contains one or more employees:
Table
Primary key
Foreign key
Division number
In dependent relationships, the primary identier of the nondependent entity is generated as a primary/foreign key in the table generated by the dependent entity. The migrated column is integrated into the primary key if it already exists. The following CDM shows a dependent relationship. Each task must have a project number.
372
Table
Primary key
Foreign key
Project number
In independent many-to-many relationships, the primary identiers of both entities migrate to a join table as primary/foreign keys. The CDM below shows an independent relationship. Each employee can be a member of one or more teams, and each team can have one or more employees as members.
Table
Primary key
Foreign key
In independent one-to-one relationships, the primary identier of one entity migrates to the other generated table as a foreign key.
Generating tables from entities with inheritance links Two properties inuence the generation of tables from entities with inheritance links.
373
Object
Property
Entity Inheritance
Table for the entity (parent or child) Parent and/or children as indicated
Domain Table Table column Primary key Alternate key Foreign key StoredProcedures View View column
374
PDM
CDM
LDM
OOM
XSM
Relationship
Association
If the code of the generated XML model objects does not correspond to the target language naming conventions, you can dene a code naming convention script to convert object names into codes. For more information on conversion scripts, see .convert_name & .convert_code macros in the Models chapter.
XML Specics
Generation of column as attribute or element is controlled by generation option Foreign keys - When a foreign key is not a composition, it is generated as a KeyRef constraint
When a CDM is generated from a PDM, the data type of a table column attached to a sequence is translated to a serial data type in the new model. The resulting CDM serial data type for an entity property has the format NO%n, where %n is a number indicating the length of the data type.
All tables are generated as persistent classes with the Generate table persistence mode. All abstract data types are generated as persistent classes with the Generate ADT persistence mode. Table - Class. The cardinality of a class is translated from the number of estimated records in a table Table with migrated keys from only two other tables - Class linked with an association class between the two classes generated by the two parent tables Stored-Procedures and stored functions attached to selected table - If the parent table is generated as a class, the stored procedure or the stored function is generated as an operation attached to the class
375
If the code of the generated OOM objects does not correspond to the target language naming conventions, you can dene a code naming convention script to convert object names into codes. For more information on conversion scripts, see .convert_name & .convert_code macros in the Models chapter. Conguring the generated model options When you congure the options of a CDM to generate, you may dene options diverging from the PDM options. To avoid conicts, PowerDesigner applies the following rule for default values of CDM options: an option dened for the generated CDM should respect the equivalent option of the PDM. Equivalent Enforce non-divergence model options are available in both the PDM and CDM.
PDM option CDM option Result in generated CDM
Enforce nondivergence
Enforce non-divergence in model according to PDM options. Data items and attributes attached to the domain cannot have divergent denitions Enforce non-divergence in model according to CDM options dened using the Congure Model Options feature
Enforce nondivergence
(CDM) Unique Code for relationships is not selected by default in the CDM options. However, if you select Unique Code for relationships in the CDM options, relationships are renamed during the generation of a PDM to a CDM. Options with no equivalent, like Enforce Prole in the PDM without any corresponding option in a CDM, are generated using default values found in the registry.
(OOM) Options with no equivalent, like Enforce Prole in the PDM without any corresponding option in an OOM, are generated using default values found in the registry.
Generating an XSM from a PDM via the XML Builder Wizard The XML Builder Wizard helps you build an XML model (XSM) that will be used to generate SQL/XML queries for retrieving data from databases. It
376
is more powerful than the standard PDM-XSM generation, as it helps you to customize the XML hierarchy to be built, and sets up the XSM to retrieve data from relational databases supporting SQL/XML, and for generation of an annotated schema (see the Working with XML and Databases chapter in the XML Modeling guide). O To generate an XSM from a PDM via the XML Builder Wizard 1. In your PDM, select Tools XML Builder Wizard to open the XML Builder Wizard to the Model Selection page:
Select whether you want to create a new XML model or update an existing XML model currently open in your workspace. 2. Click Next to go to the Tables and Views Selection tab:
377
Select the tables and views you want to generate. By default, all tables and views are selected. 3. Click Next to go to the XML Hierarchy Design tab:
On this tab, you construct the XML hierarchy that you want to generate: The left-hand pane lists the tables and views that you have selected
378
The right-hand pane displays the XML hierarchy to be generated, containing a default root element. 4. You can build your XML hierarchy using the following techniques: Specify whether columns will be generated as elements or attributes by using the radio buttons above the panes. Drag and drop a table, view, or column onto a node in the XML hierarchy. You must respect the PDM hierarchy: You cannot create an XML hierarchy between two elements if there is no reference between their corresponding tables, and a parent table cannot be placed beneath one of its children. Right-click a table, view, or column and select Add from the contextual menu to add it to the last selected node in the XML hierarchy. Rename an element or attribute by clicking its node and typing a new name. Create new elements and attributes not in the PDM, and Sequence, Choice and All group particles, by right-clicking an XML node and selecting New object from the contextual menu. Delete an XML node by right-clicking it and selecting Delete from the contextual menu. 5. Click Finish to generate the XSM.
In the case of an update to an existing XSM, your hierarchy will be created as a new root in the model. The SQL/XML extended model denition is automatically attached to the XML model to enable you to generate SQL/XML queries from global elements. For more information, see the Exchanging Data with Databases supporting XML chapter in the XML Modeling guide.
XML Builder Wizard tools The following tools are available to help you build your hierarchy:
379
Tool
Description
Properties Opens the property sheet for the selected table, view, or column. Add Object - Adds the selected PDM object to the XML hierarchy.
Create Default Hierarchy for Selected Objects - Adds the selected PDM objects to the XML hierarchy.
380
We recommend that you check your data model before generating another model or a database from it. If the check encounters errors, generation will be stopped. The Check model option is enabled by default in the Generation dialog box. You can check a data model in any of the following ways: Press F4, or Select Tools Check Model, or Right-click the diagram background and select Check Model from the contextual menu The Check Model Parameters window opens, which allows you to specify the kinds of checks to perform, and the objects to apply them to. For detailed information about this window and correcting problems reported, see Checking a Model in the Models chapter of the Core Features Guide . The following sections document the data model-specic checks available by default. For information about checks made on generic objects available in all model types, see Checking a Model in the Models chapter of the Core Features Guide .
381
Check
Abstract data type names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
The code of the ADT is longer than the maximum allowed by the DBMS. Manual correction: Reduce the length of the code Automatic correction: Reduces the code to a permissible length
If an abstract data type of type Object (or SQLJ Object) is instantiable (Abstract option not checked), then it must have attributes and no abstract procedure. Manual correction: Dene at least one attribute in the ADT Attributes tab and clear the Abstract option in the procedures property sheet Automatic correction: None
If an abstract data type of type Object (or SQLJ Object) is not instantiable (Abstract option checked), then it must not have tables based on it. Manual correction: Set the Based on property to <None> in the tables property sheet Automatic correction: None
Abstract data type procedure names and codes must be unique in the abstract data type. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
382
Check
The code of the ADT procedure is longer than the maximum allowed by the DBMS. Manual correction: Reduce the length of the code Automatic correction: Reduces the code to a permissible length An abstract data type procedure cannot have the same name as an attribute. Manual correction: Change the name of the ADT procedure Automatic correction: None
An abstract data type procedure must have a denition. Manual correction: Create an ADT procedure denition in the Denition tab of the ADT procedure property sheet Automatic correction: None
If the abstract data type procedure is a function, a map or an order, you should dene a return data type for the function, map or order. Manual correction: Select a return data type in the Return data type list Automatic correction: None
Association names and codes must be unique in the namespace. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code.
An association is isolated and therefore does not dene a relationship between entities. Manual correction: Dene at least two links between the isolated association and one or several entities. Automatic correction: None.
383
Check
An identier link introduces a dependency between two entities. An association with this type of link must be binary. Manual correction: Delete the unnecessary links or clear the Identier check box for a link. Automatic correction: None.
An identier link introduces a dependency between two entities. There can only be one identier link between two entities otherwise a circular dependency is created. Manual correction: Clear the Identier check box for one of the links. Automatic correction: None.
An association with an identier link cannot have any properties. Manual correction: Move the association properties into the dependent entity (the one linked to the association with an identier link). Automatic correction: None.
There are bijective associations between two entities when a two-way one to one association between the entities exist. This is equivalent to a merge of two entities. Manual correction: Merge the entities or modify the cardinality links. Automatic correction: None.
An association with more than two links can only have links with a maximum cardinality greater than one. Manual correction: Change the maximum cardinality of such links to be greater than 1. Automatic correction: None.
An identier link introduces a dependency between two entities. An association with this type of link cannot therefore be reexive. Manual correction: Change the relationship between the entities or clear the Identier check box for a link. Automatic correction: None.
384
Check
A many-to-many association and an entity cannot have the same name or code. Manual correction: Change the name or code of the many-to-many association or the name or code of the entity. If you do not, PDM generation will rename the generated table. Automatic correction: None.
Existence of hierarchy
Association names and codes must be unique in the model. Manual correction: Select a hierarchy in the Hierarchy list in the association property sheet Automatic correction: None
Attribute names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
Column names and codes must be unique in a table. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
385
Check
The column code length is limited by the maximum length specied in the DBMS denition (MaxLen entry, in the Objects Column category) or in the naming conventions of the model options. Manual correction: Modify the column code length to meet this requirement Automatic correction: Truncates the code length to the maximum length specied in the DBMS denition
Domain divergence
Divergence is veried between columns, domains, and data types. Various checks and attributes are also examined. One or more of the Enforce non divergence model options must be selected. Manual correction: Select one or more of the Enforce non divergence model options to enforce non divergence Automatic correction: Restores divergent attributes from domain to column (domain values overwrite column values)
Column mandatory
In some DBMS, the columns included in a key or a unique index should be mandatory. Manual correction: Select the Mandatory check box in the column property sheet Automatic correction: Makes the column mandatory
The values entered in the check parameters tab are inconsistent for numeric and string data types: default does not respect minimum and maximum values, or default does not belong to list of values, or values in list are not included in minimum and maximum values, or minimum is greater than maximum value. Check parameters must be dened consistently. Manual correction: Modify default, minimum, maximum or list of values in the check parameters tab Automatic correction: None
The data type precision should not be greater than the length. Note that some DBMS accept a precision higher than the length. Manual correction: Make the data type length greater than the precision Automatic correction: None
386
Check
A model should not contain columns with undened data type, all columns should have a dened data type. Manual correction: Select a data type in the column property sheet Automatic correction: None
Primary/alternate and foreign key columns involved in a join should have consistent data types and constraint parameters. Manual correction: Modify foreign key data types and constraint parameters to make them consistent Automatic correction: Parent column overwrites existing data type and constraint parameters in the foreign key column
Since a sequence is used to initialize a key, it should be attached to a column that is part of a key. This applies to those DBMS that support sequences. Manual correction: Attach the sequence to a column that is part of a key Automatic correction: None
An auto-incremented column must have a numeric data type. Manual correction: Change the column data type Automatic correction: Changes data type to numeric data type A foreign key column should not be auto-incremented. Manual correction: Deselect the Indentity check box in the column property sheet Automatic correction: None A computed column should have a computed expression dened. Manual correction: Add a computed expression to the column in the Details tab of the column property sheet Automatic correction: None
Check
Cubes names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
Existence of association
A cube must have at least one association with a dimension. Manual correction: Create an association between the cube and a dimension Automatic correction: None
Existence of fact
A cube must be associated to a fact. Manual correction: Click the Ellipsis button beside the Fact box in the cube property sheet, and select a fact from the List of Facts Automatic correction: None
A cube cannot have more than one association with the same dimension. Manual correction: Delete one of the associations Automatic correction: None
Database names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code The code of the database is longer than the maximum allowed by the DBMS. Manual correction: Reduce the length of the code Automatic correction: Reduces the code to a permissible length
388
Check
The database you have created is not used in the model. Manual correction: Delete the database or apply the database as a physical option to a table, an index, a key, a column, a storage, a tablespace or a view (Options tab of the object property sheet) Automatic correction: None
Database package names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
The database package name and code length is limited by the maximum length specied in the DBMS denition (MaxLen entry, in the Objects DB Package category) and in the naming conventions of the model options. Manual correction: Modify the name/code length to meet this requirement Automatic correction: Truncates the name/code length to the maximum length specied in the DBMS denition
A database package is an encapsulated collection of related procedures. It should contain at least one procedure. Manual correction: Create one or several procedures in the database package or use existing stored procedures and duplicate them in the database package Automatic correction: None
This check is to suggest that a database package can contain cursors to dene a work area and access its stored information. Manual correction: Create one or several cursors in the Cursors tab of the database package property sheet Automatic correction: None
389
Check
This check is to suggest that a database package can contain variables to capture or provide a value when one is needed. Manual correction: Create one or several variables in the Variables tab of the database package property sheet Automatic correction: None
This check is to suggest that a database package can contain user-dened data types called types. Manual correction: Create one or several types in the Types tab of the database package property sheet Automatic correction: None
This check is to suggest that a database package can contain exceptions to handle internal and user-dened error conditions. Manual correction: Create one or several exceptions in the Exceptions tab of the database package property sheet Automatic correction: None
Database package cursor names and codes must be unique in the database package. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
A package cursor must have a denition. Manual correction: Create the cursor denition in the Denition tab of the cursor property sheet Automatic correction: None
You should dene a return data type for a cursor. Manual correction: Select a return data type in the cursor property sheet Automatic correction: None
390
Check
Existence of parameter
A cursor must contain parameters for input values. Manual correction: Create one or several parameters in the Parameters tab of the cursor property sheet Automatic correction: None
Exception names and codes must be unique in the database package. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
Database package procedure names and codes must be unique in the database package. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
A package procedure must have a denition. Manual correction: Create the package procedure definition in the Denition tab of the package procedure property sheet Automatic correction: None
Existence of parameter
A package procedure must contain parameters for input and output values. Manual correction: Create one or several parameters in the Parameters tab of the package procedure property sheet Automatic correction: None
391
Check
If the package procedure is a function, you should dene a return data type for the function. Manual correction: Select a return data type in the Return Data Type list Automatic correction: None
Package type names and codes must be unique in the database package. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
A package type must have a denition. Manual correction: Create the type denition in the Denition tab of the package type property sheet Automatic correction: None
Variable names and codes must be unique in the database package. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
You should dene a data type for a variable. Manual correction: Select a data type in the variable property sheet Automatic correction: None
392
Data item names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code. There are unused data items. These are useless for PDM generation. Manual correction: To use a data item, add it to an entity. If you do not need an unused data item, delete it to allow PDM generation. Automatic correction: None.
There are entities using the same data items. This can be tolerated if you dened this check as a warning. Manual correction: Take care to ensure consistency when dening data item properties. Automatic correction: None.
There is a divergence between data items and associated domains. This can be tolerated if you dened this check as a warning. Manual correction: Ensure consistency when dening data item properties Automatic correction: Restores divergent attributes from domain to data items (domain values overwrite data item values).
The values entered in the check parameters page are inconsistent for numeric and string data types: default does not respect minimum and maximum values, or default does not belong to list of values, or values in list are not included in minimum and maximum values, or minimum is greater than maximum value. Check parameters must be dened consistently. Manual correction: Modify default, minimum, maximum or list of values in the check parameters page Automatic correction: None.
393
Check
The data type precision should not be greater than or equal to the length. Manual correction: Make the data type length greater than or equal to the precision. Automatic correction: None.
Undened data types for data items exist. To be complete, a model should have all its data items data types dened. Manual correction: While undened data types are tolerated, you must select data types for currently undened data types before you can generate a PDM. Automatic correction: None.
Invalid data types for data items exist. To be complete, a model should have all its data types for data items correctly dened. Manual correction: While tolerated, you must select valid data types for currently non-valid data types to generate the PDM. Automatic correction: None.
Data source names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
A data source must contain at least one physical data model in its denition. Manual correction: Add a physical data model from the Models tab of the property sheet of the data source Automatic correction: Deletes data source without physical data model
394
Check
The models in a data source should share the same DBMS since they represent a single database. Manual correction: Delete models with different DBMS or modify the DBMS of models in the data source Automatic correction: None
Default names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
The default code length is limited by the maximum length specied in the DBMS denition (MaxLen entry, in the Objects Default category). Manual correction: Modify the default code length to meet this requirement Automatic correction: Truncates the default code length to the maximum length specied in the DBMS denition
You must type a value for the default, this value is used during generation. Manual correction: Type a value in the Value box of the default property sheet Automatic correction: None
A model should not contain several defaults with identical value. Manual correction: Modify default value or delete defaults with identical value Automatic correction: None
Check
Dimension names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
Existence of attribute
A dimension must have at least one attribute. Manual correction: Create an attribute in the Attributes tab of the dimension property sheet Automatic correction: None
Existence of hierarchy
A dimension must use at least one hierarchy. Manual correction: Create a hierarchy in the Hierarchies tab of the dimension property sheet Automatic correction: None
Dimensions should not have duplicated hierarchies, that is to say hierarchies organizing identical attributes. Manual correction: Remove one of the duplicated hierarchies Automatic correction: None
A dimension should have a default hierarchy. Manual correction: Select a hierarchy in the Default Hierarchy list of the dimension property sheet Automatic correction: None
A dimension should be mapped to tables or views in an operational model in order to be populated by data from this model. Manual correction: Map the dimension to a table or a view. You may need to create a data source before you can create the mapping Automatic correction: Destroys the mapping for the dimension. This removes the data source from the Mapping list in the dimension Mapping tab
Attributes must be mapped to columns in the data source tables or views. Manual correction: Map the attributes to columns in the data source Automatic correction: None
396
Check
All attributes, detail attributes and hierarchies of the dimension must be mapped to tables and columns. You must map the dimension objects before generation. Manual correction: Map dimension objects to tables and columns Automatic correction: None
Dimension hierarchy names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
Existence of attribute
A dimension hierarchy must have at least one attribute. Manual correction: Add an attribute to the hierarchy from the Attributes tab of the hierarchy property sheet Automatic correction: None
Domain names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
397
Check
[PDM only] The domain code length is limited by the maximum length specied in the DBMS denition (MaxLen entry, in the Objects Domain category) or in the naming conventions of the model options. Manual correction: Modify the domain code length to meet this requirement Automatic correction: Truncates the domain code length to the maximum length specied in the DBMS denition
The values entered in the Check Parameters tab are inconsistent for numeric and string data types. Default does not respect minimum and maximum values, or default does not belong to list of values, or values in list are not included in minimum and maximum values, or minimum is greater than maximum value. Check parameters must be dened consistently. Manual correction: Modify default, minimum, maximum or list of values in the check parameters tab Automatic correction: None
The data type precision should not be greater than the length. Manual correction: Make the data type length greater than the precision Automatic correction: None
A model should not contain domains with undened data type, all domains should have a dened data type. Manual correction: Select a data type from the domain property sheet Automatic correction: None
[CDM/LDM only] Invalid data types for domains exist. To be complete, a model should have all its domain data types correctly dened. Manual correction: While tolerated, you must select valid data types for currently non-valid data types to generate the PDM. Automatic correction: None.
398
Check
[PDM only] A domain cannot have a default value without being attached to a default object. Manual correction: Create a default object for the domain or use the rebuild default feature Automatic correction: Creates a default object for domain
Attribute names and codes must be unique in the entity. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code.
Attribute names and codes must be unique in the entity. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code. There is a divergence between attributes and associated domains. This can be tolerated if you dened this check as a warning. Manual correction: Ensure consistency when dening attribute properties Automatic correction: Restores divergent attributes from domain to attributes (domain values overwrite attribute values).
399
Check
The values entered in the Check Parameters page are inconsistent for numeric and string data types. Default does not respect minimum and maximum values, or default does not belong to list of values, or values in list are not included in minimum and maximum values, or minimum is greater than maximum value. Check parameters must be dened consistently. Manual correction: Modify default, minimum, maximum or list of values in the check parameters page Automatic correction: None.
The data type precision should not be greater than or equal to the length. Manual correction: Make the data type length greater than or equal to the precision. Automatic correction: None.
Undened data types for attributes exist. To be complete, a model should have all its attributes data types dened. Manual correction: While undened data types are tolerated, you must select data types for currently undened data types before you can generate a PDM. Automatic correction: None.
Invalid data types for attributes exist. To be complete, a model should have all its data types for attributes correctly dened. Manual correction: While tolerated, you must select valid data types for currently non-valid data types to generate the PDM. Automatic correction: None.
400
Check
Entity identier names and codes must be unique in the namespace. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code.
At least one attribute must exist for an entity identier. Manual correction: Add an attribute to the entity identier or delete the identier. Automatic correction: None.
Identier inclusion
An identier cannot include another one. Manual correction: Delete the identier that includes an existing identier. Automatic correction: None.
Entity names and codes must be unique in the namespace. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code.
The entity name and code length is limited to a maximum length of 254 characters specied in the naming conventions of the model options. Manual correction: Modify the entity name/code length to meet this requirement. Automatic correction: Truncates the entity name/code length to the maximum length specied in the naming conventions.
Existence of attributes
An entity must always contain at least one attribute. Manual correction: Add an attribute to the entity or delete the entity. Automatic correction: None.
401
Check
An entity cannot have more than one serial type attribute. Serial types are automatically calculated values. Manual correction: Change the types of the appropriate entity attributes to have only one serial type attribute. Automatic correction: None.
Existence of identiers
An entity must contain at least one identier. Manual correction: Add an identier to the entity or delete the entity. Automatic correction: None.
An entity must have at least one relationship or association link. Manual correction: Add a relationship or an association link to the entity or delete the entity. Automatic correction: None.
Redundant inheritance
An entity inherits from another entity more than once. This is redundant and adds nothing to the model. Manual correction: Delete redundant inheritances Automatic correction: None.
Multiple inheritance
An entity has multiple inheritance. This is unusual but can be tolerated if you dened this check as a warning. Manual correction: Make sure that the multiple inheritance is necessary in your model. Automatic correction: None.
An entity is the parent of multiple inheritances. This is unusual but can be tolerated if you dened this check as a warning. Manual correction: Verify if the multiple inheritances could not be merged. Automatic correction: None.
Primary identiers in child entities must be the same as those in their parents. Manual correction: Delete those primary identiers in the child entities that are not in the parent entity. Automatic correction: None.
402
Fact names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
Existence of measure
A fact must have at least one measure. Manual correction: Create a measure in the Measures tab of the fact property sheet Automatic correction: None
A fact must be mapped to tables or views in an operational model in order to be populated by data from this model. Manual correction: Map the fact to tables or views. You may need to create a data source before you can create the mapping Automatic correction: Destroys the mapping for the fact. This removes the data source from the Mapping list in the fact Mapping tab
Fact measures must be mapped to columns in the data source tables or views. Manual correction: Map the fact measure to columns in the data source Automatic correction: Destroys the mapping for the measure. This removes the measures that are not mapped to any object in the Measures Mapping tab of the fact Mapping tab
403
Check
Fact measure names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
Group names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
The group code length is limited by the maximum length specied in the DBMS denition (MaxLen entry, in the Objects Group category) or in the naming conventions of the model options. Manual correction: Modify the group code length to meet this requirement Automatic correction: Truncates the group code length to the maximum length specied in the DBMS denition
Existence of user
A group is created to factorize privilege and permission granting to users. A group without user members is useless. Manual correction: Add users to group or delete group Automatic correction: Deletes unassigned group
Groups must have a password to be able to connect to the database (for those DBMS that support passwords for groups.) Manual correction: Dene a password for the group Automatic correction: None
objects:
Check Description and Correction
Horizontal partitioning names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
Existence of partition
A horizontal partitioning object cannot be empty, it must contain at least one partition. Manual correction: Delete the horizontal partitioning object or create at least one partition in the horizontal partitioning object property sheet Automatic correction: Deletes empty horizontal partitioning object
A partition should have a corresponding table. You could delete a table that actually corresponds to a partition, this check veries that each partition has a corresponding table. Manual correction: Delete the partition with no corresponding table Automatic correction: Deletes the partition with no corresponding table
Depending on the DBMS, a model or a table cannot contain two indexes with identical name and/or code. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
405
Check
The index code length is limited by the maximum length specied in the DBMS denition (MaxLen entry, in the Objects Index category) or in the naming conventions of the model options. Manual correction: Modify the index code length to meet this requirement Automatic correction: Truncates the index code length to the maximum length specied in the DBMS denition
An index must have at least one index column. Manual correction: Add an index column from the Column tab of the index property sheet or delete the index Automatic correction: Deletes the index without column
An index type must be specied. Manual correction: Specify a type in the index property sheet or delete the index with no type Automatic correction: None
The current DBMS does not support more than the number of index columns specied in the MaxColIndex entry of the current DBMS. Manual correction: Delete one or more columns in the index property sheet. You can create additional indexes for these columns Automatic correction: None
An index of HNG (HighNonGroup) type cannot be unique. Manual correction: Change the index type or set the index as non unique Automatic correction: None
Index inclusion
An index should not include another index. Manual correction: Delete the index that includes an existing index Automatic correction: None
Check
Inheritance names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code.
An inheritance must have at least one inheritance link, from the inheritance to the parent entity. Manual correction: Dene the inheritance link or delete the inheritance. Automatic correction: None.
[LDM only] If an inheritance is incomplete, the parent should be generated because you can lose information. Manual correction: Generate parent entity or dene the inheritance as complete. Automatic correction: None.
Join index names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code Join index must have a base table. Manual correction: Select a base table in the join index property sheet Automatic correction: None
The tables associated to a join index must have the same owner. Manual correction: Modify the join index owner or the table owner Automatic correction: None
407
Check
Join index references must be connected to selected table on a linear axis. Manual correction: Delete or replace references in the join index Automatic correction: None
Join indexes cannot have the same set of references. Manual correction: Delete one of the duplicated join indexes Automatic correction: None
Key names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
The key code length is limited by the maximum length specied in the DBMS denition (MaxConstLen entry, in the Object Key category). Manual correction: Modify the key code length to meet this requirement Automatic correction: Truncates the key code length to the maximum length specied in the DBMS denition
Each key must have at least one column. Manual correction: Add a column to the key from the Column tab of the key property sheet Automatic correction: Deletes key without column
Key inclusion
A key cannot include another key (on some columns, regardless of their order). Manual correction: Delete the key that includes an existing key Automatic correction: None
408
Check
Since the column initialized by a sequence is already a key, it should not be included in a multi-column key. Manual correction: Detach the sequence from a column that is already part of a multi-column key Automatic correction: None
Circular references
[PDM only] A circular reference occurs when a table refers to another table, and so on until a loop is created between tables. A package cannot contain circular references. Manual correction: Resolve the circular reference by correcting the reference, deleting its source, or clearing the Mandatory parent or Check on commit option Automatic correction: None
[PDM only] A constraint name is a unique identier for the constraint denition of tables, columns, primary and foreign keys in the database. You dene the constraint name in the following tabs: Check tab of the table property sheet Additional Check tab of the column property sheet General tab of the key property sheet A constraint name must be unique in a model. Manual correction: Modify the duplicated constraint name in the corresponding tab Automatic correction: Modies the duplicated constraint name of a selected object by appending a number to its current name
409
Check
[PDM only] The constraint name length cannot be longer than the length specied in the DBMS denition: either in the MaxConstLen entry, in the Object category, or in each object category. Manual correction: Modify the constraint name to meet this requirement Automatic correction: Truncates the constraint name to the maximum length specied in the DBMS denition
Circular dependencies
[PDM only] Extended dependencies with the stereotype <<DBCreateAfter>> can be used between stored procedures to dene a generation order for stored procedures. An extended dependency with the stereotype <<DBCreateAfter>> should not introduce a circular dependency in the model. Manual correction: Remove the <<DBCreateAfter>> extended dependency Automatic correction: None
Circular dependency
[CDM/LDM only] A circular dependency occurs when an entity depends on another and so on until a dependency loop is created between entities. A package cannot contain circular dependencies. Manual correction: Clear the Dependent check box for the link or delete an inheritance link. Automatic correction: None.
[CDM/LDM only] A circular dependency occurs when an entity depends on another and so on until a dependency loop is created between entities through mandatory links. Manual correction: Clear the Mandatory parent check box or delete a dependency on a relationship. Automatic correction: None.
Shortcuts codes must be unique in a namespace. Manual correction: Change the code of one of the shortcuts Automatic correction: None
410
Check
[CDM/LDM only] The package should not contain associations or relationships with an external shortcut as child entity. Although this can be tolerated in the CDM, the association or relationship will not be generated in a PDM if the external shortcut is generated as a shortcut. Manual correction: Modify the design of your model in order to create the association or relationship in the package where the child entity is dened. Automatic correction: None.
Procedure names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code The procedure code length is limited by the maximum length specied in the DBMS denition (MaxLen entry, in the Objects Procedure category). Manual correction: Modify the procedure code length to meet this requirement Automatic correction: Truncates the procedure code length to the maximum length specied in the DBMS denition
A procedure denition should have a body to specify its functionality. Manual correction: Specify a procedure body from the Denition tab of the procedure property sheet Automatic correction: None
Existence of permission
Permissions are usage restrictions set on a procedure for a particular user, group or role. Manual correction: Dene permissions on the procedure for users, groups and roles Automatic correction: None
411
Reference names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code A reexive reference exists should not have a mandatory parent which could lead to inconsistent joins. Manual correction: Correct the reference by clearing the Mandatory parent check box Automatic correction: None
A reference must have at least one reference join. Manual correction: Create a reference join for the reference or delete the reference Automatic correction: Deletes reference without join
The reference code length is limited by the maximum length specied in the DBMS denition (MaxConstLen entry, in the Object Reference category) or in the naming conventions of the model options. Manual correction: Modify the reference code length to meet this requirement Automatic correction: Truncates the reference code length to the maximum length specied in the DBMS denition
Incomplete join
Joins must be complete. Manual correction: Select a foreign key column or activate the primary key column migration Automatic correction: None
412
Check
Join order
The join order must be the same as the key column order for some DBMS. Manual correction: If required, change the join order to reect the key column order Automatic correction: The join order is changed to match the key column order During a reference check, the following object controls are made.
Relationship names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code.
Reexive dependency
A dependency means that one entity is dened through a relationship with another. A dependent relationship cannot therefore be reexive. Manual correction: Change or delete the reexive dependency. Automatic correction: None.
Reexive mandatory
A reexive mandatory relationship exists. Manual correction: Deselect the Mandatory check boxes for the relationship to be non-mandatory. Automatic correction: None.
There is a bijective relationship between two entities when there is a two-way one to one relationship between the entities. This is equivalent to a merge of two entities. Manual correction: Merge the entities or modify the relationship. Automatic correction: None.
413
Check
A many-to-many relationship and an entity cannot have the same name or code. Manual correction: Change the name or code of the many-to-many relationship or the name or code of the entity. If you do not, PDM generation will rename the generated table. Automatic correction: None.
A dependent relationship between entities cannot also be a dominant relationship. Manual correction: Select the Dominant check box on the other (correct) side of the relationship. Automatic correction: None.
External shortcut could be generated as child table. An entity that is at the many end of a one-to-many relationship or which is non-dominant should not be an external shortcut as the reference will not be generated during the generation of a PDM. Manual correction: Change the cardinality of the relationship cardinality or the entity, which should not be an external shortcut. Automatic correction: None.
Many-many relationships
[LDM only] Many-to-many relationships are not permitted. Manual correction: Create an intermediary entity, which contains the primary identiers of the previous manyto-many entities. Automatic correction: None.
Role names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
414
Check
The role code length is limited by the maximum length specied in the DBMS denition (MaxLen entry, in the Objects Role category) or in the naming conventions of the model options. Manual correction: Modify the role code length to meet this requirement Automatic correction: Truncates the role code length to the maximum length specied in the DBMS denition
Existence of user
A role is used to create predened prole that can be assigned to users or roles. A role that is not assigned to any user or role is useless. Manual correction: Assign role to users or delete role Automatic correction: Deletes unassigned role
Default names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code The code of the sequence is longer than the maximum allowed by the DBMS. Manual correction: Reduce the length of the code Automatic correction: Reduces the code to a permissible length
415
Check
Storage names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
The code of the storage is longer than the maximum allowed by the DBMS. Manual correction: Reduce the length of the code Automatic correction: Reduces the code to a permissible length
The storage you have created is not used in the model. Manual correction: Delete the storage or apply the storage as a physical option to a table, an index, a key, a column, a tablespace or a view (Options tab of the object property sheet) Automatic correction: None
Synonym names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code The synonym name and code length is limited by the maximum length specied in the DBMS denition (MaxLen entry, in the Objects Synonym category) and in the naming conventions of the model options. Manual correction: Modify the name/code length to meet this requirement Automatic correction: Truncates the name/code length to the maximum length specied in the DBMS denition
416
Check
A synonym must correspond to a model object. By default, when you create synonyms from the List of Synonyms using the Add a Row tool, they are not attached to any base object. Manual correction: Select a base object from the synonym property sheet Automatic correction: Deletes the synonym
Tables names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
The table name and code length is limited by the maximum length specied in the DBMS denition (MaxLen entry, in the Objects Table category) and in the naming conventions of the model options. Manual correction: Modify the name/code length to meet this requirement Automatic correction: Truncates the name/code length to the maximum length specied in the DBMS denition
A constraint name of the table cannot be the same as an index name. Manual correction: Change the name of the table constraint Automatic correction: None
A table should contain at least one column, one index, one key, and one reference. Manual correction: Add missing item to the denition of the table Automatic correction: None
417
Check
Auto-incremented columns contain automatically calculated values. A table cannot contain more than one auto-incremented column. Manual correction: Delete all but one auto-incremented column Automatic correction: None
Identical indexes are indexes with the same columns, order and type. A table cannot have identical indexes. Manual correction: Delete index or change its properties Automatic correction: None
When a table belongs to a model containing one or several data sources, it must be mapped to tables or views in the data source in order to establish a relational to relational mapping. Manual correction: Map the current table to one or several tables or views in the model belonging to the data source Automatic correction: Destroys the mapping for the table. This removes the data source from the Mapping list in the table Mapping tab
When a column belong to a table in a model containing one or several data sources, it should be mapped to columns in the data source in order to establish a relational to relational mapping. Manual correction: Map the current column to one or several columns in the models belonging to the data source Automatic correction: Destroys the mapping for the column. This removes the columns that are not mapped to any object in the Columns Mapping tab of the table Mapping tab
Existence of permission
Permissions are usage restrictions set on a table for a particular user, group or role. Manual correction: Dene permissions on the table for users, groups and roles Automatic correction: None
418
Table collapsing names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
A table collapsing must have a table as result of the collapsing. Manual correction: Delete the table collapsing object Automatic correction: None
The table resulting from the collapsing should be available. Manual correction: Delete the table collapsing object Automatic correction: Deletes the table collapsing object
Tablespace names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
The code of the tablespace is longer than the maximum allowed by the DBMS. Manual correction: Reduce the length of the code Automatic correction: Reduces the code to a permissible length
419
Check
The tablespace you have created is not used in the model. Manual correction: Delete the tablespace or apply the tablespace as a physical option to a table, an index, a key, a column, a storage or a view (Options tab of the object property sheet) Automatic correction: None
Trigger names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
The trigger code length is limited by the maximum length specied in the DBMS denition (MaxLen entry, in the Objects Trigger category). Manual correction: Modify the trigger code length to meet this requirement Automatic correction: Truncates the trigger code length to the maximum length specied in the DBMS denition
User names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
420
Check
The user code length is limited by the maximum length specied in the DBMS denition (MaxLen entry, in the Objects User category). Manual correction: Modify the user code length to meet this requirement Automatic correction: Truncates the user code length to the maximum length specied in the DBMS denition
Users must have a password to be able to connect to the database. Manual correction: Dene a password for the user Automatic correction: None
Vertical partitioning names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
Existence of partition
A vertical partitioning object cannot be empty, it must contain at least one partition. Manual correction: Delete the vertical partitioning object or create at least one partition in the vertical partitioning object property sheet Automatic correction: Deletes empty vertical partitioning object
A partition should have a corresponding table. You could delete a table that actually corresponds to a partition, this check veries that each partition has a corresponding table. Manual correction: Delete the partition with no corresponding table Automatic correction: Deletes the partition with no corresponding table
421
View names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
The view code length is limited by the maximum length specied for the table code length. Manual correction: Modify the view code length to meet this requirement Automatic correction: Truncates the view code length to the maximum length specied in the DBMS denition
Existence of permission
Permissions are usage restrictions set on a view for a particular user, group or role. Manual correction: Dene permissions on the view for users, groups and roles Automatic correction: None
Depending on the DBMS, a model or a view cannot contain two view indexes with identical name and/or code. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
422
Check
The view index code length is limited by the maximum length specied in the DBMS denition (MaxLen entry, in the Objects Index category) or in the naming conventions of the model options. Manual correction: Modify the view index code length to meet this requirement Automatic correction: Truncates the view index code length to the maximum length specied in the DBMS denition
A view index must have at least one index column. Manual correction: Add an index column from the Column tab of the view index property sheet or delete the index Automatic correction: Deletes the view index without column
The current DBMS does not support more than the number of index columns specied in the MaxColIndex entry in the Index category of the current DBMS. Manual correction: Delete one or more columns in the view index property sheet. You can create additional view indexes for these columns Automatic correction: None
A view index should not include another index. Manual correction: Delete the view index that includes an existing index Automatic correction: None
423
Check
View reference names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
A view reference must have at least one view reference join. Manual correction: Create a view reference join for the view reference or delete the reference Automatic correction: Deletes view reference without join
Web operation names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
The Web operation code length is limited by the maximum length specied in the DBMS denition (Maxlen entry, in the Objects Web Operation category). Manual correction: Modify the Web operation code length to meet this requirement Automatic correction: Truncates the Web operation code length to the maximum length specied in the DBMS denition
424
Check
Web service names and codes must be unique in the model. Manual correction: Modify the duplicate name/code Automatic correction: Appends a number to the duplicate name/code
The Web service code length is limited by the maximum length specied in the DBMS denition (Maxlen entry, in the Objects Web Service category). Manual correction: Modify the Web service code length to meet this requirement Automatic correction: Truncates the Web service code length to the maximum length specied in the DBMS denition
425
Upper left part of the dialog box Upper right part of the dialog box Lower part of the dialog box
The list of available objects depends on the selected object type. You can select individual objects from the list of available objects for insertion in the query script textbox. You can also dene expressions by entering basic arithmetic operators such as add, subtract, multiply, divide (+, -, *, /) and with the syntax tools shown below:
Syntax tool Content
Provides group, number, string, date, conversion and other functions Provides logical operators Provides variables for use with operators and functions Provides macros to accelerate the creation of a template item denition
These syntax tools allow greater exibility in dening complex expressions. The SQL Editor can be used for the following tasks:
426
For more information on dening views, see Dening a query for a view
in chapter Building Physical Diagrams.
5. Click OK.
427
You can use the following tools and keyboard shortcuts from the Preview toolbar:
428
Tool
Description
Refresh
F5
This tool is available when at least one extended model denition agged for generation is linked to the model and when it contains GeneratedFiles entries for the current object. When available, it displays the list of targets for the current object. If you add a generation target, the corresponding tab is added to the Preview tab. If you deselect a generation target, the corresponding tab disappears from the Preview tab Show generation options
C TRL + F6
C TRL + W
C TRL + D
If you click the Change Generation Options tool, the Generation Options dialog box is displayed. You can change generation options and preview their effect on the code. If you click the Ignore Generation Options tool, the preview ignores generation options selected by using the Change generation options tool but uses a predened set of options.
429
Selected tool
Effect on preview
You can select generation options Generation options currently selected are overridden by predened set of options You can select generation options
Visible in Preview if options are applicable Only predened options are visible in Preview Changes ignored in Preview
All items except drop options All items except options represented differently in some DBMS. For example, if a database is auto indexed, the index options corresponding to the keys are not selected All items except drop options All user-dened options are used
In the SQL Editor or SQL Preview tab, you can add and remove bookmarks at specic points in the SQL script and then navigate forwards or backwards from bookmark to bookmark:
Keyboard shortcut C TRL + F2 Description
Adds a new bookmark. A blue bookmark box is displayed. If you repeat this action from the same position, the bookmark is deleted and the blue marker disappears Jumps to next bookmark Jumps to the previous bookmark
F2
S HIFT + F2
Note that bookmarks are not printable and are lost if you use the Refresh, Change Generation or Ignore Generation options.
430
O To preview the code of a table 1. Double-click a table in the diagram to display the table property sheet. 2. Click the Preview tab to display the Preview tab.
3. Click OK.
431
432
PART II
This part explains how to link your Physical Data Models to your databases, including how to generate a database from a PDM, and reverse-engineer a PDM from a database.
CHAPTER 9
This chapter explains how to connect to a database, and to generate and modify databases via scripts or a live database connection.
Topic: Connecting to a Database Generating a Database Using Test Data Estimating Database Size Modifying a Database Accessing a Database page 436 438 472 500 506 513
435
Connecting to a Database
Connecting to a Database
PowerDesigner provides various methods for connecting to your database. Before connecting to your database for the rst time, you will have to congure a PowerDesigner connection prole. Your choice will depend on the interface that you have installed:
You have Congure a connection of type:
ODBC driver DBMS client JDBC driver ADO.NET driver OLE DB driver DirectConnect driver
ODBC machine or le data source Native connection prole JDBC connection prole ADO.NET connection prole OLE DB connection prole DirectConnect connection prole
2. Select one of the following radio buttons, depending on your chosen 436
method for connecting to your database: ODBC machine data source ODBC le data source Connection prole (for native, JDBC, ADO.NET, OLE DB or DirectConnect connections) You can use the tools to the right of the data source eld to browse to a new connection prole le or directory, and the Modify and Congure buttons to modify or congure your data source connection. 3. Enter your user ID and password, and then click Connect. If prompted by your database, you may need to enter additional connection parameters.
Connection time
You stay connected until you disconnect or terminate the shell session.
437
Generating a Database
Generating a Database
This section explains how to generate a database from a PDM. PowerDesigner can generate a database creation script that you can run in your DBMS environment or generate a database structure directly to a live database connection. O To generate a database 1. Select Database Generate Database to open the Database Generation dialog box (for more information, see Database Generation dialog General tab on page 440).
2. Type a destination directory and a lename for the script le in the Directory and File Name boxes. 3. Select the Script generation or Direct Generation radio button. 4. [optional] Click the Options tab, and specify creation options for your database objects (for more information, see Database Generation dialog Options tab on page 443). 5. [optional] Click the Format tab, and specify format options for your database objects (for more information, see Database Generation dialog Format tab on page 456). 6. [optional] Click the Selection tab, and specify the database objects to be created (for more information, see Database Generation dialog Selection tab on page 458).
438
7. [optional] Click the Summary tab to view the summary of your settings and selections (for more information, see Database Generation dialog Summary tab on page 459). 8. [optional] Click the Preview tab to preview the database script to be used (for more information, see Database Generation dialog Preview tab on page 459). 9. Click OK to begin the generation. If you are creating a database script: The output window shows the progress of the generation process, and indicates the syntax for running the script. At the end of script generation, a Result box is displayed. It lists the le path of the generated script le. Click Edit to open the script in a text editor or Close to close the Result box. If you are generating a database directly: If you are not currently connected to a database, a dialog box asks you to identify a data source and connection parameters.
Select a machine data source or le data source, type your user ID and password and then click Connect. You may be prompted for additional connection parameters.
Advanced generation topics
Advanced users may want to further customize database generation by, for example, customizing the order in which objects are generated, adding scripts to run before or after generation, and generating their own extended objects. For information on these and other advanced topics, the DBMS Resource File Reference chapter in the Customizing and Extending PowerDesigner manual. 439
Generating a Database
[required] Species the destination directory for the script le. [required] Species the destination lename for the script le. Species that the generation script is created as a single le. By default, a separate script le is created for each table. Species the type of generation to perform. You can choose between: Script generation - generate a script to be executed on a DBMS at a later time Direct generation generate a script and execute it on a live database connection
[available only when Direct generation is selected] Opens the generation script in a text editor for review or editing before execution on the database.
440
Parameter
Description
Species that a model check is performed before script generation. Creates an archive version of the PDM after generation.
Quick launch selection and settings sets The Quick Launch groupbox at the bottom of the General tab allows you to load pre-congured selections and settings sets for use when generating the database.
Selection
A selection comprises: a set of selections of database objects made on the Selection tab (see Database Generation dialog Selection tab on page 458) To save a selection, enter a name in the Selection bar at the bottom of the General or Selection tab and then click Save. The selection is saved as part of the model le.
Settings set
A settings set comprises: a set of options selected on the Options tab (see Database Generation dialog Options tab on page 443) and the format options specied on the Format tab (see Database Generation dialog Format tab on page 456) O To save a settings set 1. Enter a name in the Settings set bar at the bottom of the General, Options, or Format tab and then click the Save tool. 2. When the Settings location dialog box opens, specify whether you want to save the settings set as either: Inside the model As an external le
441
Generating a Database
3. Click OK.
Managing settings sets
You can review your settings sets at any time by clicking on the Settings Set Manager tool to launch the Settings Set Manager:
Delete the selected settings set. Only available when an internallysaved settings set is selected. You can only delete a settings set saved to an external le through Windows Explorer. Export the selected settings sets to an external le. Only available when an internally-saved settings set is selected. Import the selected settings sets to inside the model. Only available when an externally-saved settings set is selected.
Note that settings sets should not be copied and renamed outside of PowerDesigner. If you want to create a variant of an existing settings set, then you should load it, make the necessary changes, and then save it under a different name.
442
Depending on the objects present in your model, some or all of the following options will be available. You can save your option settings via the Settings set bar at the bottom of the tab. For more information, see Quick launch selection and settings sets on page 441.
443
Generating a Database
Create database Physical options Begin script End script Open database Close database Drop database
Generates database Generates physical options for database Inserts customized script before database creation Inserts customized script after database creation Opens database Closes database Deletes an existing database, before creating new database
Generates tablespaces Inserts customized script before tablespace creation Inserts customized script after tablespace creation Generates tablespace comments Deletes an existing tablespace, before creating a new tablespace
444
Generates storages Generates storage comments Deletes an existing storage, before creating a new storage
Generates users. Generates physical options for users Deletes the existing user before creating the new user. Generates privileges for users.
Generates groups. Deletes the existing group before creating the new group. Generates privileges for groups.
445
Generating a Database
Option
Result of selection
Generates roles. Deletes the existing role before creating the new role. Generates privileges for roles.
Domain options These options control the generation of domains/user-dened data types.
Parameter Result of selection
Create data type Default value Check Comment Drop data type
Generates user-dened data types Default value for user-dened data type Generates check parameters and validation rules for userdened data types Generates user-dened data type comments Deletes an existing user-dened data type, before creating new user-dened data type
Business rule options These options control the generation of business rules.
Parameter Result of selection
Generates rules Generates rule comments Deletes an existing rule, before creating a new rule
446
Generates default object Generates default comments Deletes an existing default before creating a new default object
If the Create and Drop check boxes are selected, the default objects will be created/dropped before domains and tables.
Create data type Begin script End script Comment Drop data type Install JAVA class Remove JAVA class Permission
Denes an abstract data type which is stored on a server Inserts customized script before data type creation Inserts customized script after data type creation Generates data type comments Deletes an existing abstract data type, before dening a abstract data type Installs a Java class which is stored on a server Deletes an existing Java class, before installing a new Java class Generates the permission statement for a given user during data type creation
447
Generating a Database
Generates sequence Generates sequence comments Deletes an existing sequence, before creating a new sequence Generates the permission statement for a given user during sequence creation
Creation parameters for tables & columns These options control the generation of tables, columns, indexes, and keys.
Table options
Generates tables. Generates check parameters and validation rules for tables. If selected you can choose between: Inside Table - checks are generated during table creation Outside - checks are generated with a separate SQL command, generally using an ALTER command after the creation of the table The generation of checks outside the table is possible if the AddTableCheck entry exists in the Table category of the current DBMS.
Generates physical options for tables. Inserts customized script before table creation. Inserts customized script after table creation. Generates table comments. Generates the permission statement for a given user during table creation.
448
Parameter
Result of selection
Drop table
Column options
Generates user-dened data type for column Assigns default value to column at creation Generates check parameters and validation rules for columns. If selected you can choose between: Inside Table - checks are generated during table creation Outside - checks are generated with a separate SQL command, generally using an ALTER command after the creation of the table The generation of checks outside the table is possible if the AddTableCheck entry exists in the Table category of the current DBMS.
Generates column comments Generates physical options for column Generates the permission statement for the column during creation
Generates primary keys. If selected you can choose between: Inside Table - primary keys are generated during table creation Outside - primary keys are generated with a separate SQL command, generally using an ALTER command after the creation of the table The generation of primary keys outside the table is possible if the Create entry exists in the PKey category of the current DBMS.
449
Generating a Database
Parameter
Generates physical options for primary keys Generates key comments Deletes an existing primary key, before creating a new primary key
Generates alternate keys. If selected you can choose between: Inside Table - alternate keys are generated during table creation Outside - alternate keys are generated with a separate SQL command, generally using an ALTER command after the creation of the table The generation of alternate keys outside the table is possible if the Create entry exists in the Key category of the current DBMS.
Generates physical options for alternate keys Generates alternate key comments Deletes an existing alternate key, before creating a new alternate key
450
Parameter
Result of selection
Generates foreign keys. If selected you can choose between: Inside Table - foreign keys are generated during table creation Outside - foreign keys are generated with a separate SQL command, generally using an ALTER command after the creation of the table The generation of foreign keys outside the table is possible if the Create entry exists in the Reference category of the current DBMS.
Decl. Integrity
Generates declarative referential integrity for references that have Declarative selected for referential integrity implementation in the reference property sheet. You can specify any or all of the following: Update constraint restrict Update constraint cascade Update constraint set null Update constraint set default Delete constraint restrict Delete constraint cascade Delete constraint set null Delete constraint set default
Generates foreign key comments Deletes an existing foreign key , before creating a new foreign key
Index options
451
Generating a Database
Parameter
Result of selection
Create index
Generates indexes. If selected you can choose between: Inside Table - indexes are generated during table creation
create table customer ( customer_id int not null, customer_name varchar(50) ) unique index CustomerIdx (customer_ id);
Outside - indexes are generated with a separate SQL command, generally using an ALTER command after the creation of the table
create table customer ( customer_id int not null, customer_name varchar(50) ); create unique index CustomerIdx on Customer(customer_id);
The generation of indexes outside the table is possible if the Create entry exists in the Index category of the current DBMS. Physical options Comment Drop index Index Filter Generates physical options for indexes Generates index comments Deletes an existing index before creating a new index You can specify from none to all of: Primary key - Generates primary key indexes Foreign key - Generates foreign key indexes Alternate key - Generates alternate key indexes Cluster - Generates cluster indexes Others - Generates indexes for all key columns with a dened index
Trigger options
452
Parameter
Result of selection
Generates trigger comments You can specify the creation of triggers: For insert For update For delete
Generates views Generates a view with a list of columns, even if this list is identical to the corresponding columns in the SQL order. Allows you to generate the list of view columns with the view creation order. By default, the list of view columns is generated only if it is different from the list of columns of the view query. For example, in the following view query:
select a, b from Table1
columns a and b are view columns by default. The default generation statement is:
create view V1 as select a, b from Table1
If you select the Force column list option, the generation statement will become:
create view V1(a,b) as select a, b from Table1
Generates physical options for view Inserts customized script before view creation Inserts customized script after view creation Deletes an existing view before creating a new view Generates view comments
453
Generating a Database
Parameter
Result of selection
Permission
Generates the permission statement for the user during view creation
Generates synonyms. Deletes the existing synonym before creating the new synonym. You can specify from none to all of: Table - Generates table synonyms View - Generates view synonyms Procedure - Generates procedure synonyms Synonym - Generates synonym synonyms Database Package - Generates database package synonyms Sequence - Generates sequence synonyms
454
Join index options These options control the generation of join indexes.
Parameter Result of selection
Create join index Physical options Begin script End script Drop join index Comment
Generates join indexes Generates physical options for join indexes for those DBMS that support it Inserts customized script before join index creation Inserts customized script after join index creation Deletes an existing join index, before creating a new join index Generates join index comments
Create procedure Begin script End script Drop procedure Comment Permission
Generates procedures. Inserts customized script before procedure creation Inserts customized script after procedure creation Deletes the existing procedure before creating the new procedure. Generates procedure comments Generates the permission statement for the procedure during creation
Database package options These options control the generation of database packages.
455
Generating a Database
Option
Result of selection
Deletes the existing database package before creating the new database package. Generates the permission statement for the database package during creation.
Web service options These options control the generation of web services.
Option Result of selection
Generates web services. Deletes the existing web service before creating the new web service. Generates the permission statement for the web service during creation.
Generates dimensions. Deletes the existing dimension before creating the new dimension. Generates the permission statement for the dimension during creation.
456
Some of the following options may not be available, depending on your target database. You can save your format settings via the Settings set bar at the bottom of the tab. For more information, see Quick launch selection and settings sets on page 441.
Option Result of selection
Table and view names in the script are prexed by the database name. Species the characters used to delimit identiers (for example, table and view names). Most DBMSs require a double-quote character (), but some permit other forms of delimiter. Table and view names in the script are prexed by their owner names. For those DBMSs that support sequence owners, this option will also prex sequence names by their owner names. Each section of the script includes commentary in the form of titles (for example, Database Name: TUTORIAL).
Owner prex
Title
457
Generating a Database
Option
Result of selection
For those DBMSs that support comments, this option allows to generate the name in the comment when the comment box is empty. This option applies to tables, columns, and views. The comment generated using the object name will be reversed as a comment. Species an encoding format. You should select a format that supports the language used in your model and the database encoding format. Species the case to use in the script. You can choose between: Upper - all uppercase characters Lower - all lowercase characters Mixed - lowercase and uppercase characters
Character case
No accent
By default, all the objects in the model except for those that belong to a 458
package, or that are shortcuts from another model are listed and selected for generation. You can save your selection via the Selection bar at the bottom of the tab. For more information, see Quick launch selection and settings sets on page 441. For more information about Selection windows, see Adding an item from a selection list section in the Objects chapter of the Core Features Guide .
459
Generating a Database
a tablespace is a partition in a database a storage is a partition on a storage device For some DBMSs, a tablespace can use a specied storage in its denition. The following table lists the DBMSs that support tablespaces and storages, explains which concept they represent and indicates the commands that implement PowerDesigner tablespace and storage options:
DBMS Tablespace represents. . . Storage represents. . .
ADABAS IBM DB2 UDB Common Server IBM DB2 UDB for OS/390 Informix Ingres InterBase Microsoft Access Microsoft SQL Server MySQL Oracle
NA tablespace
create tablespace
NA buffer pool
create bufferpool
table space
create tablespace
storage group
create stogroup
NA NA NA NA NA
NA NA NA NA legroup
NA tablespace
create tablespace
NA database space
create dbspace
Sybase ASE
NA
segment
sp-addsegment
Sybase AS IQ
database space
create dbspace
NA
461
Generating a Database
DBMS
Tablespace represents. . .
Storage represents. . .
Teradata
NA
NA
When tablespace or storage options are not applicable for a DBMS, the corresponding model menu item is grayed. Creating a tablespace or storage The lists of tablespace and storage options offer pre-dened parameters for each DBMS where applicable. The lists show default values and value lists for certain parameters which correspond to the recommended values for the DBMS.
2. Click the Add a Row tool to create a tablespace or storage and then click the Properties tool to open its property sheet. 3. Click the Physical Options tab, and select and set the necessary physical options:
462
PowerDesigner offers simplied physical option tabs for some DBMSs. Consequently you may have the option of choosing between the Physical Options (Common) and Physical Options (All) tabs.
For more information, see Physical Options in the Building Physical Diagrams chapter. 4. [optional] Click the Preview tab to review the SQL code to be generated for the tablespace or storage.
463
Generating a Database
5. Click OK. The selected options appear in Options column of the List of Tablespaces or List of Storages.
Customizing scripts
You can customize scripts as follows: Insert scripts at the beginning and end of database creation script Insert scripts before and after a table creation command Customizing a creation script allows you to add descriptive information about a generated script, or manipulate the script in such a way that is not provided by PowerDesigner.
Examples
If a development project archives all the database creation scripts that are generated, a header script can be inserted before each creation script, which may indicate the date, time, and any other information specic to the generated script. If an organization requires that generated scripts are led using a naming system which may be independent from a script name, a header script could direct a generated script to be led under a different name than the name indicated in the creation script.
464
Access rights can be added as a footer to a table creation script. Script toolbar properties You can use the following tools and keyboard shortcut from the script toolbar:
Tool Description Keyboard shortcut S HIFT + F11
CTRL
+E
Before the command that creates the database After the last command in the database creation script
Name of the current PDM Date of script generation Name of the DBMS for the target database Filename of script le Filename and path of script le Command that runs the script Author of the current model
465
Generating a Database
O To insert begin and end scripts for database creation 1. Select Model Model Properties.
or
Right click the diagram background. Select Properties from the contextual menu. The model property sheet is displayed.
2. Click the Create tool next to the Database box. A conrmation box is displayed asking you to commit the creation of the database script object. 3. Click Yes. The database property sheet is displayed.
466
4. Type a name and code for the database. 5. Click the Script tab. The Script tab opens to the Begin tab. 6. Type the DBMS-specic commands to insert in the beginning of the script. 7. Click the End tab at the bottom of the tab. 8. Type the DBMS-specic commands to insert at the end of the script. 9. Click OK in each of the dialog boxes. Inserting begin and end scripts for table creation For each table, you have the option to insert the following scripts:
Script Where it is inserted
Immediately before the table creation command (after the table title) Immediately after the table creation command
These scripts can appear in database creation scripts and database modication scripts. 467
Generating a Database
%COLNLIST% %DATABASE% %DATE% %DBMSNAME% %NAMESCRIPT% %OWNER% %OWNERPREFIX% %PATHSCRIPT% %STARTCMD% %TABLE% %TCODE% %TLABL% %TNAME% %AUTHOR%
Column list
Code of the current PDM Date of script generation Code of the DBMS for the target database Filename of script le Table owner Owner prex of table owner Filename and path of script le Command that runs the script Name or code of current table (based on display preferences) Code of the current table Label of the current table Name of the current table Author of the current model
O To insert begin and end scripts for table creation 1. Double-click a table symbol. The table property sheet is displayed. 2. Click the Script tab. The Script tab opens to the Begin tab. 3. Type the DBMS-specic commands to insert in the beginning of the script. 4. Click the End tab at the bottom of the tab. 5. Type the DBMS-specic commands to insert at the end of the script. 6. Click OK.
468
Inserting begin and end script for tablespace creation For each tablespace, you have the option to insert the following scripts:
Script Where it is inserted
Immediately before the tablespace creation command (after the table title) Immediately after the tablespace creation command
These scripts can appear in database creation scripts and database modication scripts. You can use the following variables in these scripts:
Variable Description
Code of the current PDM Date of script generation Code of the DBMS for the target database Filename of script le Filename and path of script le Command that runs the script Code of the tablespace Physical options of the tablespace Author of the current model
O To insert begin and end scripts for tablespace creation 1. Double-click a tablespace in the list of tablespace. The tablespace property sheet is displayed. 2. Click the Script tab. The Script tab opens to the Begin tab. 3. Type the DBMS-specic commands to insert in the beginning of the script. 4. Click the End tab at the bottom of the tab.
469
Generating a Database
5. Type the DBMS-specic commands to insert at the end of the script. 6. Click OK. Formatting variables in customized scripts Variables have a syntax that can force a format on their values. Typical uses are as follows: Force values to lowercase or uppercase characters Truncate the length of values Enquote text You embed formatting options in variable syntax as follows:
%[[?][-][width][.[]precision][c][H][F][U|L][T][M][q][Q]:]<varname>%
Mandatory eld, if a null value is returned the translate call fails Blanks or zeros added to the left to ll the width and justify the output to the right Blanks or zeros added to the right to ll the width and justify the output to the left Copies the specied minimum number of characters to the output buffer Copies the specied maximum number of characters to the output buffer Lower-case characters Upper-case characters Combined with L and U, applies conversion to rst character Leading and trailing white space trimmed from the variable Converts number to hexadecimal Upper-case rst letter and lower-case next letters
n (where n is an integer)
-n width .[-]precision .L .U .F .T .H .c
470
Format option
Description
.n .-n M
Truncates to n rst characters Truncates to n last characters Extracts a portion of the variable name, this option uses the width and precision parameters to identify the portion to extract Enquotes the variable (single quotes) Enquotes the variable (double quotes)
q Q
471
You generate test data for a table based on test data proles. A test data prole is a named class of data types that has a dened data generation source. A test data prole can be assigned to one or more columns. When you assign a test data prole to a column, it acts as a representative for the data type of that column. Test data for the column is then generated using the data prole and its dened data source. You can also select a test data prole to apply to a domain. You can then choose to have the prole automatically assigned to all columns that use that domain. A test data prole can use one of the following: Number Character Date/Time
Example
For a column named Employee Location, you create a test data prole named Address using the Character class. You then dene a test data source
472
for Address. You can also assign it to other columns, such as Store Location, and Client Address.
Default test data proles
If you do not assign a test data prole for a column, a default test data prole is assigned to the column when you generate test data for the table. You dene default test data proles for each class used to generate test data. The following objects are not taken into account when you generate test data: Alternate keys Foreign keys Business and validation rules Binary, sequential, OLE, text or image data types Trigger contents
O To set up a test data prole 1. Create a test data prole for one or more columns. 2. Dene a test data generation source for each data prole. 3. Dene column ll parameters for columns that need to be populated with data in a particular way. 4. Assign test data proles to all relevant columns. 5. Use the test data proles to generate test data.
Name of the prole Code of the data prole You can assign one of the following data type classes: Number Character Date/Time
473
When you dene the prole class, make sure it reects the DBMS limitations, for example, someDBMS do not support dates prior to a certain date.
Generation source
You dene a test data generation source for each data prole. You can use the following test data generation sources:
Generation source Test data values are generated
By PowerDesigner From a list of test data values From a live database connection From a source le
Each data generation source has its own set of options for dening generation parameters. O To create a test data prole 1. Select Model Test Data Proles. The List of Test Data Proles is displayed.
2. Click a blank line in the list. 3. Type a test data Prole name and a prole code. 4. Select a data type class from the Prole Class list.
474
If you do not see the column you need, display it with the Customize Columns and Filter tool. For details, see Customizing object list columns and ltering lists section in the Objets chapter of the Core Features Guide . 5. Click Apply. 6. Double-click the new prole to display its property sheet. 7. Dene generation source parameters. 8. Click OK in each of the dialog boxes.
Random Sequential From/To Step Generate decimal numbers Decimal digits number
Indicates to generate random data Indicates to generate sequential data Indicates the range for random or sequential data Indicates interval between each sequential number step Generates decimal numbers Indicates the maximum number of decimal places to be generated
475
O To dene an automatic data generation source 1. Select Model Test Data Proles. The List of Test Data Proles is displayed.
2. Double-click a test data prole using numbers. The Prole properties sheet opens to the General tab. 3. Select the Automatic radio button.
5. Specify test data generation parameters. 6. Click OK in each of the dialog boxes. Dening an automatic test data generation source for characters You have the following options to dene generation source parameters for the prole class Character:
Option Parameter Description
Verify
List of authorized characters Accepts all characters List of unauthorized characters Replaces accents with unaccented characters String of mask characters. Indicates authorized letter cases
Case
477
Option
Parameter
Description
Length
Exact From/To
You indicate exact character length You indicate character length range
Character selection
You can specify valid characters to accept and invalid characters to refuse. You use a comma ( , ) to separate each single character, character interval, or string. The following syntax applies to valid and invalid characters.
Character set Syntax Example
a-z
"a" | "xyz"
A mask character is a pre-dened character that indicates to users that they need to type a particular piece of information. The test data that is generated respects the following mask characters:
Mask character Prompts to type
A 9 ?
478
O To dene an automatic data generation source 1. Select Model Test Data Proles. The List of Test Data Proles is displayed.
2. Double-click a test data prole using characters. The Prole properties sheet opens to the General tab. 3. Select the Automatic radio button.
5. Specify test data generation parameters. 6. Click OK in each of the dialog boxes. Dening an automatic test data generation source for date and time You can dene the following generation source parameters for the prole class Date/Time:
Value Parameter Description
Indicates range of date values Indicates range of time values Indicates date and time intervals for sequential data values. Indicates to generate random data Indicates to generate sequential data
480
O To dene an automatic data generation source 1. Select Model Test Data Proles. The List of Test Data Proles is displayed.
2. Double-click a data prole using date and time. The Prole properties sheet opens to the General tab. 3. Select the Automatic radio button.
5. Specify test data generation parameters. 6. Click OK in each of the dialog boxes.
482
483
You can also type a user-dened query in the Query box. The user-dened button indicates when the default query has been modied. You can click this button to recover the default query.
7. Click OK. You return to the List of Test Data Proles. 8. Click OK.
Values
Random Sequential
Each CSV le that you import for each data prole must come from the same directory. If you have not previously used this directory as a CSV le test data source, you will need to select the correct directory to dene the le path.
484
PowerDesigner provides example test data les in the \TESTDATA directory. O To dene a le as a test data generation source 1. Select Model Test Data Proles. The List of Test Data Proles is displayed. 2. Double-click a data prole. The Prole properties sheet opens to the General tab. 3. Select the File radio button. 4. Click the Detail tab. The Detail tab is displayed.
If you are importing a CSV le for the rst time from a specic directory, you need to select the appropriate directory. 5. Select a le and click Open. You return to the Detail tab.
485
6. Specify test generation parameters. 7. Click OK. You return to the List of Test Data Proles. 8. Click OK.
Percentage of column entries containing a null value Indication of the percentage of column rows that contain unique entries. This is a maximum value, and can change automatically depending on the referential integrity parameters of primary key columns. Alternately, a specic value can be entered, without a percentage sign, to indicate the exact number of column rows that contain unique entries.
Average Length
The Average Length box is only used for the Estimate data base size function. The value that is displayed by default, is the maximum length for the data type dened for a selected column.
Indicated column properties
Mandatory
Column must be assigned a value. The ll parameter Null value is automatically dened as 0% Column is the only column in a primary key, alternate key, or unique index. The ll parameters Null Values and Distinct Values are automatically dened as 0% and 100% respectively Column is a foreign key column. You cannot assign a data prole to this column. It automatically takes the data prole of the corresponding primary key column in the parent table
Unique column
Foreign
486
O To dene column ll parameters 1. Select Model Tables. The List of tables is displayed.
2. Double-click a table from the list. The Prole properties sheet opens to the General tab. 3. Select the Columns tab. The Columns tab is displayed.
487
4. Double-click a column name. The Column properties dialog box is displayed. 5. Select the Detail tab. The Detail tab is displayed.
6. Select or type Column ll parameters. 7. Select a prole from the test data parameters dropdown list box. 8. Click OK in each dialog box. You return to the Columns tab. 9. Click OK.
488
There are three approaches to assigning data proles: Assign a data prole from the list of tables Assign a data prole from the list of columns Select a data prole for a domain, so that all columns attached to that domain are automatically assigned the data prole.
For more information on how to select a data prole for a domain, see
chapter Building Physical Diagrams. Assigning a data prole from the list of tables O To assign a data prole from the list of tables 1. Select Model Tables. The List of tables is displayed.
2. Double-click a table in the list. The table property sheet opens to the General tab. 3. Select the Columns tab. The Columns tab is displayed.
489
4. Select a column in the list. 5. Select a test data prole from the dropdown list box.
Display the column you need
If you do not see the column you need, display it with the Customize Columns and Filter tool. For details, see Customizing object list columns and ltering lists section in the Objets chapter of the Core Features Guide . 6. Click OK. Assigning a data prole from the list of columns
490
O To assign a data prole from the list of columns 1. Select Model Columns. The List of Columns is displayed.
2. Select a column in the list. 3. Select a test data prole from the dropdown list box.
Display the column you need
If you do not see the column you need, display it with the Customize Columns and Filter tool. For details, see Customizing object list columns and ltering lists section in the Objets chapter of the Core Features Guide . 4. Click OK.
2. Select one or more data proles that you want to export. 3. Click OK. A dialog box is displayed. 4. Type a le name with the XPF extension.
492
5. Click Save.
Do not implement triggers if you generate a new database. It is also recommended that you remove triggers from an existing test database. Triggers can considerably increase the time required to generate the database and can block insertions. In addition, they are not needed for the type of test we are performing. O To generate test data 1. Assign data proles to the columns in each table for which you want to generate test data (see Assigning a data prole on page 488).
Default values for data proles
Test data generation is typically based on user-dened data proles. If you have no data prole denitions, you are automatically provided with default values. The default number of rows is set to 20 and the value <default> is displayed in each of the following three default prole boxes. 2. Select Database Generate Test Data to open the Test Data Generation dialog box.
493
3. Specify a directory and lename for your test data le, and then choose between Script and Direct generation. For more information, see Test Data Generation General tab on page 494. 4. [optional] To change the number of rows to be generated for specic tables, click the Number of Rows tab. For more information, see Test Data Generation Number of Rows tab on page 496. 5. [optional] To modify script formatting options, click the Format tab. For more information, see Test Data Generation Format tab on page 497. 6. [optional] To control which tables will have test data generated, click the Selection tab. For more information, see Test Data Generation Selection tab on page 499. 7. Click OK to start the generation. : then a Result dialog box asks you if you want to Edit or Close the newly generated le.
If you are generating a test data script If you are generating test data to a live database connection
, then a
Connect to a Data Source dialog box opens. Select a data source, and then click Connect. A message in the Output window indicates that the test data generation is completed. Test Data Generation General tab The General tab allows you to set general generation options.
494
Species the directory in which the le will be saved. Species the name of the le. Select the One le only checkbox to specify that only a single le can be generated.
Generation type
Species how the test data will be generated. The following settings are available: Script generation - in DBMS-specic syntax Direct generation to a live database connection Data le as a set of values in a le
495
Option
Result of selection
Commit mode
Species when the data will be committed. The following settings are available: Auto - automatically during script generation At end - at end of script generation By packet - at dened intervals during script generation
Data le format
For use with the data le option. The following settings are available: CSV comma-separated values Custom delimiter specify a custom delimiter
Deletes existing data before generating new data.. Checks the PDM before generating the test database or script, and stops generation if an error is found. Creates an archive of any previous test data. Species the default number of rows for table Species the default number prole for table Species the default character prole for table Species the default date prole for table
Automatic archive Default number of rows Default number prole Default character prole Default date prole
Test Data Generation Number of Rows tab The Number of Rows tab allows you to specify the number of rows of test data to generate. Enter the required number in the Test Number column.
496
Test Data Generation Format tab The Format tab allows you to set script format options.
497
Species that an owner prex is added. Species that each section of the script includes commentary in the form of titles. Species the encoding format to use for test data generation. You should select the encoding format that supports the language used in your model and the database encoding format. Species the character case to use. The following settings are available: Upper - all uppercase characters Lower - all lowercase characters Mixed - both uppercase and lowercase characters
Character case
No accent
498
Test Data Generation Selection tab The Selection tab allows you to specify tables for which test data will be generated.
499
You obtain an estimate based on the following elements: Estimated number of records in tables Columns in each table Indexes in the model Tablespaces in the model Database storage options Estimation depends on parameters like DBMS type, physical options, column data types, indexes and keys. The estimation formula used in this feature proceeds from the DBMS documentation.
Records in tables
The estimated database size for a column is based on the following: Size of xed length data types Average size of variable length data types
Indexes
The estimate of the database size includes all indexes including primary key indexes, foreign key indexes, alternate key indexes and database-specic indexes such as IQ join indexes.
Automatic index constraints
The automatic indexing of keys is DBMS specic. If the target database supports the automatic indexing of keys, the resulting database size estimation includes these indexes.
Tablespace size
The size of a tablespace associated with a table is estimated by default, and is displayed as a total of the following: All tables in the tablespace All indexes in the tablespace
500
Storage options
Data storage options are DBMS specic. You dene data storage options supported by the target database. These are included in the estimate of database size.
If you do not see the column you need, display it with the Customize Columns and Filter tool. For details, see Customizing object list columns and ltering lists section in the Objets chapter of the Core Features Guide . 3. Type a value in the Test Number column for the table that requires an indication of the number of records.
501
4. Click OK.
The average length value is particularly important for strings or long binary data types. A Binary Long OBject (BLOB) such as a picture can represent the largest portion of the space actually taken by a table. O To indicate average data type length 1. Select Model Tables. The List of Tables is displayed. 2. Double-click a table name. The Table Properties sheet opens to the General tab. 3. Click the Columns tab. The Columns tab is displayed. 4. Double-click a column that uses a data type with variable length. The Column Properties sheet opens to the General tab. 5. Click the Detail tab. The Detail tab is displayed.
502
503
O To estimate the database size of all the tables in the model 1. Select Database Estimate Database Size. The Database Size Estimation dialog box is displayed. 2. Click the Include Sub-Packages button. 3. Select all the tables from the list.
4. Click OK. The output list displays the estimated database size.
504
4. If required, repeat steps 2 and 3 until all the tables of interest have been selected throughout the model. 5. Click OK. A conrmation box is displayed asking if you want to keep all previously selected objects in the database size estimate. 6. Click OK. The output list displays the estimated database size.
505
Modifying a Database
Modifying a Database
You can modify an existing database schema by synchronizing it with your model. The existing schema can be in the form of: an archive model a live database connection a script le a model from the repository The PDM (source model) and the existing database schema (target model) are merged using a database synchronization window, which allows you to choose which objects are added, deleted, or updated in the target. O To modify a database 1. Select Database Apply Model Changes to Database to open the Apply Model Changes to Database dialog box. 2. Type a destination directory and lename for the script le in the Directory and File Name boxes. 3. Specify the type of generation to perform. You can choose between a script and a live database connection. 4. Specify how PowerDesigner will obtain the database schema to modify. You can choose between: Using an archive model Click the button to the right to browse to the archived model. Using a data source Click the button to the right to connect to your data source. Using a script le Select a script from the list or click the button to the right to browse to the script. Using a model from repository Click the Change Model Version tool to the right to browse to a version of the currently selected model. 5. If you want to retain your existing data, select the Backup Tables option. If this option is not selected, then all existing data will be erased. For details of this and other options on this tab, see Apply Model Changes to Database dialog General tab on page 508. 6. [optional] If you want to change the default generation options, then click the Options tab. For more information about these options, see Apply Model Changes to Database dialog Options tab on page 510. 506
7. [optional] If you want to change the format of your script, then click the Format tab. This tab has the same functionality as in the Database Generation window (see Database Generation dialog Format tab on page 456). 8. [optional] If you want to control which database objects will be modied, then click the Selection tab. This tab has the same functionality as in the Database Generation window (see Database Generation dialog Selection tab on page 458) 9. Click OK. If you are using a live database connection, then the Reverse Engineering window will open, allowing you to select or clear check boxes in the target model for objects that you want to include or remove from the source model. Make your selections and then click OK to continue. 10. The Database Synchronization window will open. Select or clear check boxes in the target model for objects that you want to include or remove from the model.
Modifying a Database
If you are generating a database directly, a Data Source connection box is displayed. Type your connection details and click the Connect button. A message box shows the progress of the generation process. At the end of generation click OK to close the box.
Directory
508
Option
Description
[required] Species the destination lename for the script le. Species that the generation script is created as a single le. By default, a separate script le is created for each table. Species the type of generation to perform. You can choose between: Script generation - generate a script to be executed on a DBMS at a later time Direct generation generate a script and execute it on a live database connection
Generation Type
[available only when direct generation is selected] Opens the generation script in a text editor for review or editing before execution on a live database connection. Select the kind of schema that the model will modify. You can choose between: Using an archive model - Modied PDM is merged with an archived PDM. Using a data source - Modied PDM is merged with a reverse engineered database schema for a live database connection. Using a script le - Modied PDM script le is merged with an existing database script le. Using a model from repository - Modied PDM is merged with a selected version of a PDM consolidated in the repository.
Backup tables
Species that any existing table will be copied to temporary backup tables during the modication, and then restored to the updated tables. If this option is not selected, then all existing data will be erased. Select a radio button to specify whether create statements should always be used to modify database tables, or whether alter statements should be used where possible
509
Modifying a Database
Option
Description
Drop temporary tables Use physical options for temporary tables Check model Automatic archive
[available only when Backup Tables is selected] Species that the temporary backup tables are removed after script execution. [available only when Backup Tables is selected] Species that the temporary backup tables are generated with their physical options. Species that a model check is performed before script generation. Creates an archive version of the PDM after generation.
You can load option settings previously used for database generation via the Settings set bar at the bottom of the tab. For more information, see Quick launch selection and settings sets on page 441. Apply Model Changes to Database dialog Options tab This tab controls certain script options.
510
These options are dependent on the selected DBMS and certain of them may be unavailable.
Option Result of selection
Inside/ Outside
Species whether and where various constraints will be generated. Note that if alter statements are used to modify tables, then constraints may be generated outside the table even if the inside radio button is selected here. Species which kinds of indexes to generate. Species whether comments are generated.
You can load option settings previously used for database generation via the Settings set bar at the bottom of the tab. For more information, see Quick launch selection and settings sets on page 441. Apply Model Changes to Database dialog Format tab This tab controls the format of your modication script. It has the same 511
Modifying a Database
functionality as the equivalent tab in Database Generation (see Database Generation dialog Format tab on page 456). Apply Model Changes to Database dialog Selection tab The Selection tab allows you to specify individual objects to generate. It has the same functionality as the equivalent tab in Database Generation (see Database Generation dialog Selection tab on page 458).
512
Accessing a Database
PowerDesigner allows you to display data from the database that corresponds to your model, and to send SQL queries to a connected data source.
3. Select the Machine data source radio button. Select a data source from the list.
or
Select the File data source radio button. Browse to the directory containing the .DSN le. Select the .DSN le.
513
Accessing a Database
4. Type your user ID and password. 5. Click Connect and, if prompted by your data source, type additional connection parameters. A Query Results windows list all the database records corresponding to the selected table, view, or reference. 6. Click the Close button.
514
CHAPTER 10
This chapter describes how to reverse engineer database objects into a PDM.
Topic: Getting Started with Reverse Engineering Reverse Engineering from Scripts Reverse Engineering from a Live Database Reverse Engineering Options Reverse Engineering Database Statistics page 516 517 520 524 532
515
Script le
The script will normally be the script used to generate the database but can also include other scripts. If you use more than one script les, make sure that the order of the les respects dependencies among objects (for example, trigger creation scripts must come after table creation scripts; and grant permission scripts must come after both table and user creation scripts. For more information, see the Reverse Engineering from Scripts on page 517 section.
Data source
You reverse engineer the schema for an existing database, specifying an data source, and connection information.You can select to use administrator permissions in order to be able to select the system tables that are reserved to a database admin. For more information, see the Reverse Engineering from a Live Database on page 520 section.
When you reverse engineer a database, whether from a script or a data source, make sure that you set the rebuild options appropriately. Click the Options tab and select or clear the checkboxes to rebuild references and/or primary keys according to your needs. By default, no rebuild options are selected.
516
When working with the PowerDesigner Eclipse plug-in you can, in addition to the procedure below, select any SQL le in the Navigator, right-click it and select Reverse Engineer from SQL File. You will be given the option to reverse into an existing or new PDM. O To reverse engineer objects one or more script les 1. To reverse engineer a script into an existing PDM, select Database Update Model from Database.
or
To reverse engineer a script and create a new PDM, select File Reverse Engineer Database to open the New Physical Data Model dialog box. Specify a model name, choose a DBMS from the list, and then click OK. 2. When the Database Reverse Engineering Options dialog box opens, click the Using script les radio button.
Always place trigger script les after table script les
You can add as many script les as necessary to the list. The reverse engineering process handles les sequentially. Trigger scripts must always be executed after table scripts. This is the only constraint for ordering your les in the list, but it is essential for a successful reverse engineering of triggers. Use the Move tools to position the les correctly in the list.
517
3. Click the Options tab to specify any reverse engineering options. For more details, see Reverse engineering Options tab on page 524. 4. Click the Target Models tab to specify any external shortcuts. For more details, see Reverse engineering Target Models tab on page 527. 5. Click OK to begin the process of reverse engineering. When the process is complete, a conrmation message is given in the Output window. If you are reverse engineering to an existing PDM, then the Merge Models dialog box opens to help you merge the new objects into your PDM.
For more information on comparing and merging two models, see the
Comparing and Merging Models chapter in the Core Features Guide .
Script le tools
The following tools are available to help you to select script les:
518
Tool
Description
Add Files Opens a dialog box to allow you to browse for scripts les. You can add as many les as necessary. Move Up Moves the selected le(s) up one row. This tool is grayed if the selected le(s) are at the top of the list. Move Down - Moves the selected le(s) down one row. This tool is grayed if the selected le(s) are at the bottom of the list. Clear All - Deletes all les from the list.
519
or
To reverse engineer from a live database connection and create a new PDM, select File Reverse Engineer Database to open the New Physical Data Model dialog box. Specify a model name, choose a DBMS from the list, and then click OK. 2. When the Database Reverse Engineering Options dialog box opens, click the Using a data source radio button.
520
Data source
A data source might be predened, or you can type the name of an existing data source. In both cases, when you click OK, a database connection dialog box opens, if you need to specify additional connection parameters. Click Connect and the Database Reverse Engineering dialog box is displayed. (Go to step 9) 3. Click the Connect to a Data Source tool to open the Connect to an ODBC Data Source dialog box.
4. Select the appropriate source, type a user ID and a password, and then click Connect to return to the Database Reverse Engineering Options dialog box. 5. If you want to select tables reserved to the database administrator, then you must select the Reverse using administrators permissions check box. 6. Click the Options tab to specify any reverse engineering options. For more details, see Reverse engineering Options tab on page 524.
521
7. Click the Target Models tab to specify any external shortcuts. For more details, see Reverse engineering Target Models tab on page 527. 8. Click OK to open the ODBC Reverse Engineering dialog box. This box allows you to specify a selection of objects to reverse engineer. Only tables and triggers are selected by default.
For more information about selecting objects, see Database Reverse 522
Engineering Selection window on page 528. 9. Click OK to begin the process of reverse engineering. When the process is complete, a conrmation message is given in the Output window. If you are reverse engineering to an existing PDM, then the Merge Models dialog box opens to help you merge the new objects into your PDM.
For more information on comparing and merging two models, see the
Comparing and Merging Models chapter in the Core Features Guide .
523
Rebuilds references when no references are reverse engineered. The rebuild references feature starts by detecting columns with identical name and data type in different tables. A reference is created between each column belonging to a primary key and a column, with identical name and data type, that does not belong to a primary or a foreign key in another table. Rebuilds primary keys using unique indexes when tables have no key and only one unique index.
Automatically rebuild primary keys from unique indexes when tables have no key and only one unique index Automatically reverse tables referenced by selected tables
Reverse engineers the parents of the selected child tables in order to complement the denition of these child tables.
524
Reverse options
Description
Create symbols
Creates a symbol for each reversed object in the diagram. Otherwise, reversed objects are visible only in the browser. The layout of the symbols in the diagram will be automatically arranged. In cases where there are a large number of objects with complex interactions, the auto-layout feature is likely to create synonyms of objects to improve the diagram readability. For example, if a table has a large number of references, the auto-layout feature will create a synonym of this table in another location of the diagram in order to improve the diagram presentation.
File encoding
Species the default le encoding of the les to reverse engineer. Click the ellipsis to the right of the option to change the encoding (see Reverse engineering encoding format on page 525). Species the end of block character for the reversed script. By default, displays the value dened in the DBMS, under Script\SQL\Syntax. You can modify this value, in which case it will be saved in the Registry for reuse in other models. You can restore the DBMS value using the Restore from DBMS tool. Species the end of command character for the reversed script. By default, displays the value dened in the DBMS, under Script\SQL\Syntax. You can modify this value, in which case it will be saved in the Registry for reuse in other models. You can restore the DBMS value using the Restore from DBMS tool. Species that the database is case sensitive and enables the case sensitive option in the model.
Block terminator
Command terminator
525
If you want to change these parameters because you know which encoding is used within the sources, you can select the appropriate encoding parameter by clicking the Ellipsis button beside the File Encoding box. This opens the Text Input Encoding Format dialog box in which you can select the encoding format of your choice.
The Text Input Encoding Format dialog box includes the following options:
Option Description
Encoding format to be used as hint when reversing the le. Indicates whether text encoding detection is to be attempted and species how much of each le should be analyzed. When enabled, PowerDesigner analyzes a portion of the text, and uses an heuristic based on illegal bytes sequences and/or the presence of encoding-specic tags in order to detect the appropriate encoding that should be used for reading the text. The following settings are available: No detection - for use when you know what the encoding format is Quick detection - analyzes a small part of the le. For use when you think that the encoding format will be easy to detect Full detection analyzes the whole le. For use when you think that the number of characters that determine the encoding format is very small
526
Option
Description
On ambiguous detection
Species what action should be taken in case of ambiguity. The following settings are available: Use encoding hint and display warning - the encoding hint format is used and a warning message is displayed. Use encoding hint - the encoding hint format is used but no warning message is displayed. Use detected encoding - the encoding format detected by PowerDesigner is used
Allows you to stop reverse engineering if characters cannot be identied and are to be lost in current encoding
527
Tool
Tooltip
Description
Displays a standard Open dialog box to let you select another le as target model Opens selected target model in current workspace
Add Models
Opens a selection list with the models opened in the current workspace. This tool is particularly useful when you reverse engineer into a new model where the target models are not dened Deletes the target model and the shortcuts in the current model that reference the deleted target model
Delete
When you reverse engineer a model, any target models should be open in your workspace. If not, the following conrmation dialog box is displayed to let you open the target models:
All the create statements in the script create objects, provided the script contains a full denition of the object. When the script only uses an object and does not dene it, this object is sought among the target objects in the target models and an external shortcut is created in the reversed model.
When you reverse engineer from a live database connection, external shortcuts are created for all selected objects already existing in another target model. These existing objects are deselected by default in the Selection tab of the Reverse Engineering dialog box, except the target objects corresponding to shortcuts already existing in the reversed model.
528
The object types that you can reverse engineer are DBMS-dependent. Unavailable object types do not appear for selection.
Filters
You can restrict database objects to reverse engineer by selecting an owner or a database qualier in the top area of the window:
Filter Description
Qualier
A qualier is a database, or a partition in a database, that contains one or more tables. When a qualier is selected as a lter, it restricts the objects available for reverse engineering to the objects contained within the selected qualier. For example, the DB2 DBMS authorizes the use of the qualier eld to select which databases are to be reverse engineered from a list. Normally the creator of a database object is its owner. When an owner is selected as a lter; it restricts the objects available for reverse engineering to the objects owned by the selected owner.
Owner
You can lter on a qualier and/or owner in either of the following ways: Select a qualier in the Filter on object qualier list and/or select a user ID in the Filter on object owner list. Click the Select Qualier and Owner tool, and type a qualier and/or owner in the dialog box. This method is recommended if the selected qualier contains a large number of table owners, as opening the Owner list may take a very long time.
529
Note that only users that have creation rights are reverse engineered.
Selecting objects from multiple owners
To reverse engineer objects from multiple owners, you can select All users as a lter from the owner list. All the objects belonging to all owners appear in the list, and you can select the objects for reverse engineering regardless of their owner.
Objects and options
You access different object types to select by clicking on the appropriate sub-tabs.
Tables and triggers
When you select tables containing triggers from the Table tab, the corresponding triggers are automatically selected in the Trigger tab. Certain object types have attributes, or options, that appear below the object lists. These options depend on the selected object type and on the current DBMS. Unavailable options appear grayed.
User-dened and abstract data types
You can reverse engineer user-dened and abstract data types. In the generated PDM, the names of these data types appear in the List of Abstract Data Types.
Selection list
You can save your selections for re-use by entering a selection name in the list at the bottom of the window and clicking the save tool to the right of the list. Selections are saved with a .sel le extension, and are added to the list for subsequent use. You can change the folder in which the les are saved by clicking the folder tool to the right of the list.
You can dene the database reverse parameters from the access.mdb database window. O To reverse an MS Access database into a PowerDesigner PDM 1. Double-click ACCESS.MDB in the PowerDesigner \tools directory. 2. Select Reverse Engineer Access Database File to PowerDesigner Script. 3. Type the Access database name in the Select Database box. 4. Type the .DAT le to create in the PowerDesigner File. 5. Click the Create button. 6. Select DBMS Reverse Engineering Databases in PowerDesigner. 7. Select the newly generated script le to reverse. 8. Click OK.
During reverse engineering, PowerDesigner compares the total number of current objects for reverse engineering to the value of RevOdbcMinCount.
If the total number of listed items is lower than the value of RevOdbcMinCount A global reverse query is executed. If the total number of listed items is higher than the value of RevOdbcMinCount The process uses key RevOdbcMinPerct.
If the percentage of reversed items is lower than the percentage dened in RevOdbcMinPerct, then the same query is executed for each object. If the percentage of reversed items is higher than the percentage dened in RevOdbcMinPerct, then a global query is executed. 531
2. On the General tab, select or clear the checkboxes to specify whether you want to update statistics for tables and/or columns. 3. [optional] Click the Selection tab and select or clear checkboxes to specify for which tables you want to update statistics:
532
4. Click OK to begin the update. Progress appears in the Output window. For large updates, a progress dialog box opens, allowing you to cancel the update at any time. When the process is complete, you can view the updated statistics in the property sheets of your tables and columns.
533
CHAPTER 11
DBMS-Specic Features
About this chapter
PowerDesigner can be used with a number of DBMS with specic features often requiring special procedures for certain tasks. This chapter describes these DBMS-specic features and associated tasks.
535
For more information about working with resource les and the
Resource File Editor, see the following chapters in the Customizing and Extending PowerDesigner manual: Resource Files and the Public Metamodel DBMS Resource File Reference Extending your models with Proles
536
The DBMSs for IBM DB2 v5.x are deprecated. The following table lists DB2 objects and their equivalents in PowerDesigner:
DB2 PowerDesigner
Bufferpool Database Partition Group Distinct Type Function Index Extension Method Type SuperView
Storage Extended Object <<DatabasePartitionGroup>> Domain Procedure of Function type Extended Object <<IndexExtension>> Abstract Data Type Procedure Abstract Data Type SubView of a View
Trusted contexts
Using a trusted context in an application can improve security by placing accountability at the middle-tier, reducing over granting of privileges, and auditing of end-users activities. Trusted contexts are supported for DB2 v9.x and higher for z/OS. PowerDesigner models trusted contexts as extended objects with a stereotype of <<TrustedContext>>.
Creating a trusted context
You can create a trusted context in any of the following ways: Select Model Trusted Contexts to access the List of Trusted Contexts, and click the Add a Row tool. Right-click the model or package in the Browser, and select New Trusted Context.
You can modify an objects properties from its property sheet. To open a 537
trusted context property sheet, double-click its Browser entry in the Trusted Contexts folder. The following extended attributes are available on the DB2 tab:
Name Description
Enable
Species that the trusted context is created in the enabled state. Scripting name: Enable
Authorization
Species that the context is a connection that is established by the authorization ID that is specied by authorizationname. Scripting name: Authorization
Default role
Species the default role that is assigned to a user in a trusted connection when the user does not have a role in the trusted context. If empty, then a No Default Role is assumed. Scripting name: DefaultRole
As object owner
Species that the role is treated as the owner of the objects that are created using a trusted connection based on the trusted context. Scripting name: WithRoleAsObjectOwner
Species the default security label for a trusted connection based on the trusted context. Scripting name: DefaultSecurityLabel
Attributes
Species one or more connection trust attributes that are used to dene the trusted context. Scripting name: Attributes
Species who can use a trusted connection that is based on the trusted context. Scripting name: WithUseFor
Auxiliary tables
Auxiliary tables are used to store large object (LOB) data, such as graphics, video, etc, or to store rarely-accessed data in order to improve the performance of the base table. Auxiliary tables are supported for IBM DB2 v9.x and higher for z/OS. 538
PowerDesigner models auxiliary tables as extended objects with a stereotype of <<Auxiliary Table>>.
Creating an auxiliary table
You can create an auxiliary table in any of the following ways: Select Model Auxiliary Table to access the List of Auxiliary Tables, and click the Add a Row tool. Right-click the model or package in the Browser, and select New Auxiliary Table.
You can modify an objects properties from its property sheet. To open an auxiliary table property sheet, double-click its Browser entry in the Auxiliary Tables folder. The following extended attributes are available on the DB2 tab:
Name Description
Database
Species the database in which the LOB data will be stored. Scripting name: Database
Tablespace
Species the table space in which the auxiliary table is created. Scripting name: Tablespace
Table
Species the table that owns the LOB column. Scripting name: Table
Column
Species the name of the LOB column in the auxiliary table. Scripting name: Column
Partition
Species the partition of the base table for which the auxiliary table is to store the specied column. Scripting name: Partition
Tablespace prex
In IBM databases for OS/390, the physical options for a table can specify the tablespace in which a table resides, as well as the database name. You declare a tablespace in a database and assign a table to a tablespace on the Physical Options (Common) tabs of their property sheets. If the tablespace is not declared in any database, then the tablespace is not prexed by any database name.
539
When you preview your table creation code, you can verify that the tablespace is prexed by the name of the database.
Denes the procedure that will be used as generator/cryptor of values. Scripting name: ExtFieldProcName [up to v6.x] Species a subtype for a character string column (column with a CHAR,VARCHAR,or LONG VARCHAR data type). The subtype can proceed from the list dened in extended attribute type T_ForData. Scripting name: ExtData
540
Name
Description
Generated value
[v7.x and higher] Indicates that DB2 generates values for the column using the computed column function. If you select Always, the server will send an error message if you try to type a value in the column. If you select By Default, the server uses the computed column value or the value typed for the column. Scripting name: ExtGeneratedAs
Character subtype
[v7.x and higher] Species a subtype for a character string column. Scripting name: ExtSubtypeData
Domain
Character Subtype
[v6.x and higher] Species a subtype for a character string column. Scripting name: ExtSubtypeData
541
The DBMSs for IBM DB2 v5.x are deprecated. To see the comparison table between DB2 objects and their equivalents in PowerDesigner, see IBM DB2 for z/OS (formerly OS/390) on page 537.
You can create a database partition group in any of the following ways: Select Model Database Partition Groups to access the List of Database Partition Groups, and click the Add a Row tool. Right-click the model or package in the Browser, and select New Database Partition Group.
You can modify an objects properties from its property sheet. To open a database partition group property sheet, double-click its diagram symbol or its Browser entry in the Database Partition Groups folder. The following extended attributes are available on the DB2 tab:
Property Description
Database partitions
Species the database partitions that are in the partition group. When empty, the group includes all database partitions dened in the database at the time of its creation. Scripting name: DBPartitionNumList
Index extensions
Index extensions are supported for DB2 v9.x and higher, and are used with indexes on tables that have columns of a structured or distinct type. The following options are available on the DB2 tab: 542
Property
Description
Owner
Parameters
Species a list of parameters (with data types) that is passed to the index extension at CREATE INDEX time to dene the actual behavior of this index extension. Scripting name: IndexExtensionParameters
Species how the index key is generated using a user-dened table function. Multiple index entries may be generated for a single source key data value. Scripting name: KeyGenerationFunction Species parameters for the key generation function. Scripting name: KeyGenerationFunctionParameters
Search methods
Species the list of method details of the index search. Each detail consists of a method name, the search arguments, a range producing function, and an optional index lter function. Scripting name: SearchMethods
Species the parameter (and its data type) that is associated with the source key column. Scripting name: SourceKeyParameters
Species the target key parameters that are the output of the key generation function specied on the GENERATE KEY USING clause. Scripting name: TargetKeyParameters
The following extended attributes are available on the DB2 tab (v9.x and higher):
543
Name
Description
Inline length
Indicates the maximum size (in bytes) of a structured type column instance to store inline with the rest of the values in the row of a table. Instances of a structured type or its subtypes, that are larger than the specied inline length, are stored separately from the base table row, similar to the way that LOB values are handled. Scripting name: InlineLength
Indicates that there are no comparison functions supported for instances of the structured type. Scripting name: WithoutComparison Denes the name of the system-generated function that casts a reference type value for this structured type to the data type representation type. A schema name must not be specied as part of function name (SQLSTATE 42601). The cast function is created in the same schema as the structured type. If the clause is not specied, the default value for function name is the name of the representation type. Scripting name: RefAsSourceCastFunction
Denes the name of the system-generated function that casts a value with the data type representation type to the reference type of this structured type. A schema name must not be specied as part of the function name (SQLSTATE 42601). The cast function is created in the same schema as the structured type. If the clause is not specied, the default value for function name is the structured type name. A matching function signature must not already exist in the same schema (SQLSTATE 42710). Scripting name: SourceAsRefCastFunction
Indicates that all methods of this type and its subtypes, including methods created in the future, can be accessed using functional notation. This clause can be specied only for the root type of a structured type hierarchy (the UNDER clause is not specied) (SQLSTATE 42613). This clause is provided to allow the use of functional notation for those applications that prefer this form of notation over method invocation notation. Scripting name: WithFunctionAccess
544
Name
Description
Ref using
Denes the built-in data type used as the representation (underlying data type) for the reference type of this structured type and all its subtypes. This clause can only be specied for the root type of a structured type hierarchy (UNDER clause is not specied) (SQLSTATE 42613). The type cannot be a LONG VARCHAR, LONG VARGRAPHIC, BLOB, CLOB, DBCLOB, DATALINK, or structured type, and must have a length less than or equal to 32 672 bytes (SQLSTATE 42613). If this clause is not specied for the root type of a structured type hierarchy, then REF USING VARCHAR(16) FOR BIT DATA is assumed. Scripting name: RepType
Length/ precision
The following extended attributes are available on the DB2 tab (v9.x and higher) with the LOB data type:
Name Description
Compact
Species COMPACT options for LOB data type columns. Scripting name: Compact
Logged
Species LOGGED options for LOB data type columns. Scripting name: Logged
The following extended attributes are available on the DB2 tab (v9.x and higher):
Name Description
Species whether or not a lock request can be associated with the isolation-clause of the statement when the method inherits the isolation level of the statement that invokes the method. The default is INHERIT ISOLATION LEVEL WITHOUT LOCK REQUEST. Scripting name: IsolationLevel
Method is external
Indicates that the CREATE METHOD statement is being used to register a method, based on code written in an external programming language. Scripting name: ExternalMethod
545
Name
Description
External name
Identies the name of the user-written code which implements the method being dened. Scripting name: ExternalName
Transform group
Indicates the transform group that is used for user-dened structured type transformations when invoking the method. A transform is required since the method denition includes a user-dened structured type. Scripting name: TransformGroup
Columns
Lob option
[up to v8.x] Species options for LOB data type columns. Scripting name: ExtLobOption
Species that the content of the column is to be treated as bit (binary) data. This is only applicable on columns with a character datatype. Scripting name: ExtForBitData
Expression
[v7.x and higher] Species that the denition of the column is based on an expression. Scripting name: ExtGenExpr
[v7.x and higher] When set to True (generated always), indicates that DB2 will always generate a value for the column when a row is inserted into the table or whenever the result value of the generation expression may change. When set to False (generated by default), indicates that DB2 will generate a value for the column when a row is inserted into the table, unless a value is specied. Scripting name: ExtGenAlways
Compact
Species COMPACT options for LOB data type columns. Scripting name: Compact
Logged
Species LOGGED options for LOB data type columns. Scripting name: Logged
Tables
546
Name
Description
Ptcfree
Indicates what percentage of each tab to leave as free space during load or reorganization. Scripting name: ExtTablePctFree
Tablespaces
Type
Species the tablespace type, as dened in the extended attribute type ExtTablespaceTypeList. Scripting name: ExtTablespaceType
Views
The following extended attributes are available on the DB2 tab (v9.x and higher):
Name Description
Species that the columns of the view are based on the attributes of the structured type identied by type-name. Scripting name: ADTView Species the abstract data type that the view is based on. Scripting name: ViewType Species the view that the current view is a subview of. The superview must be an existing view and must be dened using a structured type that is the immediate supertype of the current view type. Scripting name: SuperView
Denes the object identier column for the typed view. Scripting name: OIDColumn Denes the object identier column of the typed view denition to assume uniqueness even though the system cannot prove this uniqueness. Scripting name: Unchecked
Additional options
Denes additional options that apply to columns of a typed view. Scripting name: RootViewOptions
547
Name
Description
Species that an updated row is to be moved to the appropriate underlying table, even if it violates a check constraint on that table. Scripting name: WithRowMovement
Check option
Species the constraint that every row that is inserted or updated through the view must conform to the denition of the view. Scripting name: CheckOption
548
Informix SQL
This section describes features specic to the Informix SQL family of databases.
Serial Start
Denes the initial value of the column with a SERIAL datatype. Scripting name: ExtSerialStart
549
Ingres
Ingres
This section describes features specic to the Ingres family of databases.
The following extended attributes are available on the Extended Attributes tab:
Name Description
NotDefault
Indicates the column needs a value. This generates the not default clause in the sql statement. Scripting name: NotDefault
Users
Species the default group the user belongs to. Scripting name: DefaultGroup Species an optional expiration date associated with each user. Any valid date can be used. Once the expiration date is reached, the user is no longer able to log on. If the expire_date clause is omitted, the default is noexpire_date. Scripting name: ExpireDate
External password
Allows a users password to be authenticated externally to Ingres. The password is passed to an external authentication server for authentication. Scripting name: ExternalPassword
Allows a security administrator to restrict the highest security label with which users can connect to Ingres when enforcing mandatory access control (MAC). Scripting name: LimitingSecurityLabel Allows a prole to be specied for a particular user. If the prole clause is omitted, the default is noprole. Scripting name: Prole
550
Interbase
This section describes features specic to the Interbase family of databases.
Row sort
Denes that the default value of the index (ascending or descending) is dened on the index and not on the column. Scripting name: ExtAscDesc
Sequences
First value
Species the sequence rst value for Interbase generator. Scripting name: ExtStartWith
Increment value
Species the sequence increment value for Interbase generator. Scripting name: ExtIncrement
551
Microsoft Access
Microsoft Access
This section describes features specic to the MS Access family of databases.
Deprecated versions
The following extended attributes are available on the Access 2000 tab:
Name Description
Species whether a zero-length string () is a valid entry in a table column. Applies only to Text, Memo, and Hyperlink table elds. Scripting name: ExtAllowZeroLength
552
Horizontal partitioning
Horizontal positioning in MS SQL Server 2005 is a method for making large tables and indexes more manageable by dividing them horizontally and spreading them across more than one legroup in a database. PowerDesigner supports horizontal partitioning through the partition function and partition scheme objects. Partition functions A partition function species how a table or index can be partitioned. PowerDesigner models partition functions as extended objects with a stereotype of <<PartitionFunction>>.
Creating a partition function
You can create a partition function in any of the following ways: Select Model Partition Functions to access the List of Partition Functions, and click the Add a Row tool. Right-click the model or package in the Browser, and select New Partition Function.
You can modify an objects properties from its property sheet. To open a partition function property sheet, double-click its diagram symbol or its Browser entry in the Partition Functions folder. The following extended attributes are available on the Microsoft tab:
Name Description
Species the data type of the column used for partitioning. All data types are valid, except text, ntext, image, xml, timestamp, varchar(max), nvarchar(max), varbinary(max), alias data types, or CLR user-dened data types. Scripting name: InputParameterType
553
Name
Description
Interval Side
Species to which side of each boundary value interval the boundary_value [,. . . n ] belongs. You can choose between: left [default] right Interval values are sorted by the Database Engine in ascending order from left to right. Scripting name: IntervalSide
Boundary Values
Species the boundary values for each partition of a partitioned table or index. All values must be separated by commas. Scripting name: BoundaryValues
Partition schemes A partition scheme maps the partitions produced by a partition function to a set of user-dened legroups. PowerDesigner models partition schemes as extended objects with a stereotype of <<PartitionScheme>>.
Creating a partition scheme
You can create a partition scheme in any of the following ways: Select Model Partition Schemes to access the List of Partition Schemes, and click the Add a Row tool. Right-click the model or package in the Browser, and select New Partition Scheme.
You can modify an objects properties from its property sheet. To open a partition scheme property sheet, double-click its diagram symbol or its Browser entry in the Partition Schemes folder. The following extended attributes are available on the Microsoft tab:
554
Name
Description
Partition Function
Species the partition function using the scheme. Partitions created by the partition function are mapped to the legroups specied in the partition scheme. Scripting name: PartitionFunction
All Partitions
Species that all partitions map to the legroup specied by the File Groups property. Scripting name: AllPartitions
File Groups
Species the names of the legroups to hold the partitions specied by the partition function. If [PRIMARY] is specied, the partition is stored on the primary legroup. If ALL is specied, only one legroup name can be specied. Scripting name: Filegroups
Partitioning a table or an index To partition a table or an index, specify a partition scheme and column on the Microsoft tab of its property sheet.
You can create an assembly in any of the following ways: Select Model Assemblies to access the List of Assemblies, and click the Add a Row tool. Right-click the model or package in the Browser, and select New
555
Assembly.
Assembly properties
You can modify an objects properties from its property sheet. To open an assembly property sheet, double-click its diagram symbol or its Browser entry in the Assemblies folder. The following extended attributes are available on the Microsoft tab:
Name Description
Authorization
Species the name of a user or role as the owner of the assembly. Scripting name: Authorization
File name
Species the local path or network location where the assembly that is being uploaded is located, and also the manifest le name that corresponds to the assembly. Can be entered as a xed string or an expression evaluating to a xed string. Scripting name: FileName
Permission set
Species a set of code access permissions that are granted to the assembly when it is accessed by SQL Server. You can choose between: SAFE UNSAFE EXTERNAL_ACCESS Scripting name: PermissionSet
Visibility
Species that the assembly is visible for creating common language runtime (CLR) functions, stored procedures, triggers, user-dened types, and user-dened aggregate functions against it. You can choose between: On Off Scripting name: Visibility
Unchecked data
By default, ALTER ASSEMBLY fails if it must verify the consistency of individual table rows. This option allows postponing the checks until a later time by using DBCC CHECKTABLE. Scripting name: UncheckedData
556
CLR aggregate functions An aggregate function performs a calculation on a set of values and returns a single value. Traditionally, Microsoft SQL Server has supported only built-in aggregate functions, such as SUM or MAX, that operate on a set of input scalar values and generate a single aggregate value from that set. SQL Server integration with the Microsoft .NET Framework common language runtime (CLR) now allows developers to create custom aggregate functions in managed code, and to make these functions accessible to Transact-SQL or other managed code. PowerDesigner models aggregate functions as extended objects with a stereotype of <<Aggregate>>.
Creating an aggregate function
You can create an aggregate function in any of the following ways: Select Model Aggregates to access the List of Aggregates, and click the Add a Row tool. Right-click the model or package in the Browser, and select New Aggregate.
You can modify an objects properties from its property sheet. To open an aggregate function property sheet, double-click its diagram symbol or its Browser entry in the Aggregates folder. The following extended attributes are available on the Microsoft tab:
Name Description
Owner
Species the name of a schema as the owner of the aggregate function. Scripting name: Owner
Assembly
Species the assembly to bind with the aggregate function. Scripting name: Assembly
Class name
Species the name of the class in the assembly that implements the aggregate function. If the class name is not specied, SQL Server assumes it is the same as the aggregate name. Scripting name: Class
Parameter name
557
Name
Description
Type
Species the type of the input parameter. All scalar data types or CLR user-dened types can be used, except text, ntext, and image. Scripting name: InputParameterType
Return type
Species the return type of the aggregate function. All scalar data types or CLR user-dened types can be used as return type, except text, ntext, and image. Scripting name: ReturnType
CLR user-dened types The introduction of user-dened types (UDTs) in SQL Server 2005 allows you to extend the scalar type system of the server, enabling storage of CLR objects in a SQL Server database. UDTs can contain multiple elements and can have behaviors, differentiating them from the traditional alias data types which consist of a single SQL Server system data type. Because UDTs are accessed by the system as a whole, their use for complex data types may negatively impact performance. Complex data is generally best modeled using traditional rows and tables. UDTs in SQL Server 2005 are well suited to the following: Date, time, currency, and extended numeric types Geospatial applications Encoded or encrypted data PowerDesigner models user-dened types as abstract data types.
Creating a user-dened type
To create a user-dened type, you must have already created an assembly (see CLR assemblies on page 555) and have an OOM containing an appropriate class open in the workspace, in order to specify the supertype.
O To create a user-dened type 1. Create an abstract data type by: Select Model Abstract Data Types to access the List of Abstract Data Types, and click the Add a Row tool. Right-click the model or package in the Browser, and select New Abstract Data Type. 2. On the General Tab of its property sheet, select CLR from the list of Types. 558
3. Click the Select Object tool to the right of the Class eld, in order to specify a supertype. 4. Click the Microsoft tab and select an assembly from the list to bind to the type. 5. Click OK to close the property sheet.
User-dened type properties
You can modify an objects properties from its property sheet. To open a user-dened type property sheet, double-click its diagram symbol or its Browser entry in the Abstract Data Types folder. In addition to the standard abstract data type properties, a user-dened type has the following additional properties available on the Microsoft tab:
Name Description
Assembly
Species the assembly to bind with the abstract data type. Scripting name: Assembly
Mandatory
Species whether the type can hold a null value. Scripting name: Mandatory
CLR procedures and functions In Microsoft SQL Server 2005, you can write user-dened functions in any Microsoft .NET Framework programming language, such as Microsoft Visual Basic .NET or Microsoft Visual C#. PowerDesigner models CLR procedures and functions as standard procedures that use a CLR template, and are linked to a method from an associated OOM.
Creating a CLR procedure or function
To create a CLR procedure or function, you must have already created an assembly (see CLR assemblies on page 555) and you must have an OOM open in the workspace, in order to specify an associated class method. O To create a CLR procedure or function 1. Create a standard procedure or function. 2. On the Denition Tab of its property sheet, select CLR Procedure or CLR Function from the template list. A Class method eld will be displayed to the right of the template list. 3. Click the Select Method tool to the right of the Class method eld, in order to specify the associated method. 4. Click the Microsoft tab and select an assembly from the list to bind to the procedure or function. 559
You can modify an objects properties from its property sheet. To open a CLR procedure or function property sheet, double-click its diagram symbol or its Browser entry in the Procedures folder. The following extended attributes are available on the Microsoft tab:
Name Description
Assembly
Species the assembly where the class method is dened. Scripting name: Assembly
CLR triggers The Microsoft SQL Server integration with the .NET Framework common language runtime (CLR), allows you to use any .NET Framework language to create CLR triggers. PowerDesigner CLR triggers as standard triggers that use a CLR template, and are linked to a method from an associated OOM.
Creating a CLR trigger
To create a CLR trigger, you must have already created an assembly (see CLR assemblies on page 555) and you must have an OOM open in the workspace, in order to specify an associated class method. O To create a CLR trigger 1. Create a standard trigger. 2. On the Denition Tab of its property sheet, select CLR Trigger from the template list. A Class method eld will be displayed to the right of the template list. 3. Click the Select Method tool to the right of the Class method eld, in order to specify the associated method. 4. Click the Microsoft tab and select an assembly from the list to bind to the trigger. 5. Click OK to close the property sheet.
You can modify an objects properties from its property sheet. To open a CLR trigger property sheet, double-click its Browser entry. The following extended attributes are available on the SQL Server tab:
560
Name
Description
Assembly
Species the assembly where the class method is dened. Scripting name: Assembly
Encryption
SQL Server 2005 uses a new security infrastructure that supports hierarchical encryption and key management. PowerDesigner supports encryption with certicates and asymmetric and symmetric keys. Certicates A public key certicate, usually just called a certicate, is a digitally-signed statement that binds the value of a public key to the identity of the person, device, or service that holds the corresponding private key. Certicates are issued and signed by a certication authority (CA). The entity that receives a certicate from a CA is the subject of that certicate. PowerDesigner models certicates as extended objects with a stereotype of <<Certicate>>.
Creating a certicate
You can create a certicate in any of the following ways: Select Model Certicates to access the List of Certicates, and click the Add a Row tool. Right-click the model or package in the Browser, and select New Certicate.
Certicate properties
You can modify an objects properties from its property sheet. To open a certicate property sheet, double-click its diagram symbol or its Browser entry in the Certicates folder. The following extended attributes are available on the Microsoft tab:
Name Description
Authorization
Species the name of a user as the owner of the certicate. Scripting name: Authorization
Assembly
Species a signed assembly that has already been loaded into the database. Scripting name: Assembly
561
Name
Description
Assembly File
Species the complete path, including le name, to a DER encoded le that contains the certicate. The path name can be a local path or a UNC path to a network location. The le will be accessed in the security context of the SQL Server service account. This account must have the required le system permissions. Scripting name: AssemblyFile
Executable
If the EXECUTABLE option is used, the le is a DLL that has been signed by the certicate. Scripting name: Executable
File
Species the complete path, including le name, to the private key. The private key path name can be a local path or a UNC path to a network location. The le will be accessed in the security context of the SQL Server service account. This account must have the necessary le system permissions. Scripting name: PrivateKeyFile
Species the password that will be used to encrypt the private key. Scripting name: PrivateKeyEncryptionPassword
Decryption password
Species the password required to decrypt a private key that is retrieved from a le. Scripting name: PrivateKeyDecryptionPassword
Subject
Species the value of the subject eld in the metadata of the certicate as dened in the X.509 standard. Scripting name: Subject
Encryption password
Use this option only if you want to encrypt the certicate with a password. Scripting name: EncryptionPassword
Star date
Species the date on which the certicate becomes valid. If not specied, StartDate will be set equal to the current date. Scripting name: StartDate
Expiry date
Species the date on which the certicate expires. If not specied, ExpiryDate will be set to a date one year after StartDate. Scripting name: ExpiryDate
562
Name
Description
Species that the certicate is available to the initiator of a Service Broker dialog conversation. Scripting name: ActiveForBeginDialog
Asymmetric keys An asymmetric key is made up of a private key and the corresponding public key. Each key can decrypt data encrypted by the other. Asymmetric encryption and decryption are relatively resource-intensive, but they provide a higher level of security than symmetric encryption. An asymmetric key can be used to encrypt a symmetric key for storage in a database. PowerDesigner models OBJECTS as extended objects with a stereotype of <<AsymmetricKey>>.
Creating an asymmetric key
You can create an asymmetric key in any of the following ways: Select Model Asymmetric Keys to access the List of Asymmetric Keys, and click the Add a Row tool. Right-click the model or package in the Browser, and select New Asymmetric Key.
You can modify an objects properties from its property sheet. To open an asymmetric key property sheet, double-click its diagram symbol or its Browser entry in the Asymmetric Keys folder. The following extended attributes are available on the Microsoft tab:
Name Description
Authorization
Species the name of a user as the owner of the asymmetric key. Scripting name: Authorization
Assembly
Species the name of an assembly from which to load the public key. Scripting name: Assembly
Assembly le
Species the path of a le from which to load the key. Scripting name: AssemblyFile
563
Name
Description
Executable
If the EXECUTABLE option is used, the le attribute species an assembly le from which to load the public key, otherwise the le attribute species the path of a strong name le from which to load the key pair. Scripting name: Executable
Algorithm
Species the algorithm used to encrypt the key. Scripting name: Algorithm
Encryption password
Species the password with which to encrypt the private key. If this clause is not present, the private key will be encrypted with the database master key. Scripting name: EncryptionPassword
Symmetric keys A symmetric key is one key that is used for both encryption and decryption. Encryption and decryption by using a symmetric key is fast, and suitable for routine use with sensitive data in the database. PowerDesigner models symmetric keys as extended objects with a stereotype of <<SymmetricKey>>.
Creating a symmetric key You can create a symmetric key in any of the following ways:
Select Model Symmetric Keys to access the List of Symmetric Keys, and click the Add a Row tool. Right-click the model or package in the Browser, and select New Symmetric Key.
Symmetric key properties
You can modify an objects properties from its property sheet. To open a symmetric key property sheet, double-click its diagram symbol or its Browser entry in the Symmetric Keys folder. The following extended attributes are available on the Microsoft tab:
Name Description
Authorization
Species the name of a user or role as the owner of the key. Scripting name: Authorization
Certicate
Species the name of the certicate that will be used to encrypt the symmetric key. Scripting name: Certicate
564
Name
Description
Password
Species a password from which to derive a TRIPLE_DES key with which to secure the symmetric key. Password complexity will be checked. You should always use strong passwords. Scripting name: Password
Symmetric key
Species a symmetric key to be used to encrypt the key that is being created. Scripting name: SymmetricKey
Asymmetric key
Species an asymmetric key to be used to encrypt the key that is being created. Scripting name: AsymmetricKey
Key source
Species a pass phrase from which to derive the key. Scripting name: KeySource
Algorithm
Species the algorithm used to encrypt the key Scripting name: Algorithm
Identity value
Species an identity phrase from which to generate a GUID for tagging data that is encrypted with a temporary key. Scripting name: IdentityValue
You can create a full-text catalog in any of the following ways: Select Model Full-Text Catalogs to access the List of Full Text Catalogs, and click the Add a Row tool. Right-click the model or package in the Browser, and select New Full Text Catalog.
565
You can modify an objects properties from its property sheet. To open a full-text catalog property sheet, double-click its diagram symbol or its Browser entry in the Full Text Catalogs folder. The following extended attributes are available on the Microsoft tab:
Name Description
Authorization
Species the name of a user or role as the owner of the full text catalog. Scripting name: Authorization
File group
Species the name of the SQL Server legroup (or storage) of which the new catalog will be part. Scripting name: FileGroup
Path
Species the root directory for the catalog. Scripting name: Path
Accent sensitivity
Species whether the catalog is accent sensitive for full text indexing. Scripting name: AccentSensitivity
Default
Species that the catalog is the default catalog. Scripting name: Default
Full-text indexes A full-text index stores information about signicant words and their location within a given column. This information is used to quickly compute full-text queries that search for rows with particular words or combinations of words. PowerDesigner models full-text indexes as table indexes with an index type set to Full Text.
Creating a full-text index
O To create a full-text index 1. Create an index by opening the property sheet of a table, clicking the Indexes tab and clicking the Add a Row tool. 2. Open the property sheet of the new index by clicking the properties tool, and then select FULLTEXT from the list of Types on the General tab. 3. Click the Select Class tool to the right of the Class eld, in order to specify a supertype.
566
4. Click the Microsoft tab and select a catalog from the list and then specify the type of change tracking required. 5. Click OK to conrm your changes and close the property sheet.
Full-text index properties
You can modify an objects properties from its property sheet. To open a full-text index property sheet, double-click its Browser entry. In addition to the standard index properties, a full-text index has the following additional properties available on the Microsoft tab:
Name Description
Catalog
Species the full text catalog where the full text index is dened. Scripting name: FullTextCatalog
Change tracking
Species whether or not SQL Server maintains a list of all changes to the indexed data. You can choose between: manual auto off off, no population Scripting name: ChangeTracking
XML indexing
SQL Server 2005 provides improvements in indexing XML data. PowerDesigner supports these new features through the XML index object. XML indexes PowerDesigner models XML indexes as table indexes with an index type set to XML.
Creating an XML index
O To create an XML index 1. Create an index by opening the property sheet of a table, clicking the Indexes tab and clicking the Add a Row tool. 2. Open the property sheet of the new index by clicking the properties tool, and then select XML from the list of Types on the General tab. 3. Click the Microsoft tab and specify any additional options. 567
You can modify an objects properties from its property sheet. To open an XML index property sheet, double-click its Browser entry. The following extended attributes are available on the Microsoft tab:
Name Description
Primary
Species that this is the primary xml index. Scripting name: XMLPrimary
Primary index
Species the primary XML index to use in creating a secondary XML index. Scripting name: PrimaryXMLIndex
Species the type of the secondary XML index. Scripting name: SecondaryXMLIndexType Species a percentage that indicates how full the Database Engine should make the leaf level of each index page during index creation or rebuild. Scripting name: FillFactor
Overrides the max degree of parallelism conguration option for the duration of the index operation. Use MAXDOP to limit the number of processors used in a parallel plan execution. The maximum is 64 processors. Scripting name: MaxDop
Pad index
Species whether distribution statistics are recomputed. Scripting name: StatisticsNoRecompute Species that the named, preexisting clustered, nonclustered, or XML index is dropped and rebuilt. Scripting name: DropExisting
Species whether to store temporary sort results in tempdb. Scripting name: SortInTempDB Species whether row locks are allowed. Scripting name: AllowRowLocks
568
Name
Description
You can create a XML schema collection in any of the following ways: Select Model XML Schema Collections to access the List of XML Schema Collections, and click the Add a Row tool. Right-click the model or package in the Browser, and select New XML Schema Collection.
You can modify an objects properties from its property sheet. To open a XML schema collection property sheet, double-click its diagram symbol or its Browser entry in the XML Schema Collections folder. The following extended attributes are available on the Microsoft tab:
569
Name
Description
Owner
Species the name of a user, role, or schema as the owner of the schema collection. Scripting name: Owner
XML model
Species a PowerDesigner XML model to link to the schema. Scripting name: XMLModel
Content
Species the content of the xml schema. By default this eld contains the %xmlModelContent% template, which represents the content of the linked XML model. Scripting name: Content
XML table columns You can create columns with a type of XML and store XML instances in them.
Creating an XML table column
O To create an XML table column 1. Create a column by opening the property sheet of a table, clicking the Columns tab and clicking the Add a Row tool. 2. Open the property sheet of the new column by clicking the properties tool, and then select XML from the list of Data types on the General tab. 3. Click the Microsoft tab and specify an XLM schema collection and content type. 4. Click OK to conrm your changes and close the property sheet.
XML table column properties
You can modify an objects properties from its property sheet. To open an XML table column property sheet, double-click its Browser entry. The following extended attributes are available on the Microsoft tab:
Name Description
Species an XML schema collection for the type. Scripting name: XMLSchemaCollection
570
Name
Description
Content type
Species the nature of the content to be stored in the column. You can choose between: CONTENT [default] the data can contain multiple top-level elements. DOCUMENT the data can contain only one toplevel element. Scripting name: ContentType
Database mirroring
SQL Server 2005 supports database mirroring, in which the principal server sends, in real-time, blocks of its database log records to the mirror instance which, in the event of failover, can be made available within a few seconds. PowerDesigner supports database mirroring with the following model objects: Databases (Mirroring tab) Endpoints Databases For information about creating a database object, see Creating a database section in the Getting Started with Data Modeling chapter. The following extended attributes are available on the Mirroring tab:
Name Description
Enable mirroring
Partner/ Witness
Species the role that the database will play in the mirroring relationship. You can choose between: Partner the database is either a principal or mirror database. Witness the database acts as a witness to a mirroring relationship. A SET WITNESS clause affects both copies of the database, but can only be specied on the principal server. If a witness is set for a session, a quorum is required to serve the database, regardless of the SAFETY setting. Scripting names: Partner, Witness
571
Name
Description
Options
Species mirroring options for the database. You can choose between: <None> server off failover force_service_allow_data_loss resume safety full safety off suspend timeout Scripting name: MirrorOptions
Server
For partner mirroring, species the server network address of an instance of SQL Server to act as a failover partner in a new database mirroring session. For witness mirroring, species an instance of the Database Engine to act as the witness server for a database mirroring session. Scripting name: MirrorServer
Time-out
[if partner is selected] Species the time-out period in seconds. The time-out period is the maximum time that a server instance waits to receive a PING message from another instance in the mirroring session before considering that other instance to be disconnected. Scripting name: TimeOut
End points An end point encapsulates a transport protocol and a port number, and enables SQL Server to communicate over the network. PowerDesigner models end points as extended objects with a stereotype of <<EndPoint>>.
Creating an end point
You can create an end point in any of the following ways: Select Model End Points to access the List of End Points, and click the Add a Row tool. Right-click the model or package in the Browser, and select New End
572
Point.
End point properties
You can modify an objects properties from its property sheet. To open an end point property sheet, double-click its Browser entry. The following extended attributes are available on the Microsoft tab:
Name Description
Owner
State
Species the state of the endpoint at creation. You can choose between: started stopped disabled Scripting name: State
Protocol: Name
Species the transport protocol to be used by the endpoint. You can choose between: http tcp Scripting name: Protocol
Allows you to enter arguments for the chosen protocol. Scripting name: ProtocolArgument Species the type of content to be sent. You can choose between: soap tsql service_broker database_mirroring Scripting name: Language
Language: Argument
Allows you to enter arguments for the chosen language. Scripting name: LanguageArgument
Service Broker
The service broker manages a queue of services. Applications that use Service Broker communicate by sending messages to one another as part of a conversation. The participants in a conversation must agree on the name 573
and content of each message. PowerDesigner supports service broker through the following objects: Message types - dene the type of data that a message can contain. Contracts - dene which message types an application uses to accomplish a particular task. Queues - store messages. Event notications - execute in response to a DDL statements and SQL Trace events by sending information about these events to a Service Broker service. Services - are specic tasks or sets of tasks. Message types Message types dene the type of data that a message can contain. You create identical message types in each database that participates in a conversation. Message types specify the type of XML validation that SQL Server performs for messages of that type. For arbitrary or binary data, the message type can specify that SQL Server performs no validation. PowerDesigner models message types as extended objects with a stereotype of <<MessageType>>.
Creating a message type You can create a message type in any of the following ways:
Select Model Message Types to access the List of Message Types, and click the Add a Row tool. Right-click the model or package in the Browser, and select New Message Type.
Message type properties
You can modify an objects properties from its property sheet. To open a message type property sheet, double-click its Browser entry. The following extended attributes are available on the Microsoft tab:
574
Name
Description
Authorization
Species a database user or role as the owner of the message type. If the current user is dbo or sa, this may be the name of any valid user or role. Otherwise, it must be the name of the current user, a user that the current user has IMPERSONATE permission for, or a role to which the current user belongs. By default, the message type belongs to the current user. Scripting name: Owner
Validation
Species how the Service Broker validates the message body for messages of this type. You can choose between: none [default] no validation performed empty message must contain no data well_formed_xml message must contain wellformed XML valid_xml with schema collection message must conform to the specied XML schema Scripting name: Validation
Schema
Species the name of the schema to be used for validating the message contents. Scripting name: SchemaCollectionName
Contracts Contracts dene the message types used in a Service Broker conversation and also determine which side of the conversation can send messages of that type. Each conversation follows a contract. The initiating service species the contract for the conversation when the conversation begins. The target service species the contracts that the target service accepts conversations for. PowerDesigner models contracts as extended objects with a stereotype of <<Contract>>. You create an identical contract in each database that participates in a conversation.
Creating a contract
You can create a contract in any of the following ways: Select Model Contracts to access the List of Contracts, and click the Add a Row tool. Right-click the model or package in the Browser, and select New Contract.
575
Contract properties
You can modify an objects properties from its property sheet. To open a contract property sheet, double-click its Browser entry. The following extended attributes are available on the Microsoft tab:
Name Description
Authorization
Species a database user or role as the owner of the contract. If the current user is dbo or sa, this may be the name of any valid user or role. Otherwise, it must be the name of the current user, a user that the current user has IMPERSONATE permission for, or a role to which the current user belongs. By default, the contract belongs to the current user. Scripting name: Owner
The MessageTypes tab lists the message types included in the contract via intermediary message contract objects. You can reuse an existing message contract or create a new one, using the tools on this tab. Once you have added or created a message contract, double-click its entry to open its property sheet. Message contracts Message contracts are intermediary objects that are used to include a single message in multiple contracts. Message contracts are modeled as extended objects with a stereotype of <<MessageContract>>.
Creating a message contract
You can create a message contract in any of the following ways: Use the tools on the MessageTypes tab of a contract property sheet (see Contracts on page 575). Select Model Message Contracts to access the List of Message Contracts, and click the Add a Row tool. Right-click the model or package in the Browser, and select New Message Contract.
You can modify an objects properties from its property sheet. To open a message contract property sheet, double-click its Browser entry. The following extended attributes are available on the Microsoft tab:
576
Name
Description
Sent by
Species which endpoint can send a message of the indicated message type. Contracts document the messages that services can use to have specic conversations. Each conversation has two endpoints: the initiator endpoint, the service that started the conversation, and the target endpoint, the service that the initiator is contacting. Scripting name: Sender
Message type
Queues When a message arrives for a service, Service Broker places the message on the queue associated with the service. PowerDesigner models queues as extended objects with a stereotype of <<Queue>>.
Creating a queue
You can create a queue in any of the following ways: Select Model Queues to access the List of Queues, and click the Add a Row tool. Right-click the model or package in the Browser, and select New Queue.
Queue properties
You can modify an objects properties from its property sheet. To open a queue property sheet, double-click its Browser entry. The following extended attributes are available on the Microsoft tab:
Name Description
Owner
Status
Species that the queue is available. This is the default. If a queue is unavailable, no messages can be added to or removed from it. If you create a queue as unavailable, then no messages can be added to it until it is made available with an ALTER QUEUE statement. Scripting name: Status
577
Name
Description
Retention
Species that all messages sent or received on conversations using this queue are retained in the queue until the conversations have ended. This allows you to retain messages for auditing purposes, or to perform compensating transactions if an error occurs. The default is to not retain messages in the queue in this way. Scripting name: Retention
Activation
Species that a stored procedure is required to activate message processing for the queue. Scripting name: Activation
Status (activation)
Species that Service Broker activates the associated stored procedure when the number of procedures currently running is less than MAX_QUEUE_READERS and when messages arrive on the queue faster than the stored procedures receive messages. This is the default. Scripting name: ActivationStatus
Procedure
Species the name of the stored procedure to activate to process messages in this queue. Scripting name: ActivationProcedureName
MaxQueueReaders
Species the maximum number of instances of the activation stored procedure that the queue can start at the same time. Must be set to between 0 and 32767. Scripting name: ActivationMaxQueueReaders
Execute as
Species the user under which the activation stored procedure runs. SQL Server must be able to check the permissions for this user at the time that the queue activates the stored procedure. You can choose between: SELF - the stored procedure executes as the current user. (The database principal executing this CREATE QUEUE statement.) OWNER - the stored procedure executes as the owner of the queue. Scripting name: ActivationExecuteAs
File group
Species the SQL Server legroup on which to create the queue. Scripting name: FileGroup
578
Event Notications An event notication sends information about a database or server event to a service broker service. Event notications are created only by using Transact-SQL statements. PowerDesigner models event notications as extended objects with a stereotype of <<EventNotication>>.
Creating an event notication
You can create an event notication in any of the following ways: Select Model Event Notications to access the List of Event Notications, and click the Add a Row tool. Right-click the model or package in the Browser, and select New Event Notication.
You can modify an objects properties from its property sheet. To open an event notication property sheet, double-click its Browser entry. The following extended attributes are available on the Microsoft tab:
Name Description
Applies on
Species the scope of the event notication. You can choose between: database the notication res whenever the specied event in the FOR clause occurs anywhere in the instance of SQL Server. server - the notication res whenever the specied event in the FOR clause occurs in the current database. queue - the notication res whenever the specied event in the FOR clause occurs in the current queue. Can be specied only if FOR QUEUE_ACTIVATION or FOR BROKER_QUEUE_DISABLED is also specied. Scripting name: AppliesOn
Queue
Species the queue to which the event notication applies. Available only if Applies on is set to queue. Scripting name: Queue
579
Name
Description
With fan in
Instructs SQL Server to send only one message per event to any specied service for all event notications that: are created on the same event. are created by the same principal (as identied by SID). specify the same service and broker_instance_specier. specify WITH FAN_IN. Scripting name: WithFanIn
Events
Species the name of the event type that causes the event notication to execute. Can be a Transact-SQL DDL, SQL Trace, or Service Broker event type. Scripting name: Events
Service
Species the target service that receives the event instance data. SQL Server opens one or more conversations to the target service for the event notication. This service must honor the same SQL Server Events message type and contract that is used to send the message. See Services on page 580. Scripting name: Service
Instance
Species a service broker instance against which broker_service is resolved. Use current database to specify the service broker instance in the current database. Scripting name: Instance
Services Services are specic tasks or set of tasks. Service Broker uses the name of the service to route messages, deliver messages to the correct queue within a database, and enforce the contract for a conversation. PowerDesigner models services as extended objects with a stereotype of <<Service>>.
Creating a service
You can create a service in any of the following ways: Select Model Services to access the List of Services, and click the Add a Row tool. Right-click the model or package in the Browser, and select New Service.
580
Service properties
You can modify an objects properties from its property sheet. To open a service property sheet, double-click its Browser entry. The following extended attributes are available on the Microsoft tab:
Name Description
Authorization
Queue
Species the queue that receives messages for the service. The queue must exist in the same database as the service. Scripting name: Queue
The Contracts tab lists the contracts with which the service is associated. Routes Routes appear in the routing table for the database. For outgoing messages, Service Broker determines routing by checking the routing table in the local database. For messages on conversations that originate in another instance, including messages to be forwarded, Service Broker checks the routes in msdb. PowerDesigner models routes as extended objects with a stereotype of <<Route>>.
Creating a route
You can create a route in any of the following ways: Select Model Routes to access the List of Routes, and click the Add a Row tool. Right-click the model or package in the Browser, and select New Route.
Route properties
You can modify an objects properties from its property sheet. To open a route property sheet, double-click its Browser entry. The following extended attributes are available on the Microsoft tab:
Name Description
Owner
Remote service
Species the name of the remote service to which the route points. Scripting name: Service
581
Name
Description
Broker instance
Species the database that hosts the target service. Scripting name: BrokerInstance
Lifetime
Species the amount of time, in seconds, that SQL Server retains the route in the routing table. Scripting name: Lifetime
Address
Species the network address for the route. The next_hop_address species a TCP/IP address in the following format: TCP://{ dns_name | netbios_name | ip_address } : port_number Scripting name: Address
Mirror address
Species the network address for a mirrored database with one mirrored database hosted at the next_hop_address. The next_hop_mirror_address species a TCP/IP address in the following format: TCP://{ dns_name | netbios_name | ip_address } : port_number Scripting name: MirrorAddress
Remote service bindings Remote service bindings create a binding that denes the security credentials to use to initiate a conversation with a remote service. PowerDesigner models remote service bindings as extended objects with a stereotype of <<RemoteServiceBinding>>.
Creating a remote service binding
You can create a remote service binding in any of the following ways: Select Model Remote Service Bindings to access the List of Remote Service Bindings, and click the Add a Row tool. Right-click the model or package in the Browser, and select New Remote Service Binding.
You can modify an objects properties from its property sheet. To open a remote service binding property sheet, double-click its Browser entry. The following extended attributes are available on the Microsoft tab:
582
Name
Description
Owner
Remote service
Species the remote service to bind to the user identied in the WITH USER clause. Scripting name: RemoteService
User
Species the database principal that owns the certicate associated with the remote service identied by the TO SERVICE clause. Scripting name: User
Anonymous
Species that anonymous authentication is used when communicating with the remote service. Scripting name: Anonymous
Resource Governor
Resource Governor, available in SQL Server 2008, lets you limit resource requests by workloads for CPU time and memory to optimize their allocation. PowerDesigner supports Resource Governor through the following objects: Workload groups are containers for sets of similar session requests. Resource pools represent the physical resources of the server. Workload groups A workload group serves as a container for session requests that are similar, to allow the aggregate monitoring of resource consumption and the application of a uniform policy to all the requests in the group. A group denes the policies for its members. PowerDesigner models workload group sas extended objects with a stereotype of <<WorkloadGroup>>.
Creating a workload group
You can create a workload group binding in any of the following ways: Select Model Workload groups to access the List of Workload Groups, and click the Add a Row tool. Right-click the model or package in the Browser, and select New Workload Group.
You can modify an objects properties from its property sheet. To open a workload group property sheet, double-click its Browser entry. 583
Importance
Species the relative importance of a request in the workload group. Scripting name: Importance
Species the maximum amount of memory that a single request can take from the pool. Scripting name: RequestMaxMemoryGrantPercent
Species the maximum amount of CPU time, in seconds, that a request can use. Scripting name: RequestMaxCpuTimeSec
Species the maximum time, in seconds, that a query can wait for a memory grant (work buffer memory) to become available. Scripting name: RequestMemoryGrantTimeoutSec
Species the maximum degree of parallelism (DOP) for parallel requests. Scripting name: MaxDop
Maximum requests
Species the maximum number of simultaneous requests that are allowed to execute in the workload group. Scripting name: GroupMaxRequests
Resource pool
Associates the workload group with the specied resource pool. Scripting name: ResourcePool
Resource pools A resource pool represents the physical resources of the server. PowerDesigner models resource pools as extended objects with a stereotype of <<ResourcePool>>.
Creating a resource pool
You can create a resource pool in any of the following ways: Select Model Resource Pools to access the List of Resource pools, and click the Add a Row tool. Right-click the model or package in the Browser, and select New Resource Pool.
584
Resource pool properties You can modify an objects properties from its property sheet. To open a
resource pool property sheet, double-click its Browser entry. The following extended attributes are available on the Microsoft tab:
Name Description
Species the guaranteed average CPU bandwidth for all requests in the resource pool when there is CPU contention. The value is an integer, with a default setting of 0. Scripting name: MinCpuPercent
Species the maximum average CPU bandwidth that all requests in resource pool will receive when there is CPU contention. The value is an integer, with a default setting of 100. Scripting name: MaxCpuPercent
Species the minimum amount of memory reserved for this resource pool that can not be shared with other resource pools. The value is an integer, with a default setting of 0. Scripting name: MinMemoryPercent
Species the total server memory that can be used by requests in this resource pool. The value is an integer, with a default setting of 100. Scripting name: MaxMemoryPercent
Synonyms
PowerDesigner supports SQL Server 2005 synonyms through the standard synonym object. Synonyms can be created for the following types of objects: Assembly (CLR) Stored Procedure Assembly (CLR) Table-valued Function Assembly (CLR) Scalar Function Assembly Aggregate (CLR) Aggregate Functions Replication-lter-procedure Extended Stored Procedure 585
SQL Scalar Function SQL Table-valued Function SQL Inline-table-valued Function SQL Stored Procedure View Table For more information about synonyms, see the Building Physical Diagrams chapter.
586
Source data for multidimensional cubes resides in relational databases where the data has been transformed into a star or snowake schema typically used in OLAP data warehouse systems. Analysis Services can work with many relational databases that support connections using ODBC or OLE DB.
587
The following table lists the mappings between the objects contained within the DSO and PowerDesigner PDM metamodels:
DSO Object PowerDesigner PDM Object
clsDatabase
clsDataSource ClsDatabaseDimension
Data source Dimension (As in the DSO model, PowerDesigner dimensions are shared among cubes.) Cube (Cubes managed by PowerDesigner are only local cubes.)
clsCube
588
DSO Object
clsCube
clsCubeMeasure clsDatabaseDimension
Measure Dimension hierarchy (Each dimension hierarchy is generated as a DSO Database Dimension. Attributes of a dimension hierarchy dene levels of the corresponding DatabaseDimension.) Dimension attribute (Attributes of a dimension or dimension hierarchy dene levels in a database dimension.) Cube dimension association (In DSO, when the name of a Cube Dimension corresponds to the name of a Database Dimension, the Cube Dimension is automatically associated with the Database Dimension to be shared between cubes.)
clsDatabaseLevel clsCubeLevel
clsCubeDimension
Generating cubes The Microsoft Analysis Services add-in lets you generate cubes. O To generate cubes 1. Select Tools Microsoft Analysis Services Generate Cubes to open the connection dialog box.
2. Enter a name for the server and database, and then click OK to open the Cube Selection dialog box, which lists all the available cubes. The state column indicates if the cube has already been generated. Cubes already generated are deselected by default.
589
3. Select the cubes you want to generate, and then click OK. The selected cubes are generated. If a cube already exists in the database, it is dropped before being recreated. If a dimension already exists, the selected cube reuses it. To be fully generated, a cube must have a complete mapping to a table before being generated. Reverse Engineering cubes The Microsoft Analysis Services add-in lets you reverse engineer cubes. O To reverse engineer cubes 1. Select Tools Microsoft Analysis Services Reverse Engineer Cubes to open the connection dialog box.
2. Enter a name for the server and database, and then click OK to open the Source Model Selection dialog box, which lists the models linked to the selected data source.
590
3. Select the appropriate source models and then click OK to open the Cube Selection dialog box, which lists all the available cubes. The state column indicates if the cube already exists in the current model. Cubes already existing are deselected by default.
4. Select the cubes you want to reverse engineer, and then click OK. 591
The selected cubes are created or updated in the current model. If a dimension or a cube already exists, it is updated.
In order to use the analysis services add-in to generate and reverse-engineer cubes, you must have installed the SQL Server 2005 Management Tools client component. O To enable PowerDesigner support for Analysis Services 1. Select Tools General Options, and select the Add-ins category in the left-hand pane. 2. Select the Microsoft SQL Server 2005 Analysis Services add-in (PowerDesigner.AddIn.Pdm.SQLServer.dll) and then click OK to install it and return to the model.
592
O To specify a data source for a cube 1. Create a data source in your PDM from the List of data sources or by right-clicking the model in the browser and selecting New Data Source from the contextual menu. 2. Select the OLE DB tab and specify the kind of data provider.
3. Click the ellipsis tool to the right of the connection string eld to open the provider-specic conguration dialog.
593
4. Complete the parameters appropriately, click Apply to Connection String, and then Test Connection. Then click Ok to return to the data source property sheet. 5. Click OK to return to your model. When you have created the appropriate data sources, you can proceed with generating your cubes.
594
O To generate cubes 1. Select Tools Microsoft SQL Server 2005 Analysis Services Generate Cubes to open the wizard.
Click Next to continue. 2. Enter a server name, and select the database you want to generate to:
595
Click Next to continue. 3. The Select Cubes page lists the cubes available in the model, along with whether they currently exist in the database. Select the cubes you want to generate:
596
Click Next to continue. 4. The Generate Cubes page lists the cubes to be generated:
Click Finish to begin generation. Progress is displayed in the wizard, which will close automatically after successful completion. If a cube already exists in the database, it is dropped and recreated. If a related dimension already exists, it is reused. To fully generate a cube, your model must include a complete mapping to a table. Reverse engineering Microsoft SQL Server 2005 cubes The Microsoft SQL Server 2005 Analysis Services add-in enables the reverse engineering of cubes. Before reverse-engineering cubes, you should create one or more PDMs to model the tables which provide its data. As part of the reverse-engineering process, PowerDesigner will create links from the reversed cubes to these tables.
597
O To reverse engineer cubes 1. Select Tools Microsoft SQL Server 2005 Analysis Services Reverse Engineer Cubes to open the wizard.
Click Next to continue. 2. Enter a server name, and select the database you want to reverse from:
598
Click Next to continue. 3. The Select Cubes page lists the available cubes. Select the cubes you want to reverse engineer and then click Next to continue:
599
4. The Congure Data Sources page lists the data sources that are required to populate the selected cubes. For each source, select the Physical Data Model in which the tables are modeled, and then click Next to continue:
600
Click Finish to begin reverse-engineering. Progress is displayed in the wizard, which will close automatically after successful completion.
Species that NOT FOR REPLICATION keywords are used to prevent the CHECK constraint from being enforced during the distribution process used by replication. Scripting name: ExtCkcNotForReplication Contains the name of the constraint that is used to apply a default value to the column. If empty, the constraint keyword is not generated. Scripting name: ExtDeftConstName
Is a string composed of two integer values separated by a comma. First value is the seed value of the identity column, meaning the value to be assigned to the rst row in the table. Second value is the increment to add to the seed value for successive rows in the table. Scripting name: ExtIdentitySeedInc
Indicates that the IDENTITY property should not be enforced when a replication login inserts data into the table. Scripting name: ExtIdtNotForReplication
601
Name
Description
Contains the name of the constraint that is used to apply a mandatory property of the column. If empty, the constraint keyword is not generated. Scripting name: ExtNullConstName
[v2000 and higher] Indicates that the new column is a row global unique identier column. Only one unique identier column per table can be designated as the ROWGUIDCOL column. Scripting name: ExtRowGuidCol
Collation name
[v2005 and higher] A single string that species the collation name for a SQL collation. Scripting name: ExtCollation
[v2000 and higher] Applies only to the XML data type for associating an XML schema collection with the type. Scripting name: XMLSchemaCollection
Content type
[v2005 and higher] - CONTENT: Species that each instance of the XML data type in column_name can contain multiple top-level elements. CONTENT applies only to the XML data type and can be specied only if xml_schema_collection is also specied. If not specied, CONTENT is the default behavior. - DOCUMENT: Species that each instance of the XML data type in column_name can contain only one top-level element. DOCUMENT applies only to the XML data type and can be specied only if xml_schema_collection is also specied. Scripting name: ContentType
Cubes
602
Name
Description
Options
[v2000] You can choose between the following: PASSTHROUGH: causes the SELECT clause to be passed directly to the source database without modication by PivotTable Service. If PASSTHROUGH is not specied, PivotTable Service parses the query and formulates a set of queries equivalent to the original that is optimized for the source database and index structures. This set of queries is often more efcient than the specied. DEFER_DATA: causes the query to be parsed locally and executed only when necessary to retrieve data to satisfy a user request. DEFER_DATA is used to specify that a local cube has to be dened in the ROLAP storage mode. ATTEMPT_DEFER: causes PivotTable Service to attempt to parse the query and defer data loading if successful, or, if the query cannot be parsed, to process the specied query immediately as if PASSTHROUGH had been specied. ATTEMPT_ANALYSIS: causes PivotTable Service to attempt to parse the query and formulate an optimized set of queries. If the query cannot be parsed, PivotTable Services processes the query immediately as if PASSTHROUGH had been specied. Scripting name: Options
[v2005 and higher] Species the storage mode for the cube. Scripting name: StorageMode [v2005 and higher] Determines the visibility of the Cube. Scripting name: Visible
Dimensions
Hidden
[v2000] Indicates whether the dimension is hidden from clients. Scripting name: IsHidden
603
Name
Description
Options
[v2000] Dimension options to manage member uniqueness and specify their storage. You can choose between: UNIQUE_NAME: Member names are unique within the dimension. UNIQUE_KEY: Member keys are unique within the dimension. NOTRELATEDTOFACTTABLE: Indicates that non-leaf members cannot be associated with fact table data. ALLOWSIBLINGSWITHSAMENAME: Determines whether children of a single member in a hierarchy can have identical names. Scripting name: Options
Subtype
[v2000] Indicates the subtype of a dimension. You can choose between: PARENT_CHILD:Indicates that the dimension is a parentchild dimension. LINKED: Indicates that the cube is linked to another cube on a remote Analysis server. MINING: Indicates that the dimension is based on the content of an OLAP data-mining model that has been processed for a cube. Scripting name: SubType
Template
[v2000] Contains a template string that is used to generate captions for system-generated data members. Scripting name: Template
604
Name
Description
Time
[v2000] Indicates that a dimension refers to time (year, month, week, day, and so on). You can choose between: TIME: Year, month, week, day, and so on. The only valid levels in a time dimension are those dened in the LevelTypes enumeration. The following values post-xed by an asterisk (*) are additional values that can be used by the add-in but do not exist in the MDX syntax. You can choose between a dimension that contains: ACCOUNT: (*) an account structure with parent-child relationships. BILLOFMATERIALS (*): a material/component breakdown. The parent-child relationship implies a parent composed of its children. CHANNEL (*): a distribution channel. CURRENCY (*): currency information. CUSTOMERS (*): customer information. The lowest level represents individual customers. GEOGRAPHY (*): a geographic hierarchy. ORGANIZATION (*): the reporting structure of an organization. PRODUCTS (*): product information. The lowest level represents individual products. PROMOTION (*): marketing and advertising promotions. QUANTITATIVE (*): quantitative elements (such as example, income level, number of children, and so on). RATES (*): different types of rates (for example, buy, sell, discounted. and so on). SCENARIO (*): different business scenarios. Scripting name: TimeDef
Type
[v2005 and higher] Provides information about the contents of the dimension. Scripting name: Type
Storage mode
[v2005 and higher] Determines the storage mode for the parent element. Scripting name: StorageMode
[v2005 and higher] Contains the caption, in the default language, Atfor tributeAllMem- the All member of the dimension. berName Scripting name: AttributeAllMemberName
605
Name
Description
WriteEnabled
[v2005 and higher] Indicates whether dimension writebacks are available (subject to security permissions). Scripting name: WriteEnabled
Dimension Attributes
[v2000] Contains a Multidimensional Expressions (MDX) expression used to override the default roll-up mode. Scripting name: CustomRollupExpr [v2000] Name of the column or expression that contains member keys. Scripting name: FormatKey
Format name
[v2000] Name of the column or expression that contains member names. Scripting name: FormatName
Hide values
[v2000] Options to hide level members. You can choose between: BLANK_NAME: Hides a level member with an empty name. PARENT_NAME: Hides a level member when the member name is identical to the name of its parent. ONLY_CHILD_AND_BLANK_NAME: Hides a level member when it is the only child of its parent and its name is null or an empty string. ONLY_CHILD_AND_PARENT_NAME: Hides a level member when it is the only child of its parent and is identical to the name of its parent. Scripting name: HideValues
Hidden
[v2000] Indicates whether the level is hidden from client applications. Scripting name: IsHidden
606
Name
Description
Options
[v2000] Options about member uniqueness, ordering and data source. You can choose between: UNIQUE: Indicates that the members of a level are unique. UNIQUE_NAME: Indicates that their member name columns uniquely identify the level members. UNIQUE_KEY: Indicates that their member key columns uniquely identify the level members. NOTRELATEDTOFACTTABLE: Indicates that the level members cannot be associated with fact table data. SORTBYNAME: Indicates that level members are ordered by their names. SORTBYKEY: Indicates that level members are ordered by their keys. SORTBYPROPERTY <property names>: Indicates that members are ordered by their property <property names>. Scripting name: Options
Root values
[v2000] Determines how the root member or members of a parent-child hierarchy are identied. You can choose between: ROOT_IF_PARENT_IS_BLANK: Only members with a null, a zero, or an empty string in their parent key column are treated as root members. ROOT_IF_PARENT_IS_MISSING: Only members with parents that cannot be found are treated as root members. ROOT_IF_PARENT_IS_SELF: Only members having themselves as parents are treated as root members. ROOT_IF_PARENT_IS_BLANK _OR_SELF_OR_MISSING: Members are treated as root members if they meet one or more of the conditions specied by ROOT_IF_PARENT_IS_BLANK, ROOT_IF_PARENT_IS_SELF, or ROOT_IF_PARENT_IS_MISSING. Scripting name: RootValues
607
Name
Description
Type
[v2000 and higher] Identies the specic type of level. You can choose between: ALL: Indicates the top (All) level of a dimension (the one that precalculates all the members of all lower levels). YEAR: a level that refers to years (Time dimension only). QUARTER: a level that refers to (calendar) quarters (Time dimension only). MONTH: a level that refers to months (Time dimension only). WEEK: a level that refers to weeks (Time dimension only). DAY: a level that refers to days (Time dimension only). DAYOFWEEK: a level that refers to days of the week (Time dimension only). DATE: a level that refers to dates (Time dimension only). HOUR: a level that refers to hours (Time dimension only). MINUTE: a level that refers to minutes (Time dimension only). SECOND: Indicates that a level refers to seconds (Time dimension only). Scripting name: Type
MembersWithData OrderBy
[v2005 and higher] Determines whether to display data members for non-leaf members in the parent attribute. Scripting name: MembersWithData [v2005 and higher] Describes how to order the members contained in the attribute. Scripting name: OrderBy
MemberNamesUnique IsAggregatable
[v2005 and higher] Determines whether member names under the parent element must be unique. Scripting name: MemberNamesUnique [v2005 and higher] Species whether the values of the DimensionAttribute element can be aggregated. Scripting name: IsAggregatable
AttributeHierarchyEnabled
[v2005 and higher] Determines whether an attribute hierarchy is enabled for the attribute. Scripting name: AttributeHierarchyEnabled
608
Name
Description
AttributeHierarchyVisible
[v2005 and higher] Determines whether the attribute hierarchy is visible to client applications. Scripting name: AttributeHierarchyVisible
Databases
Primary
Species that the associated le specication list denes the primary le. Scripting name: Primary
File
Filegroup
Gets or sets the Filegroup specication. Scripting name: FileGroupFileSpec Gets or sets the log le specication. Scripting name: LogOnFileSpec
Collation name
[v2000 and higher] Species the default collation for the database. Collation name can be either a Windows collation name or a SQL collation name. Scripting name: Collate
Attach
Species that a database is attached from an existing set of operating system les. Scripting name: ForAttach
609
Name
Description
With
[v2005 and higher] Controls Service Broker options on the database. Service Broker options can only be specied when the FOR ATTACH clause is used. ENABLE_BROKER: Species that Service Broker is enabled for the specied database. NEW_BROKER: Creates a new service_broker_guid value in both sys.databases and the restored database and ends all conversation endpoints with clean up. The broker is enabled, but no message is sent to the remote conversation endpoints. ERROR_BROKER_CONVERSATIONS: Ends all conversations with an error stating that the database is attached or restored. The broker is disabled until this operation is completed and then enabled. Scripting name: ForAttachWith
[v2005 and higher] Species that the database is created by attaching an existing set of operating system les. Scripting name: ForAttachRebuildLog
Database chaining
[v2005 and higher] When ON is specied, the database can be the source or target of a cross database ownership chain. When OFF, the database cannot participate in cross database ownership chaining. The default is OFF. Scripting name: WithDbChaining
Trust worthy
[v2005 and higher] When ON is specied, database modules (for example, views, user-dened functions, or stored procedures) that use an impersonation context can access resources outside the database. When OFF, database modules in an impersonation context cannot access resources outside the database. The default is OFF. Scripting name: WithTrustworthy
Snapshot of
[v2005 and higher] Species the name of the new database snapshot. Scripting name: AsSnapshotOf
610
Name
Description
Load
[up to v2000] Indicates that the database is created with the dbo use only database option turned on, and the status is set to loading. Scripting name: ForLoad
For information about the extended attributes available on the Mirroring tab, see Database mirroring on page 571.
Data Sources
Data provider
Species the data provider. You can choose between: .NET Framework Data Provider for Microsoft SQL Server .NET Framework Data Provider for Oracle Native Data Provider for OLE DB Scripting name: DataProvider
Connection string
Server name
Authentication
[only for SQL Server] Species the Windows Authentication and SQL Server Authentication types. Scripting name: AuthenticationType
User name
Password
Initial catalog
[only for SQL Server and OLE DB] Species the Initial catalog. Scripting name: InitialCatalog
611
Name
Description
Database File
[only for SQL Server] Species a Microsoft SQL Server database le if you select an MSSQL connection. Scripting name: MSSQLDatabaseFile
Logical name
[only for SQL Server] Species the logical name of the selected database le. Scripting name: LogicalName
[only for OLE DB] Species the data provider. Scripting name: DataProvider [only for OLE DB] Species the location for OLEDB. Scripting name: Location
[only for OLE DB] Species that security information be persistent. Scripting name: PersistSecurityInfo
[only for OLE DB] Species whether to use windows NT Integrated Security or not. Scripting name: UseNTIntegratedSecurity
Dimension Hierarchies
Hidden
[v2000] Indicates whether the hierarchy is hidden from client applications. Scripting name: IsHidden
AllMemberName
[v2005 and higher] Contains the caption in the default language for the All member of a Hierarchy element. Scripting name: AllMemberName
MemberNamesUnique AllowDuplicateNames
[v2005 and higher] Determines whether member names under the parent element must be unique. Scripting name: MemberNamesUnique [v2005 and higher] Determines whether duplicate names are allowed in a Hierarchy element. Scripting name: AllowDuplicateNames
612
Fact Measures
Format
[v2000] Format used to display the values of the cube measure. Scripting name: Format
[v2000] A value corresponding to the type of aggregate function used by the cube measure. Scripting name: Function
Hidden
[v2000] Indicates whether the measure is visible to the client. Scripting name: IsHidden
[v2000] Order in which the calculated member will be solved when calculated members intersect each other. Scripting name: SolveOrder
[v2000] Returns an OLE DB enumeration constant that identies the SourceColumn (in the fact table) data type. Scripting name: Type
AggregateFunction
[v2005 and higher] Denes the common prex to be used for aggregation names throughout the associated parent element. Scripting name: AggregateFunction
BindingType
[v2005 and higher] Denes the binding type for the measure. Scripting name: BindingType
Visible
[v2005 and higher] Determines the visibility of the Fact Measure. Scripting name: Visible
FormatString
[v2005 and higher] Describes the display format for a CalculationProperty or a Measure element. Scripting name: FormatString
Indexes
613
Name
Description
Filegroup
Partition scheme
[v2005 and higher] Species the name of the partition scheme. Scripting name: PartitionScheme
Column
[v2005 and higher] Species the partitioned column. Scripting name: PartitionSchemeColumn
Fill factor
Species a percentage that indicates how full the Database Engine should make the leaf level of each index page during index creation or rebuild. Scripting name: FillFactor
[v2005 and higher] Overrides the max degree of parallelism conguration option for the duration of the index operation. Use MAXDOP to limit the number of processors used in a parallel plan execution. The maximum is 64 processors. Scripting name: MaxDop
Pad index
Species whether distribution statistics are recomputed. Scripting name: StatisticsNoRecompute Species that the named, preexisting clustered, nonclustered, or XML index is dropped and rebuilt. Scripting name: DropExisting
Online
[v2005 and higher] Species whether underlying tables and associated indexes are available for queries and data modication during the index operation. Scripting name: Online
[v2005 and higher] Species whether to store temporary sort results in tempdb. Scripting name: SortInTempDB
[v2005 and higher] Species whether row locks are allowed. Scripting name: AllowRowLocks
614
Name
Description
[v2005 and higher] Species whether page locks are allowed. Scripting name: AllowPageLocks
Species the error response to duplicate key values in a multiple row insert operation on a unique clustered or unique nonclustered index. Scripting name: IgnoreDupKey
If the index is not a cluster index, then the Include tab is displayed, allowing you to specify the columns with which it is associated.
Keys
Filegroup
Fill Factor
Species how full SQL Server should make each index page used to store the index data. Scripting name: FillFactor
References
Species that NOT FOR REPLICATION keywords are used to prevent the FOREIGN KEY constraint from being enforced during the distribution process used by replication. Scripting name: ExtFkNotForReplication
File group
Partition scheme
[v2005 and higher] Species the name of the partition scheme. Scripting name: PartitionScheme
615
Name
Description
Column
[v2005 and higher] Species the name of the partitioned column. Scripting name: PartitionSchemeColumn
Text/Image on
Species the name of the legroup where text and image are stored. Scripting name: TextImageOn
Species that NOT FOR REPLICATION keywords are used to prevent the TABLE CHECK constraint from being enforced during the distribution process used by replication. Scripting name: ExtCktNotForReplication
Users
The following extended attributes are available on the Microsoft tab with the stereotype <<schema>> (v2005 and higher):
Name Description
Schema owner
Species the name of the database-level principal user that will own the schema. This principal may own other schemas, and may not use the current schema as its default schema. Scripting name: SchemaOwner
Views
Encryption option
Denes the encryption option of the view, respecting the view creation syntax. Scripting name: WithOption
616
MySQL
This section describes features specic to the MySQL family of databases.
Deprecated versions
The DBMSs for MySQL v3.22 and 3.23 are deprecated. Note that when developing for MySQL and using double quotes as a delimiter, it is necessary to set the sql_mode to ANSI_QUOTES:
SET sql_mode=ANSI_QUOTES
Character set
Collation
Set of rules for comparing characters in a character set. Scripting name: Collate
National
A way to indicate that a CHAR column should use UTF8 character set. Scripting name: National
Unsigned
Indicates negative values are not allowed for the column. Scripting name: Unsigned
When displayed, the default padding of spaces is replaced with zeros. For example, for a column declared as INT(5) ZEROFILL, a value of 4 is retrieved as 00004. If you specify ZEROFILL for a numeric column, MySQL automatically adds the UNSIGNED attribute to the column. Scripting name: ZeroFill
Indexes
617
MySQL
Name
Description
Indicates that the index is a full text index. Scripting name: FullText
Unique key
When set to True, indicates that the key is unique. False implies that the key allows duplicate values. Scripting name: ExtUnique
Models
Indicates the type of the database, as specied in the extended attribute type DatabaseType. Scripting name: DatabaseType
Indicates the reference match type, as specied in the extended attribute type ReferenceMatchType. Scripting name: ReferenceMatch
618
NonStop SQL
This section describes features specic to the NonStop SQL family of databases.
The following extended attributes are available on the Extended Attributes tab:
Name Description
[none]
Species an extended type for columns, listed in extended attribute type TExtType. Scripting name: ExtType
619
Oracle
Oracle
This section describes features specic to the Oracle family of databases:
Deprecated versions
For more information about bitmap join indexes, see your Oracle
documentation. You can design a bitmap join index either automatically or manually. Automatically creating bitmap join indexes through rebuilding You can automatically generate a bitmap join index for each fact table and the dimension tables that it references. Each generated bitmap join index consists of the references that link a fact table to all the dimension tables located on a single axis proceeding from the fact table. A reference between two fact tables does not generate any bitmap join index. A bitmap join index is constrained and can only be dened for tables that are organized in a connected tree. O To rebuild bitmap join indexes for all references linked to a fact table 1. Select Tools Rebuild Objects Rebuild Join Indexes to open the Rebuild Join Indexes dialog box, and select one of the following modes: Delete and Rebuild - all existing indexes are deleted before join index rebuild. Preserve - preserves all existing join indexes in the PDM. 2. Click the Selection tab, select one or more fact tables in the list, and then click OK. A conrmation box asks if you want to continue. 3. Click Yes to generate a bitmap join index for each fact table.
Displaying automatically generated bitmap join indexes
Automatically generated bitmap join indexes appear in the list of join indexes. To display the list, select Model Join Indexes. Manually creating bitmap join indexes You can manually create bitmap join indexes from the list of join indexes or via the base table property sheet.
621
Oracle
O To create a bitmap join index in the list of join indexes 1. Select Model Join Indexes to open the List of Join Indexes. 2. Click the Add a Row tool and enter a bitmap join index name in the Name column. 3. Click the Properties tool to open the new bitmap join index property sheet. 4. Select a base table on the General tab, and then click the References tab. 5. Click the Add References tool to open a selection window, which lists the available references depending on the selected base table. Select one or more references in the list, and then click OK. The selected reference is displayed in the References list. 6. Click the Columns tab, and then click the Add Columns tool to open a selection window, which lists the available columns depending on the selected references. Select one or more columns in the list, and then click OK. The selected columns are displayed in the Columns list. 7. Click OK to complete the creation of the bitmap join index and return to the model. You can create a join index or a bitmap join index from the Join Index tab of a table property sheet. The bitmap join index will be based on the table. O To create a bitmap join index from the table property sheet 1. Open the property sheet of a table and click the Join Index tab. 2. Click the Insert a Row or the Add a Row tool to create a new bitmap join index associated with the table. 3. Click the Properties tool to display the new bitmap join index property sheet. The Base table box is initialized with the selected table. Bitmap join index properties A bitmap join index has the following properties:
622
Property
Description
Name Code
The name of the item which should be clear and meaningful, and should convey the items purpose to non-technical users. The technical name of the item used for generating code or scripts, which may be abbreviated, and should not generally include spaces. Additional information about the bitmap join index. Sub-classication among bitmap join indexes. Name of the user who created the bitmap join index. Name of the table that stores the bitmap join index.
The following tabs are also available: Columns tab - The bitmap join index stores information about the columns used for the index. These columns are displayed in the Columns tab of the bitmap join index property sheet. Options tab - You can dene physical options for bitmap join indexes generation. These options override the default physical options dened in the model. You can choose to generate these options by selecting the Physical Options check box in the Join Index groupbox in the Keys and Indexes tab of the Generation dialog box. Adding a column to a bitmap join index You can dene the list of columns involved in the bitmap join index. These columns proceed from the different dimension tables linked to the base table. When you create a bitmap join index manually, you have to select columns using the list of columns in the bitmap index property sheet. When you create a bitmap join index using the rebuild join index feature, the list of columns is initialized with all columns of the tables involved in the join except foreign keys. O To add a column to a bitmap join index 1. Open the bitmap join index property sheet and make sure the bitmap join index has a base table. 2. Click the Columns tab and then click the Add Columns tool. A selection dialog box is displayed, which lists columns to include in the join depending on the selected references.
623
Oracle
3. Select one or more columns in the list and click OK. The columns appear in the list of bitmap join index columns. 4. Click OK. Adding a reference to a bitmap join index You can add a reference to any bitmap join index. You do this, for example, when you create a new reference that you want to include in an existing bitmap join index. O To add a reference to a bitmap join index 1. Select Model Join Indexes to open the List of Join Indexes. 2. Select a bitmap join index in the list and then click the Properties tool to open its property sheet. 3. Click the References tab, and then click the Add References tool. A selection dialog box is displayed. It displays available references depending on the selected base table. 4. Select one or several references in the list. 5. Click OK to add the new reference to the References list: 6. Click OK to close the bitmap join index property sheet.
Database packages
In Oracle, packages encapsulate related procedures, functions, and associated cursors and variables together as a unit in the database. Packages usually have two parts, a specication and a body. The specication is the interface with your applications; it declares the types, variables, constants, exceptions, cursors, and subprograms available for use. The body fully denes cursors and subprograms, and so implements the specication. Packages provide advantages in the following areas: Encapsulation of related procedures and variables in a single named, stored unit in the database. This provides for better organization during the development process and makes privilege management easier. Separation of public and private procedures, variables, constants, and cursors. Better performance since entire package is loaded into memory when an object from the package is called for the rst time. 624
Creating a database package O To create a database package 1. Select Model Database Packages to open the List of Database Packages. 2. Click the Add a Row tool to add a database package to the list, and then click the Properties tool to display its property sheet. 3. Type a name and a code for the database package. 4. [optional] Select an Owner and/or Privilege for the database package. 5. Click OK to complete the creation of the database package. A database package has the following properties:
Property Description
Name Code
The name of the item which should be clear and meaningful, and should convey the items purpose to non-technical users. The technical name of the item used for generating code or scripts, which may be abbreviated, and should not generally include spaces. Additional information about the database package. Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or userdened. Name of database package owner. You choose an owner from a list of users. A database package can only have one owner at a time. Lets you specify whether the functions and procedures in the database package execute with the privileges and in the schema of the user who owns it (dener), or with the privileges and in the schema of CURRENT_USER (invoker).
Comment Stereotype
Owner
Privilege
The following tabs are also available: Procedures tab Lists the procedures associated with the database package (see Database package procedures on page 627). Variables tab - Lists the variables associated with the database package (see Database package variables on page 628). 625
Oracle
Cursors tab - Lists the cursors associated with the database package (see Database package cursors on page 629). Exceptions tab Lists the exceptions associated with the database package (see Database package exceptions on page 630). Types tab - Lists the types associated with the database package (see Database package types on page 630). Initialization tab - Lets you dene initialization code for the database package body. Typically initialization holds statements that initialize database package variables. Initialization takes place after database package creation and compilation in the server. Inserting procedures in a database package A database package is a set of related procedures. When you create a database package, you have to declare the procedures it contains. PowerDesigner differentiates between: A procedure created in the model. A procedure created in a database package. This procedure only exists in the database package and disappears when you delete the package. In this section, we call it package procedure. You can create a package procedure from a model procedure using the copy feature. O To insert procedures in a database package 1. Open the property sheet of the database package and click the Procedures tab. 2. Click the Insert a Row tool if you want to create procedures in the database package.
or
Click the Create from Procedure tool if you want to duplicate existing procedures in the database package. Select the procedures and click OK. The procedures appear in the list. 3. Select a procedure in the list and click the Properties button to open its property sheet. 4. Specify any appropriate properties. 5. Click OK to close the property sheet and return to your model.
626
Database package procedures A package procedure is created in a database package. If you delete the database package you also delete the procedures it contains. A package procedure has the following properties:
Property Description
Name
The name of the item which should be clear and meaningful, and should convey the items purpose to non-technical users. The technical name of the item used for generating code or scripts, which may be abbreviated, and should not generally include spaces. Additional information about the package procedure. Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or user-dened. Name of the database package to which the procedure belongs. Allows you to choose between procedure and function. Allows you to dene the return data type of a function. Allows you to type a compiler directive, that is, a string for specifying compilation parameters for the procedure. Allows you to declare the procedure in the package specication and to permit use from outside the database package. A private procedure (check box deselected) is only dened in the package body.
Code
Comment Stereotype
The following tabs are also available: Parameters tab Lists the input and output parameters required by the procedure (see Database package parameters on page 631). Denition tab - Lets you dene package procedures. Package procedures are not built using the structure of templates dened in the DBMS. You have to type the entire package procedure denition. To do so, you can
627
Oracle
use operators and functions to insert script items into the cursor denition. For example, the denition of the CREDIT package procedure is the following:
CREATE PROCEDURE credit (Account_number NUMBER, Amount IN NUMBER) AS BEGIN UPDATE accounts SET balance = balance + amount WHERE account_id = acc_no; END;
Database package variables Variables can be declared within a package. A variable can be used in a SQL or PL/SQL statement to capture or provide a value when one is needed. For example, you can dene the variable in_stock with a boolean data type to verify if a product is available or not. Variables have the following properties:
Property Description
Name
The name of the item which should be clear and meaningful, and should convey the items purpose to non-technical users. The technical name of the item used for generating code or scripts, which may be abbreviated, and should not generally include spaces. Additional information about the variable. Name of the database package to which the variable belongs. Data type of the variable. You can use the Question Mark button to display the list of Standard Data Types. If selected, indicates that the not null clause is set on the variable, thus making it mandatory. Allows you to dene the variable length. Number of places after the decimal point, for data values that can take a decimal point. Default value of the variable.
Code
628
Property
Description
Constant
Indicates that the variable is a constant. A constant has a value assigned. For example: Credit_Limit constant REAL := 500 000; Allows you to declare the variable in the package specication and to permit use from outside the database package. A private variable (check box deselected) is only dened in the package body.
Public
Database package cursors A cursor is a multi-row query, which lets you name a work area and access its stored information. Cursors have the following properties:
Property Description
Name Code
The name of the item which should be clear and meaningful, and should convey the items purpose to non-technical users. The technical name of the item used for generating code or scripts, which may be abbreviated, and should not generally include spaces. Additional information about the cursor. Name of the database package to which the cursor belongs. Allows you to dene the data type of a cursor result value. Allows you to declare the cursor in the package specication and to permit use from outside the database package. A private cursor (check box deselected) is only dened in the package body.
The following tabs are also available: Parameters tab Lists the input and output parameters required by the cursor (see Database package parameters on page 631). Denition tab - lets you dene the cursor. You can use operators and functions to insert script items into the cursor denition. For example, the following cursor allows locating in table emp, the employee number, name, and function in a given department and for a given 629
Oracle
employee number:
Select empno, empname, job FROM emp WHERE deptno=20 and empno = num ;
Database package exceptions PL/SQL allows you to explicitly handle internal and user-dened error conditions, called exceptions, that arise during processing of PL/SQL code. Exceptions have the following properties:
Properties Description
Name Code
The name of the item which should be clear and meaningful, and should convey the items purpose to non-technical users. The technical name of the item used for generating code or scripts, which may be abbreviated, and should not generally include spaces. Additional information about the exceptions. Name of the database package to which the exception belongs. Allows you to type a compiler directive, that is, a string for specifying compilation parameters for the exception.
Database package types A type is a user-dened composite datatype that encapsulates a data 630
structure along with the functions and procedures needed to manipulate the data. You can also dene subtypes of object types: a subtype contains all the attributes and methods of the parent type, it can contain additional attributes and can override methods from the type. Types have the following properties:
Property Description
Name Code
The name of the item which should be clear and meaningful, and should convey the items purpose to non-technical users. The technical name of the item used for generating code or scripts, which may be abbreviated, and should not generally include spaces. Additional information about the type. Name of the database package to which the type belongs. Allows you to declare the type as type or subtype. Allows you to declare the type in the package specication and to permit use from outside the database package. A private type (check box deselected) is only dened in the package body.
The following tabs are also available: Denition - Used to declare the type contents. The following example denes the type bank_account:
CREATE TYPE Bank_Account AS OBJECT ( acct_number INTEGER(5), balance REAL, status VARCHAR2(10), );
Database package parameters Database package procedures (see Database package procedures on page 627) and cursors (see Database package cursors on page 629) can use input and output parameters. For example, in a CREDIT procedure, you could dene the parameters Account Number and Amount. Parameters have the following properties:
631
Oracle
Property
Description
Name Code
The name of the item which should be clear and meaningful, and should convey the items purpose to non-technical users. The technical name of the item used for generating code or scripts, which may be abbreviated, and should not generally include spaces. Additional information about the parameter. Species the database package parent of the parameter. You can see the database package property sheet by clicking the Properties tool at the right of the eld. Data type of the parameter. You can use the Question Mark button to display the list of Standard Data Types. Default value of the parameter. Type of the parameter.
Comment Parent
Rebuilding database package procedures You can rebuild database package procedure dependencies (along with other procedure dependencies) by selecting Tools Rebuild Objects Rebuild Procedures Dependencies. For more information, see Rebuilding procedure dependencies in the Building Triggers and Procedures chapter. Generating database packages You can dene generation parameters for database packages in the Database Package tab of the Triggers and Procedures Generation dialog box. The following parameters are available:
632
Parameter
Generate the permission statement for a given user during database package creation.
For more information on the create and drop statements for database
packages, see the DBMS Resource File Reference chapter in the Customizing and Extending PowerDesigner manual. Reverse engineering database packages You can select database packages to reverse engineer from the Database Package tab of the Database Reverse Engineering dialog box. When you reverse engineer a database package, the sub-objects (variable, procedure, cursor, exception, and type) are created from the specication and the body of the database package.
633
Oracle
you have to clear the query SqlAttrQuery in the Tablespace category in the Oracle DBMS.
Oracle dimensions
In Oracle, the columns of the dimension table are called levels of the dimension hierarchy. These levels can have dependent columns. For example, in the dimension Time, the level Quarter has a dependent column called Number of business days. The following mapping is established between dimensions in Oracle and PowerDesigner:
Oracle object PowerDesigner object
Dimension Dimension hierarchy Dimension attribute used in a hierarchy Dimension attribute used as detail attribute
Oracle dimension creation and deletion orders can be generated and reverse engineered in PowerDesigner. Both generation and reverse engineering can be done by script or through a live database connection. For more information, see the Generating a Database from a PDM and the Reverse Engineering a Database into a PDM chapters.
634
create a master password to open the wallet. O To create a wallet password 1. Right-click the model in the Browser, and select Properties from the contextual menu to open its property sheet. 2. Click the Oracle tab, and enter your wallet password in the Password Encryption eld. 3. Click OK to close the model property sheet. The password will be used to create alter statements for opening and closing the wallet. Creating an encrypted table column You can create one or more encrypted column in one or more tables. You can specify the encryption algorithm to be used, but all columns in a particular table must use the same algorithm. If you create a second encrypted column in a table, and specify a different algorithm, the last specied algorithm will be used for all columns in the table. O To encrypt a table column 1. Create a column and open its property sheet. 2. On the General tab, specify any of the following types, which support encryption: CHAR, NCHAR, VARCHAR2, and NVARCHAR2 DATE and TIMESTAMP INTERVAL DAY TO SECOND and YEAR TO MONTH NUMBER RAW 3. Click the Oracle tab and select the Encryption checkbox. 4. Select an encryption algorithm from the list particular 5. [optional] Select the With salt checkbox in order to add some random bits to the encryption key. 6. Click OK to complete the column denition.
Clusters
A cluster is a schema object that contains data from one or more tables, which have one or more columns in common. Oracle Database stores together all the rows from all the tables that share the same cluster key. 635
Oracle
Clusters in Oracle v10gR2 and earlier are modeled as indexes with the Cluster check box selected. To upgrade such clusters to v11 or higher, you must generate a new PDM with the appropriate DBMS target from your original model. Simply changing the target DBMS will result in the loss of any existing clusters
Creating a cluster
You can create a cluster in any of the following ways: Select Model Clusters to access the List of Clusters, and click the Add a Row tool Right-click the model or package in the Browser, and select New Cluster
Cluster properties
You can modify an objects properties from its property sheet. To open a cluster property sheet, double-click its Browser in the Clusters folder. The following extended attributes are available on the General tab:
Name Description
Owner
In addition, the following tabs are available: Columns lists the columns associated with the cluster Indexes lists the indexes dened for the cluster
Database Links
A database link is a schema object in one database that enables you to access objects on another database. Database links are supported for Oracle 11g and higher. PowerDesigner models database links as extended objects with a stereotype of <<Database Link>>.
Creating a database link
You can create a database link in any of the following ways: Select Model Database links to access the List of Database links, and click the Add a Row tool. Right-click the model or package in the Browser, and select New Database link.
636
You can modify an objects properties from its property sheet. To open a database link property sheet, double-click its Browser in the Database links folder. The following extended attributes are available on the Oracle tab:
Name Description
Shared
Species the use of a single network connection to create a public database link that can be shared among multiple users. If selected, you must also specify a user name and password for the target instance on the remote server. Scripting names: Shared, AuthenticatedBy, AuthenticationPassword
Connect to
Species the user name and password used to connect to the remote database using a xed user database link.You need to specify CURRENT_USER to create a current user database link. The current user must be a global user with a valid account on the remote database. If you do not specify a value, then the database link uses the user name and password of each user who is connected to the database. Scripting names: Username, Password
Service name
Species the service name of a remote database. If you specify only the database name, then Oracle Database implicitly appends the database domain to the connect string to create a complete service name. Scripting name: ServiceName
Species the PowerDesigner model that contains the objects of the remote database. Use the buttons to the right of the eld to create, delete, select, or view the property sheet of the model. Scripting name: LinkModel
Oracle
You can create a materialized view log as follows: Open the property sheet of the table to which you want to attach the log, select the Oracle tab, and click the Create button in the Materialized view log groupbox. You can modify an objects properties from its property sheet. To open a materialized view log property sheet, double-click its Browser entry or click the Properties button on its parent table Oracle tab. The General tab displays the master table name and the comment. The following properties are available on the Partitions tab:
Name Description
Type
Species the method for paritioning the table. You can choose between: Range/Composite - Partitions the table on ranges of values from the column list. Hash - Partitions the table using the hash method. List - Partitions the table on lists of literal values from column. Reference - Equipartitions the table being created (the child table) by a referential constraint to an existing partitioned table (the parent table). System - Partitions the table by the partitions specied. When you select a type, additional options are displayed, to allow you to specify the appropriate parameters.
The following extended attributes are available for attributes of abstract data types of type OBJECT or SQLJ_OBJECT on the Oracle tab:
Name Description
Declare REF
Generates a REF modier on attribute to declare references, which hold pointers to objects. Scripting name: RefAttribute
Columns
638
Name
Description
Deferred option of check constraint Name of not null constraint Deferred option of not null constraint
Denes the deferred option of a column constraint check. It is used in the denition or create and add items statements. Scripting name: ExtColumnDeferOption [v8i and higher] Denes the name of the not null constraint for a column. Scripting name: ExtNotNullConstraintName [v8i and higher] Denes the deferred option of a column not null constraint. It is used in create and add statement items denition. An empty value means Not deferrable. Scripting name: ExtNotNullDeferOption
Encrypted
Algorithm
[v10gR2 and higher] Species the algorithm used for encryption. Scripting name: Algorithm
With salt
[v10gR2 and higher] Species if encryption adds salt to encoded data. Scripting name: EncryptionWithSalt
Identied by Password
Database Packages
Add serially_reusable pragma on package specication Add serially_reusable pragma on package body References
[v9i and higher] When set to True, denes that the pragma serially_reusable clause must be applied on the database package specication. Scripting name: IsSpecPragma [v9i and higher] When set to True, denes that the pragma serially_reusable clause must be applied on the database package body declaration. Scripting name: IsPragma
639
Oracle
Name
Description
Denes the deferred option of a reference. It is used in the denition of create and add items statements. Scripting name: ExtReferenceDeferOption Species a table into which Oracle places the ROWIDs of all rows violating the constraint. Scripting name: ExceptionsInto
Rely
[v8i and higher] Species whether an enabled constraint is to be enforced. Specify RELY to enable an existing constraint without enforcement. Specify NORELY to enable and enforce an existing constraint. Scripting name: Rely
Disable
Validate
Checks that all old data also obeys the constraint. Scripting name: Validate
Tables
Type
Denes if the table is of type global temporary or not. Scripting name: ExtTableType
The following extended attributes are available (for v11g and higher) on the XML properties tab when the table type is set to XML:
Name Description
Object properties
Species that the properties of object tables are essentially the same as those of relational tables. However, instead of specifying columns, you specify attributes of the object. Scripting name: XmlTypeObjProperty
Storage type
Species that XMLType columns can be stored in LOB, object-relational, or binary XML columns. Scripting name: XMLTypeStorage
640
Name
Description
Basic le
Use this clause to specify the traditional LOB storage. Scripting name: BasicFile
Secure le
Specify the name of the LOB data segment. You cannot use LOB_segname if you specify more than one LOB_item. Scripting name: LOBSegname
LOB parameters
Use this clause to specify various elements of LOB parameters. Scripting name: LOBParameters
Tablespaces
Size specication
[v10g and higher] Species whether the tablespace is a bigle or smallle tablespace. This clause overrides any default tablespace type setting for the database. You can choose from the following settings: bigle - contains only one datale or temple. The maximum size of the single datale or temple is 128 terabytes (TB) for a tablespace with 32K blocks and 32TB for a tablespace with 8K blocks. smallle - a traditional Oracle tablespace. Scripting name: SizeSpecication
Temporary tablespace
Use this option to create a locally managed temporary tablespace, which is an allocation of space in the database that can contain transient data that persists only for the duration of a session. This transient data cannot be recovered after process or instance failure. Scripting name: Temporary
Undo tablespace
Use this option to create an undo tablespace. When you run the database in automatic undo management mode, Oracle Database manages undo space using the undo tablespace instead of rollback segments. This clause is useful if you are now running in automatic undo management mode but your database was not created in automatic undo management mode. Scripting name: Undo
641
Oracle
Views
[v9i and higher] Used in the UNDER clause to specify the superview the current object view is based on. Scripting name: ExtObjSuperView
[v8i and higher] Species the attributes of the object type that will be used as a key to identify each row in the object view. Scripting name: ExtObjOIDList
[v8i and higher] Denes the type of the object view. Scripting name: ExtObjViewType When set to TRUE, allows you to create the view regardless of the existence of the base tables or the owner privileges on these tables. Scripting name: ExtViewForce
642
PostgreSQL
This section describes features specic to the PostgreSQL family of databases.
Template
The name of the template from which to create the new database, or DEFAULT to use the default template. Scripting name: Template
Encoding
Character set encoding to use in the new database. Specify a string constant (e.g., SQL_ASCII), or an integer encoding number, or DEFAULT to use the default encoding. Scripting name: Encoding
643
PostgreSQL
Name
Description
Delimiter character for the array. Scripting name: ExtTypeDelimiter Species the type of the array elements. Scripting name: ExtTypeElement Name of a function, created by CREATE FUNCTION, which converts data from its external form to the internal form of the type. Scripting name: ExtTypeInput
Length
Literal value which species the internal length of the new type. Scripting name: ExtTypeLength
Output function
Name of a function, created by CREATE FUNCTION, which converts data from its internal form to a form suitable for display. Scripting name: ExtTypeOutput
By Value
Indicates that operators and functions which use this data type should be passed an argument by value rather than by reference. Scripting name: ExtTypePassedByValue
Receive function
Name of a function, created by CREATE FUNCTION, which converts data of this type from a form suitable for transmission from another machine to internal form. Scripting name: ExtTypeReceive
Send function
Name of a function, created by CREATE FUNCTION, which converts data of this type into a form suitable for transmission to another machine. Scripting name: ExtTypeSend
644
Name
Description
Denition
The composite type is specied by a list of attribute names and data types. This is essentially the same as the row type of a table, but using CREATE TYPE avoids the need to create an actual table when all that is wanted is to dene a type. A stand-alone composite type is useful as the argument or return type of a function. Scripting name: CompositeDenition
Groups
The following extended attributes are available on the PostgreSQL tab (v8 and higher):
Name Description
The SYSID clause can be used to choose the PostgreSQL group ID of the new group. This is normally not necessary, but may be useful if you need to recreate a group referenced in the permissions of some object. Scripting name: SysId
Procedures
Language
The name of the language that the function is implemented in. May be SQL, C, internal, or the name of a user-dened procedural language. (See also extended attribute type ProcLanguageList.) Scripting name: ProcLanguage
References
The following extended attributes are available on the PostgreSQL tab (v8 and higher):
645
PostgreSQL
Name
Description
Deferrable
Controls whether the constraint can be deferred. A constraint that is not deferrable will be checked immediately after every command. Checking of constraints that are deferrable may be postponed until the end of the transaction. Only foreign key constraints currently accept this clause. All other constraint types are not deferrable. Scripting name: Deferrable
If a constraint is deferrable, this clause species the default time to check the constraint. False means the constraint is INITIALLY IMMEDIATE, it is checked after each statement. This is the default. True means the constraint is INITIALLY DEFERRED, it is checked only at the end of the transaction. Scripting name: ForeignKeyConstraintDeferred
Tables
The following extended attributes are available on the PostgreSQL tab (v8 and higher):
Name Description
Temporary state
If specied, the table is created as a temporary table. Temporary tables are automatically dropped at the end of a session, or optionally at the end of the current transaction. Scripting name: Temporary
Tablespaces
The following extended attributes are available on the PostgreSQL tab (v8 and higher):
Name Description
Location
Species the directory that will be used for the tablespace. The directory must be specied by an absolute path name. Scripting name: TbspLocation
Owner
Species the name of the user who will own the tablespace. If omitted, defaults to the user executing the command. Only superusers may create tablespaces, but they can assign ownership of tablespaces to non-superusers. Scripting name: TbspOwner
Users
The following extended attributes are available on the PostgreSQL tab (v8 and higher):
646
Name
Description
Create database
Denes a users ability to create databases. If TRUE, the user is allowed to create databases. Scripting name: CreateDB
Create user
If TRUE, the user is allowed to create new users. This option also turns the user into a superuser who can override all access restrictions. Scripting name: CreateUser
Encrypted password
Controls whether the password is stored encrypted in the system catalogs. Scripting name: EncryptedPassword
The SYSID clause can be used to choose the PostgreSQL user ID of the new user. This is normally not necessary, but may be useful if you need to recreate the owner of an orphaned object. Scripting name: SysId
Validity
This clause sets an absolute time after which the users password is no longer valid. If this clause is omitted the password will be valid for all time. Scripting name: Validity
647
The following extended attributes are available on the Red Brick tab:
Name Description
Unique
Declares that duplicate values are not allowed in the column. Declaring a column UNIQUE does not enforce uniqueness on the column; to enforce uniqueness, you must also build a BTREE index on the column. Scripting name: IsUnique
Procedures
The following extended attributes are available on the Red Brick tab:
Name Description
Macro Type
A macro can be temporary, public, or private: see MacroTypeList for details. If neither temporary nor public is specied, a private macro is created by default. Scripting name: MacroType
648
Sybase AS Anywhere
This section describes features specic to the Sybase AS Anywhere family of databases
Deprecated versions
The DBMSs for Sybase AS Anywhere v7 and v8 are deprecated. Note that from version 10, AS Anywhere is known as Sybase SQL Anywhere (see Sybase SQL Anywhere on page 674).
Auto-increment columns
Auto-increment columns are equivalent to identity columns in those DBMS that support identity columns. If you switch from Sybase ASA to a DBMS that supports identity columns, the Identity checkbox will be selected for each auto-increment column. On the other hand, if you switch to Sybase ASA, identity columns will be assigned the autoincrement default value. When you reverse engineer a script containing identity columns (using Sybase ASE-compatible syntax), these are automatically converted into auto-increment columns in Sybase ASA.
649
Sybase AS Anywhere
attach the ProxyTable extended model denition to the model. O To attach the ProxyTables extended model denition to an existing model 1. Select Model Extended Model Denitions. 2. Click the Import an Extended Model Denition tool. A selection dialog box is displayed. 3. Select the ASA Proxy Tables or ASE Proxy Tables extended model denition and click OK. The extended model denition is displayed in the list. 4. Click OK.
Select ProxyTables XEM at model creation
You can also select the relevant Proxy Tables XEM in the Extended Model Denitions tab of the New dialog box The ProxyTables extended model denition contains generation templates, extended attributes, custom checks and custom methods to support the denition of external proxy tables. You can double-click the ProxyTables extended model denition in the Browser to display its properties in the resource editor. The following extensions must be dened in the Prole category to fully support proxy tables: BasePackage: Generation template - for generating proxy tables. DataSource: Connection information custom check - veries that the connection information is sufcient to connect to the database. You must specify the data source name, user login and password in the Database Connection tab of the data source property sheet. GenerateAsProxyServer extended attribute - when set to true, denes the data source model as the proxy remote server. [various templates] - used for proxy table generation. Model: Proxy Servers and Tables generated les - to generate proxy server and table script les.
650
Menu provides a contextual menu for building data sources and commands in the Tools menu for rebuilding data sources and generating proxy tables. BuildProxyTableDataSourcesand GenerateProxyTables methods - used in the menu. [various templates] - required for proxy server and proxy table script generation. Shortcut: Data source existence custom check - veries that data sources are dened for the shortcuts. Table: Proxy table is child of reference custom check - veries that the model replica is not the child of another table via a reference link. [various templates] - required for proxy table, remote server and access denition creation syntax. Creating a proxy table You use external shortcuts and/or replica to design proxy tables in your model. An external shortcut is a non-modiable reference to an object in another model. For more information on shortcuts, see Shortcutsin the Shortcuts and Object Replications chapter of the Core Features Guide . A replica is an exact copy of an object that can be updated when the original object is modied. For more information on replications, see Replicationsin the Shortcuts and Object Replications chapter of the Core Features Guide . One interesting aspect of using replica, is that you can modify the replica code in order to make it different from the target table. A custom check veries that replica are not used as child tables of a reference. O To create a proxy table in a PDM 1. Select a table in a target model and drag it to the model where you want to create proxy tables using the appropriate key combination to create either an external shortcut or a replica. 2. Repeat this operation for each proxy table.
651
Sybase AS Anywhere
Dening the remote server of a proxy table The remote server is the model containing the target tables of the external shortcut or replica. The remote server is dened using a data source in the proxy tables model; this data source provides access to the remote data on the server. Note: the same data source can contain information for several models that share the same remote servers. When you attach the ProxyTables extended model denition to the model containing proxy tables, a specic contextual menu is displayed on the physical data model item, this menu command is used for building the data source of the proxy tables. Note: This command does not build data sources for target models that are closed in the workspace. O To dene the remote server of a proxy table 1. Create a new data source and set the GenerateAsProxyServer extended attribute to True. 2. Add the target models in the Models tab of the data source property sheet. You can also right-click the model that contains replica and/or shortcuts in the Browser and select the Build Proxy Tables Data Sources command. A data source is automatically created for each target model. 3. Double-click a data source in the Browser to display its property sheet. 4. Click the Database Connection tab, and dene the data source name, login and password. 5. Click OK. 6. Repeat steps 2 to 5 for each data source. Generating the remote server and proxy tables creation scripts You can generate the remote server and proxy tables creation scripts in order to run them in the database. Generation must be started from the model containing proxy tables. The ProxyTables extended model denition contains the creation script syntax for ASA or ASE.
652
O To generate the remote server and proxy tables creation scripts 1. Select Tools Proxy Tables Generate Proxy Tables to open the Generation dialog box, and click the Options tab. 2. Set a value for the UserReplica and UserShorcut options to allow you to generate the proxy tables corresponding to replica and/or external shortcuts. 3. Set the Generate proxy servers option to one of the following values: True to generate proxy servers. You can deselect any proxy servers you do not want to generate. False to not generate proxy servers 4. Click OK to begin generation. The generated script is displayed in the Result dialog box. 5. [optional] Double-click the generated SQL le or click the Edit button to open the script in a text editor. 6. Run the script on your database in order to create the proxy tables.
The following extended attributes are available on the Sybase tab (v9 and higher):
Name Description
Port number
Server name
Species the web service name prex (dish services only). Scripting name: Prex
653
Sybase AS Anywhere
Web Operations
The following extended attributes are available on the Sybase tab (v9 and higher) when the service type is not dish:
Name Description
URL
Determines whether URI paths are accepted and, if so, how they are processed. Scripting name: Url
654
Sybase AS Enterprise
This section describes features specic to the Sybase AS Enterprise family of databases.
Deprecated versions
The DBMSs for Sybase AS Enterprise v11.0 and v11.5-11.9 are deprecated.
Proxy tables
For information about using proxy tables, see Working with proxy tables in Sybase ASA and ASE on page 649.
Encryption Keys
Encryption keys are supported for ASE v12.5.3a and higher. PowerDesigner models encryption keys as extended objects with a stereotype of <<EncryptionKey>>. Adaptive Server authentication and access control mechanisms ensure that only properly identied and authorized users can access data. You can encrypt data at the column level, thus restricting your security measures to only sensitive data, and minimizing processing overhead. Encrypting columns in Adaptive Server is more straightforward than using encryption in the middle tier, or in the client application. You use SQL statements to create the encryption keys and specify columns for encryption. Adaptive Server handles key generation and storage. Encryption and decryption of data occurs automatically and transparently as you write and read the data in encrypted columns. No application changes are required, and there is no need to purchase third-party software.
Creating an encryption key
You can create an encryption key in any of the following ways: Select Model Encryption Keys to access the List of Encryption Keys, and click the Add a Row tool. Right-click the model or package in the Browser, and select New Encryption Key.
You can modify an objects properties from its property sheet. To open an encryption key property sheet, double-click its Browser entry in the Encryption Keys folder. The following extended attributes are available on the Sybase tab:
655
Sybase AS Enterprise
Name
Description
Owner
[v12.5.3a and higher] Species the owner of the encryption key. Scripting name: Owner
Key length
[v12.5.3a and higher] Species the size in bits of the key to be created. Valid key lengths for AES are 128, 192 and 256 bits. Scripting name: KeyLength
Algorithm
[v12.5.3a and higher] Species the algorithm used to generate the encryption key. Currently, Advanced Encryption Standard (AES) is the only algorithm supported. Scripting name: Algorithm
Initialization vector
[v12.5.3a and higher] Controls the use of an initialization vector when encrypting. When an initialization vector is used by the encryption algorithm, the ciphertext of two identical pieces of plaintext will be different, which would prevent the cryptanalyst from detecting patterns of data but would render the data on disk useless for indexing or matching without decryption. Scripting name: InitVector
Padding of datatypes
[v12.5.3a and higher] Species the use of padding of datatypes whose length is less than one block. Padding can be used instead of an initialization vector to randomize the ciphertext. It is only suitable for columns whose plaintext length is less than half the block length. For the default AES algorithm the block length is 16 bytes. Scripting name: Pad
Password phrase
[v15.0.2 and higher] Species a default key for use on all encrypted columns which do not have a keyname specied in create table or alter table. This is a database specic default key for use with tables in the same database. The default key is stored in the database sysencryptkeys table, the same as non-default keys. Scripting name: PasswordPhrase
656
Name
Description
[v12.5.3a and higher] Allows the System Security Ofcer to create a default key for use on all encrypted columns which do not have a keyname specied in create table or alter table. This is a database specic default key for use with tables in the same database. The default key is stored in the database sysencryptkeys table, the same as non-default keys. Scripting name: Default
[v12.0 and higher] Species whether a Java-SQL column is stored separate from the row (set to False) or in storage allocated directly in the row (set to True). Scripting name: InRow Species that the computed column is materialized. Scripting name: Materialized [v12.5.3a and higher] Species that the column is encrypted. Scripting name: Encrypted
Encryption Key
[v12.5.3a and higher] Species an encryption key name. Scripting name: EncryptionKey
Keys
Species if the index created for a constraint is to be created in descending order for each column. Scripting name: DescKey
The following extended attributes are available on the Encryption tab (v12.5.3a and higher):
657
Sybase AS Enterprise
Name
Description
The following extended attributes are available on the Sybase tab (v15.0 and higher):
Name Description
Port number
Server name
Species the database name used in the URL to access the web service. Scripting name: DatabaseName
The following extended attributes are available on the Sybase tab (v15.0 and higher):
Name Description
Alias
Species the name of the user-dened database alias. Scripting name: Alias
Secure
Security option. clear indicates that HTTP is used to access this Web service. ssl indicates HTTPS is used to access this Web service Scripting name: Secure
658
Sybase AS IQ
This section describes features specic to the Sybase AS IQ family of databases.
Deprecated versions
The DBMSs for Sybase AS IQ v12.0 and v12.4.3 are deprecated. Sybase Adaptive Server IQ (AS IQ) is a high-performance decision support server designed specically for data warehousing. Sybase AS IQ provides benets that allow an interactive approach to decision support including: Intelligent query processing using index-only access plans to process only the data needed to satisfy any type of query Truly interactive, ad hoc query performance on a uniprocessor as well as on parallel systems. An ad hoc query is a query about which the system has no prior knowledge and for which no explicit tuning is required. Ad hoc queries are distinguished from standard or production reports, where only pre-dened variables, such as dates, are used to generate pre-dened reports on a regular basis. Fully-exible schema support Efcient query execution without query-specic tuning by the System Administrator (under most circumstances) Fast aggregations, counts, comparisons of data Stored procedures Entire database and indexing stored in less space than raw data Numerous index types Join indexes to improve overall query performance. Join indexes represent links between columns in different tables. They enable much faster query processing on multiple indexes in a very large database, and are usually applied instead of ad hoc queries.
IQ indexes
Before creating IQ indexes, you should consider the implications of various types of indexes on the database server memory and disk space.
659
Sybase AS IQ
The set of indexes you dene for any given column can have dramatic impact on the speed of query processing. There are four main criteria for choosing indexes: Number of unique values Types of queries Disk space usage Data types It is best to consider all criteria in combination, rather than individually. To decide on indexes, look closely at the data in each column. Try to anticipate the number of unique and total values, the query results users will want from it, and whether the data will be used in ad hoc joins or join indexes.
For more information about choosing index types, see chapter Adaptive
Server IQ Indexes in the Adaptive Server IQ Administration and Performance Guide. Rebuilding IQ indexes As you develop a PDM or modify an existing one, you may change data types, alter the percentage of distinct values or change the number of values in tables. You must then rebuild the IQ indexes to reect these changes.
660
O To rebuild IQ indexes 1. Select Tools Rebuild Objects Rebuild Indexes to open the Rebuild Indexes dialog box:
2. Select a default name to generates IQ indexes. You can use the following variables: %COLUMN% - Column name %INDEXTYPE% - Type of index to be rebuilt %TABLE% - Name or code of table (based on display preferences) 3. Specify a mode to use. You can choose between: Delete and Rebuild - All existing indexes are deleted before index rebuild Preserve Indexes - Preserves all existing indexes 4. [optional] Select the Update statistics before rebuild checkbox to update such statistics as the number of records in a table and the number of distinct values in a column before performing the rebuild. Selecting this option can help with optimizing the rebuild. 5. [optional] Click the Selection tab and select or clear checkboxes to specify for which tables you want to rebuild indexes.
661
Sybase AS IQ
6. Click OK, and then Yes to conrm the rebuilding of your indexes. Index types When you rebuild indexes, PowerDesigner determines the index type based on information contained from the table statistics. It uses the number eld, which indicates the estimated number of records per table, and the percentage of distinct values to compute the number of unique values. If the user has not specied a number of rows for the table, PD assumes that the table will include at least 1 row of data. Usually the rebuild process creates a FASTPROJECTION index for all columns. Otherwise, the following rules are applied:
Criteria Index type
If no statistics are provided and the column has an undened data type Low number of unique values in a column Column used in join predicate High number of unique values in a column No COUNT DISTINCT, SELECT DISTINCT, or GROUP BY queries required
HIGHNONGROUP
662
Criteria
Index type
Column used in join predicate High number of unique values in a column (more that 1000) Anticipate COUNT DISTINCT, SELECT DISTINCT, or GROUP BY queries Column must enforce uniqueness Column without numeric datatype Column with date type Column with time type Column with datetime or smalldatetime type
HIGHGROUP
Col_1 integer Col_2 integer Col_3 integer Col_4 char (10) Col_5 char (10)
100 50 0 100 50
IQ join indexes
A join index is a special type of index used in Sybase AS IQ, which represents a full outer join of two or more tables. The query engine may use this full outer join as a starting point for queries that include left outer, right outer, and inner joins. A full outer join is one where all rows from both the left and right specied tables are included in the result, with NULL returned for any column with no matching value in the corresponding column. Join indexes are dened from references. You can create a join index for any set of columns that your users commonly join to resolve queries. While some references are based on keys, Sybase AS IQ allows you to create user-dened references to include the exact join required by your foreseen queries.
663
Sybase AS IQ
You can dene a join index: Automatically, by creating join indexes from all references linked to a fact table Manually, by creating a join index in the list of join indexes
Facts and Dimensions
A fact corresponds to the focus of a decision support investigation. For example, Sales, Revenue, and Budget are facts. A table containing facts is set as a fact table in the table property sheet. A dimension denes the axis of the investigation of a fact. For example, Product, Region, and Time are the axes of investigation of the Sales fact. A table containing dimensions is linked to a fact table and is set as a dimension table in the table property sheet.
For more information about setting table properties, see the Building
Physical Diagrams chapter. Creating a join index from the table property sheet You can create a join index or a bitmap join index from the Join Index tab of the table property sheet. The join index is automatically based on the current table. O To create a join index from the table property sheet 1. Open the property sheet of a table and click the Join Index tab. 2. Click the Insert a Row or the Add a Row tool to add a join index. 3. [optional] Click the Properties tool to open the join index property sheet and check that the Base table box is initialized with the selected table. Creating a join index in the list of join indexes If you need to create more join indexes than those automatically created by the rebuild process, you can use the list of join indexes.
Several references can be made at once
The following procedure shows how to create a join index in its simplest form: using one reference at a time. Once you become familiar with join index creation, you can select several references at once to reect a more complex query plan.
664
O To create a join index in the list of join indexes 1. Select Model Join Indexes to open the List of Join Indexes. 2. Click the Add a Row tool, type a name in the Name column, and then click the Properties tool to open the property sheet of the new join index. 3. Click the References tab to display the list of references of the join index. The list is empty when you create a new join index. 4. Click the Add References tool to open a selection box listing all the available references in the PDM, select a reference, and then click OK to add it to the Join Index references list:
5. Click OK in each of the dialog boxes to complete the creation of the join index. Join index properties A join index has the following properties:
665
Sybase AS IQ
Property
Description
Name Code
The name of the item which should be clear and meaningful, and should convey the items purpose to non-technical users. The technical name of the item used for generating code or scripts, which may be abbreviated, and should not generally include spaces. Sub-classication used to extend the semantics of an object without changing its structure; it can be predened or userdened. Descriptive label for the join index. Name of the table that stores the join index. You can use the tools to the right of the list to create an object, browse the complete tree of available objects or view the properties of the currently selected object.
Rebuilding join indexes for all references linked to a fact table You can automatically generate a join index for each selected fact table and the dimension tables that it references. The rebuild process only applies to fact tables selected in the Selection tab of the Join Index Rebuild tab. Each automatically generated join index consists of the references that link a fact table to all the dimension tables located on a single axis proceeding from the fact table.
666
A reference between two fact tables does not generate any join index. A join index is constrained and can only be dened for tables that are organized in a connected tree.
Parameter Result of selection
When selected all existing indexes are deleted before join index rebuild. When selected, preserves all existing join indexes in the PDM.
3. Click OK, and then Yes to conrm rebuilding of the join indexes. A join index is automatically generated for each fact table.
667
Sybase AS IQ
Automatically generated join indexes appear in the list of join indexes. To display the list, select Model Join Indexes. Adding references to a join index You can add a reference to any join index. You do this, for example, when you create a new reference that you want to include in an existing join index. O To add a reference to a join index 1. Select Model Join Indexes to open the List of Join Indexes. 2. Select a join index in the list, and then click the Properties tool to open its property sheet. 3. Select the References tab, and click the Add References tool to open a selection box listing all the available references in the PDM. Select the appropriate reference in the list and click OK to add it to the join index:
4. Click OK in each of the dialog boxes to complete the addition of the reference to the join index.
Generate a at le for loading to the AS IQ data warehouse Create Insert Location statements for use with a proxy data base (for ASE and ASA only) To create a data movement script, you must: Add the Data Movement IQ XEM to your AS IQ model Specify your data movement options [optional] Create a data source linked to a model of the database from which you want to draw the data to be moved [optional] Specify mappings between the tables in your data source and your AS IQ database Generate the data movement script O To add the Data Movement IQ XEM to your AS IQ model 1. Select Model Extended Model Denitions to open the List of Extended Model Denitions. 2. Click the Import an Extended Model Denition tool, select the Data Movement IQ and click OK to add this XEM to the model. 3. Click OK to close the List of Extended Model Denitions and return to the model. O To create a data source to populate your IQ data warehouse 1. Create a PDM to model your source database, and ensure that it is open in your workspace. 2. In your AS IQ PDM, right-click the model name in the Browser and select New Data Source. 3. Enter a name for the source and then click the Models tab. 4. Click the Add Models tool, and select your source model. 5. Click the Database Connection tab, and complete the elds to enable a connection to your source database. 6. Complete the elds on the Data Movement tab and click OK.
669
Sybase AS IQ
The following elds are available on the Data Source properties sheet Data Movement tab:
Property Description
Remote Server Name Remote Database Name Data Source Name Dump le directory Local user name
Species the name of the remote server used in the interface le for IQ server. Species the name of the remote database.
Species the label given to the data source in the sql.ini le. Species the directory where the dump le (external at le), that contains the data to be imported, will be created. Species the database user name.
O To specify data movement options 1. Right-click the model item in the Browser and select Properties from the contextual menu. 2. Click the Data Movement tab and enter the appropriate values for the model as a whole. 3. [optional] To override these global data movement options for a specic table, open its property sheet and enter table-specic values on the Data Movement tab. This tab also allows you to specify a table-specic dump le for importing into the table
Model properties Data Movement tab
The following elds are available on the Model properties sheet Data Movement tab:
Property Description
Field Delimiter Row Delimiter Maximum Image or Text Size Load le directory
Species the delimiter to be used between elds in the dump le. Species the delimiter to be used between rows in the dump le. Species the maximum length of an image (or text) record, to which it will be truncated if necessary. Species the directory where the load le is located.
670
If the Data Movement Method generation option is set to Insert Location, a Data Movement tab is available on each Table properties sheet, containing the following elds:
Property Description
Dump le name Field Delimiter Row Delimiter Maximum Image or Text Size
Species the name of the dump le (external at le) that contains the data to be imported. Species the delimiter to be used between elds in the dump le. Species the delimiter to be used between rows in the dump le. Species the maximum length of an image (or text) record, to which it will be truncated if necessary.
O To specify mappings between the tables in your data source and your AS IQ database 1. Select Tools Mapping Editor to open the Mapping Editor. 2. Create the necessary mappings and then click OK. For detailed information about using the Mapping Editor, see the Creating Mappings chapter in the Core Features Guide . O To generate the data movement script 1. Select Tools Extended Generation to open the Generation window. 2. Specify a directory in which to generate your data movement les. 3. [optional] Click the Selection tab and specify for which Tables and/or Data Sources you want to generate a data movement script. 4. Click the Options tab and specify your data movement script generation options. You can set the following options: Use Mappings species whether any previously-created mappings should be used for the data movement Data Movement Method species which kind of script to generate. You can choose between: Insert Location [IQ or ASE only] PowerDesigner will create a loadscript for connecting the source database to the IQ server. Note that if the data source is not an IQ or ASE database, then no loadscript will be generated. 671
Sybase AS IQ
External File PowerDesigner will create a dump le from the source database together with a loadscript to upload it to the IQ server. 5. [optional] Click the Generated Files tab to review the names and locations of the les to be generated. 6. Click OK to begin the generation of the data movement script.
Sybase AS IQ events
PowerDesigner supports Sybase AS IQ events for v12.7 and higher. For details, see SQL Anywhere events on page 674.
The following extended attributes are available on the Sybase tab (v12.4.3 and higher):
Name Description
Denes the cardinality of the column (to optimize the indexes internally). Scripting name: ExtIqUnicity
The following extended attributes are available on the Sybase tab (v12.4.3 and higher):
Name Description
Species that the table is a global temporary table. Scripting name: ExtGlobalTemporaryTable
The following extended attributes are available on the Sybase tab (v12.6 and higher):
672
Name
Description
Port number
Server name
Name prex
[DISH service type] Species a name prex. Only SOAP services whose names begin with this prex are handled. Scripting name: Prex
Web Operations
The following extended attributes are available on the Sybase tab (v12.6 and higher) when the service type is not dish:
Name Description
URL
Determines whether URI paths are accepted and, if so, how they are processed. Scripting name: Url
673
Event is scheduled
Species that the server carries out a set of actions according to a schedule of times. If selected, this option disables the Event is triggered option. Scripting name: ScheduledEvent
Schedule denition
Enter the schedule of event trigger times here. Click the New button to launch a dedicated editor window. Scripting name: SchedulesText
Event is triggered
Species that the server carries out a set of actions when a predened type of system event occurs. This option is the default and, if selected, disables the Event is scheduled option. Scripting name: TypedEvent
674
Name
Description
Event type
The event-type is one of the listed set of system-dened event types. The event types are case insensitive. To specify the conditions under which this event-type triggers the event, use the WHERE clause. Scripting name: EventType
Trigger condition
Determines the condition under which an event is red. For example, to take an action when the disk containing the transaction log becomes more than 80% full, use the following triggering condition: WHERE event_condition( LogDiskSpacePercentFree ) < 20 The argument to the event_condition function must be valid for the event type. You can use multiple AND conditions to make up the WHERE clause, but you cannot use OR conditions or other conditions. Scripting name: TriggerCondition
Handler
Each event has one handler. The actions of an event handler are committed if no error is detected during execution, and rolled back if errors are detected. Scripting name: Handler
Enable
By default, event handlers are enabled. When DISABLE is specied, the event handler does not execute even when the scheduled time or triggering condition occurs. A TRIGGER EVENT statement does not cause a disabled event handler to be executed. Scripting name: Enable
At (databases)
If you want to execute events at remote or consolidated databases in a SQL Remote setup, you can use this clause to restrict the databases at which the event is handled. By default, all databases execute the event. Scripting name: Database
675
Name
Description
Species whether this column is stored in a compressed format. Scripting name: Compressed
PCTFREE
Species the percentage of free space you want to reserve for each table page. The free space is used if rows increase in size when the data is updated. If there is no free space in a table page, every increase in the size of a row on that page requires the row to be split across multiple table pages, causing row fragmentation and possible performance degradation. The value percent-free-space is an integer between 0 and 100. The former species that no free space is to be left on each page (each page is to be fully packed). A high value causes each row to be inserted into a page by itself. If PCTFREE is not set, 200 bytes are reserved in each page. Scripting name: PctFree
Species either temporary table is a global or a local temporary table. Scripting name: TemporaryTable
Virtual index
The VIRTUAL keyword is primarily for use by the Index Consultant. A virtual index mimics the properties of a real physical index during the evaluation of query plans by the Index Consultant and when the PLAN function is used. You can use virtual indexes together with the PLAN function to explore the performance impact of an index, without the often time consuming and resource consuming effects of creating a real index. Scripting name: Virtual
Web Services
676
Name
Description
Port number
Server name
Name prex
[DISH service type] Species a name prex. Only SOAP services whose names begin with this prex are handled. Scripting name: Prex
Web Operations
The following extended attributes are available on the Sybase tab when the service type is not dish:
Name Description
URL
Determines whether URI paths are accepted and, if so, how they are processed. Scripting name: Url
677
Teradata
Teradata
This section describes features specic to the Teradata family of databases.
Transform groups
A transform is a mechanism for creating an external representation of the UDT that is used when exporting and importing data between the client and the Teradata server. This mechanism allows most Teradata client utilities and open APIs to transparently move data to and from a UDT without the need for special logic or metadata. Transforms usually appear as a named pair of functions or methods (usually referred to as To-SQL and From-SQL to indicate the direction of data ow to and from the database) called a transform group. A transform group is required if the type is to be used in a table. Transform groups are supported for Teradata v2r6 and higher. PowerDesigner models transform groups as extended objects with a stereotype of <<TransformGroup>>.
Creating a transform group
You can create a transform group in any of the following ways: Select Model Transform Groups to access the List of Transform Groups, and click the Add a Row tool. Right-click the model or package in the Browser, and select New Transform Group.
You can modify an objects properties from its property sheet. To open a transform group property sheet, double-click its Browser entry in the Transform Groups folder. The following extended attributes are available on the Teradata tab (vV2R6 and higher):
678
Name
Description
UDT
Species the name of the user-dened type associated with the transform group. Scripting name: UDT
To sql with
Species the function name and parameters to be used as the tosql routine for this transform group, and whether or not it is specic. Scripting names: ToName, ToParms, ToSpecic
Species the method or function name and parameters to be used as the fromsql routine for this transform group, and whether or not it is specic and/or instantiable. Scripting names: FromType, FromName, FromParms, FromSpecic, FromInstance, FromUDT
679
Teradata
The following extended attributes are available on the Teradata tab if the type is distinct (vV2R6 and higher):
Name Description
Indicates that character column comparison uses character case (upper and lower) to raise differences. Scripting name: PredenedDataType
The following extended attributes are available on the Teradata tab if the type is distinct (vV2R6 and higher):
Name Description
Species the name of the data type returned by the method, which can be either a predened data type or a UDT. Scripting name: ReturnDataType
Self as result
Species that the method is type-preserving. If so, then the data type specied in the RETURNS clause for the method must have the same name as UDT_name. Scripting name: SelfAsResult
As locator
Species that BLOB and CLOB types must be represented by a locator. The Teradata Database does not support in-memory LOB parameters: an AS LOCATOR phrase must be specied for each LOB parameter and return value. Scripting name: ReturnAsLocator
Character set
Species the CHARACTER SET clause for character data type. Scripting name: ReturnCharSet
Species a computed attribute that show the datatype and its length and precision. Scripting name: CastDataTypeDisplay
As locator
Species that BLOB and CLOB types must be represented by a locator. Scripting name: CastAsLocator
680
Name
Description
Species the specic name of the method whose signature is being added to the type denition for UDT_name. Scripting name: SpecicMethodName Species the parameter style for the method dened by this signature. Scripting name: ParameterStyle
Species that the method dened by this signature is not called if any of the arguments passed to it is null. Instead, it returns a null. Scripting name: ReturnsNullOnNullInput
Deterministic
Species that the result of invoking the method dened by this signature is deterministic. Scripting name: Deterministic
Language
Species the language (either C or C++) used to write the source code for the method dened by this signature. Scripting name: Language
Columns
The following extended attributes are available on the Teradata tab (vV2R6 and higher):
Name Description
Case specic
Character set
Species that identity column values are always systemgenerated. You cannot insert values into, nor update, an identity column dened as GENERATED ALWAYS. If not selected, identity column values are system-generated unless the user does not enter a non-null value. Scripting name: ExtGenAlways
681
Teradata
Name
Description
Compressed values
Compresses specied values and nulls in one or more columns of a table to zero space. When the data in a column matches a value specied in the COMPRESS phrase, then that value is stored only once in the table header regardless of how many times it occurs as a eld value for the column, thus saving disk storage space. Attribute must be enclosed in parenthesis when it is composed of multiple values. Scripting name: Compress
Databases
The following extended attributes are available on the Teradata tab (vV2R6 and higher):
Name Description
Account
After journal
Species the type of image to be maintained by default for data tables created in the new database. Scripting name: AfterJournal
Species the default table that is to receive the journal images of data tables created in the new database. Scripting name: DefaultJournalTable
Fallback
Species whether to create and store a duplicate copy of each table created in the new database. Scripting name: Fallback
Owning database
Species the name of the immediate owning user or database. The default is the user name associated with the current session. Scripting name: FromDatabaseName
Journal
Species the number of before change images to be maintained by default for each data table created in the new database. Scripting name: Journal
Permanent space
Species the number of bytes to be reserved for permanent storage of the new user database. The space is taken from unallocated space in the database of the immediate owner. Scripting name: PermanentSpace
682
Name
Description
Spool space
Species the number of bytes (n) to be allocated for spool les. The default is the largest value that is not greater then the owner spool space, and that is a multiple of the number of AMPs on the system. Scripting name: SpoolSpace
Temporary space
Species how much space (in bytes) is to be allocated for creating temporary tables by this user. Note that temporary space is reserved prior to spool space for any user dened with this characteristic. Scripting name: TemporarySpace
Indexes
Species that the index is the primary index. Scripting name: PrimaryIndex Species that a NUSI should retain row ID pointers for each logical row of a join index (as opposed to only the compressed physical rows). Scripting name: AllIndex
Species that the index will be generated with its name (as Teradata allows index with no name). Scripting name: NamedIndex
The following extended attributes are available on the Teradata tab (vV2R6 and higher):
Name Description
On commit action
Species the action to take with the contents of a global temporary table when a transaction ends: DELETE ROWS - clears the temporary table of all rows. PRESERVE ROWS - retains the rows in the table after the transaction is committed. Scripting name: CommitRowAction
683
Teradata
Name
Description
Type
Species whether the table to be created is a global temporary table or a volatile table: GLOBAL TEMPORARY - a temporary table denition is created and stored in the data dictionary for future materialization. You can create global temporary tables by copying a table WITH NO DATA, but not by copying a table WITH DATA. VOLATILE - species that a volatile table be created, with its denition retained in memory only for the course of the session in which it is dened. Scripting name: GlobalTemporary
Controls the treatment of duplicate rows. If there are uniqueness constraints on any column or set of columns in the table denition, then the table cannot have duplicate rows even if it is declared as MULTISET. Some client utilities have restrictions with respect to MULTISET tables. Scripting name: SetOrMultiset
Users
Owner
Species the database (or user) that owns the current user. Scripting name: DBOwner
Permanent
Species the number of bytes to be reserved for permanent storage of the new user database. The space is taken from unallocated space in the database of the immediate owner. Scripting name: PermanentSpace
Spool
Species the number of bytes (n) to be allocated for spool les. The default is the largest value that is not greater then the owner spool space, and that is a multiple of the number of AMPs on the system. Scripting name: SpoolSpace
Temporary
Species how much space (in bytes) is to be allocated for creating temporary tables by this user. Note that temporary space is reserved prior to spool space for any user dened with this characteristic. Scripting name: TemporarySpace
684
Name
Description
Account
Fallback
Species whether to create and store a duplicate copy of each table created in the new database. Scripting name: Fallback
Journal
Species the number of before change images to be maintained by default for each data table created in the new database. Scripting name: Journal
After journal
Species the type of image to be maintained by default for data tables created in the new database. Scripting name: AfterJournal
Default table
Species the default table that is to receive the journal images of data tables created in the new database. Scripting name: DefaultJournalTable
Database
Role
Species the default role for the user. Scripting name: DefaultRole
Character set
Collation
Species the default collation for this user. Scripting name: Collation
Time zone
Species the default time zone displacement for the user. Scripting name: TimeZone
Date format
Species the default format for importing and exporting DATE values for the user. Scripting name: DateForm
Prole name
Startup string
685
Teradata
Views
The following extended attributes are available on the Teradata tab (vV2R6 and higher):
Name Description
Lock type
Species the type (class) of the object to be locked. Scripting name: LockedClass Species the name of the object to be locked. Scripting name: LockedObjt
No wait
Species that if the indicated lock cannot be obtained, the statement should be aborted. Scripting name: NoWait
686
CHAPTER 12
This appendix provides a short introduction to writing SQL scripts in PowerDesigner and lists the variables and macros available for use in such scripts.
Topic: Introduction Writing SQL with the PowerDesigner GTL Writing SQL with the PDM Variables and Macros PDM Macros PDM Variables PowerDesigner Formatting Variables page 688 689 691 693 704 716
Contents
687
Introduction
Introduction
PowerDesigner allows you to associate your own custom SQL statements with many database objects. You can write triggers and procedures, and also add begin and end scripts to many database objects.
For more detailed information about the GTL, see the Customizing
Generation with GTL chapter of the Customizing and Extending PowerDesigner manual.
688
689
690
691
For lists of the available variables and macros, see PDM Macros on
page 693, PDM Variables on page 704, and PowerDesigner Formatting Variables on page 716.
692
PDM Macros
You can use predened macros in trigger templates, template items, triggers, and procedures. Macros perform specic functions.
AKCOLN
Description Syntax .AKCOLN("statement","prex","sufx","last_sufx", "condition")
Argument Description
Statement to repeat for each column Prex for each new line Sufx for each new line Sufx for the last line Alternate key code (if condition argument is left empty the macro returns a statement for each alternate key in the table)
For columns, the macro AKCOLN only accepts the variable %COLUMN%.
ALLCOL
Description Syntax .ALLCOL("statement","prex","sufx","last_sufx")
693
PDM Macros
Argument
Description
Statement to repeat for each column Prex for each new line Sufx for each new line Sufx for the last line
DEFINE
Description Syntax .DEFINE "variable" "value"
Argument Description
Variable name (without % signs) Variable value (may include another variable surrounded by % signs)
694
DEFINEIF
Description Syntax .DEFINEIF "test_value" "variable" "value"
Argument Description
Denes a variable and initializes its value if the test value is not null
Value to test Variable name (without % signs) Variable value (may include another variable surrounded by % signs)
ERROR
Description Syntax .ERROR (errno, "errmsg")
Argument Description
Handles errors
FKCOLN
Description Syntax .FKCOLN("statement","prex","sufx","last_sufx")
695
PDM Macros
Argument
Description
Statement to repeat for each column Prex for each new line Sufx for each new line Sufx for the last line
For columns, the macro FKCOLN only accepts the variable %COLUMN%.
FOREACH_CHILD
Description Syntax .FOREACH_CHILD ("condition") "statement" .ENDFOR
Argument Description
Repeats a statement for each parent-to-child reference in the current table fullling a condition
condition statement
Condition
Restrict on update Cascade on update Set null on update Set default on update
696
Condition
Selects
Restrict on delete Cascade on delete Set null on delete Set default on delete
Example
FOREACH_COLUMN
Description Syntax .FOREACH_COLUMN ("condition") "statement" .ENDFOR
Argument Description
Repeats a statement for each column in the current table fullling a condition
condition statement
697
PDM Macros
Condition
Selects
All columns Primary key columns Foreign key columns Alternate key columns Non-modiable columns (columns that have Cannot Modify selected as a check parameter) Triggering columns (primary key columns, foreign key columns; and non-modiable columns)
FOREACH_PARENT
Description Syntax .FOREACH_PARENT ("condition") "statement" .ENDFOR
Argument Description
Repeats a statement for each child-to-parent reference in the current table fullling a condition
condition statement
698
Condition
All references Non-mandatory foreign keys Mandatory foreign keys Non-modiable foreign keys
INCOLN
Description Syntax .INCOLN("statement","prex","sufx","last_sufx")
Argument Description
Repeats a statement for each primary key column, foreign key column, alternate key column, or non-modiable column in a table.
Statement to repeat for each column Prex for each new line Sufx for each new line Sufx for the last line
JOIN
Description
699
PDM Macros
Syntax .JOIN("statement","prex","sufx","last_sufx")
Argument Description
Statement to repeat for each column Prex for each new line Sufx for each new line Sufx for the last line
For columns, the macro JOIN only accepts the variables %PK%, %AK%, and %FK%.
NMFCOL
Description Syntax .NMFCOL("statement","prex","sufx","last_sufx")
Argument Description
Repeats a statement for each non-modiable column in a table. Non-modiable columns have Cannot Modify selected as a check parameter.
Statement to repeat for each column Prex for each new line Sufx for each new line Sufx for the last line
700
PKCOLN
Description Syntax .PKCOLN("statement","prex","sufx","last_sufx")
Argument Description
Statement to repeat for each column Prex for each new line Sufx for each new line Sufx for the last line
For columns, the macro PKCOLN only accepts the variable %COLUMN%.
Uses the client and/or server expression of a business rule in the trigger template, template item, trigger, and procedure script.
701
PDM Macros
In a trigger based on template AfterDeleteTrigger, you type the following macro in the Denition tab of the trigger:
.SERVEREXPRESSION(ACTIVITY_DATE_CONTROL)
SQLXML
Description
Avoids typing a SQL/XML query in the denition of a trigger, a procedure or a function. Use one of the following tools: The Insert SQL/XML Macro tool opens a selection dialog box where you choose a global element from an XML model open in the workspace, mapped to a PDM, and linked with the SQL/XML extended model denition. Click OK in the dialog box and the SQLXML macro is displayed in the denition code, with the code of the XML model (optional) and the code of the global element The Macros tool, where you select .SQLXML( ) in the list. The SQLXML macro is displayed empty in the denition code. You must ll the parentheses with the code of an XML model (optional), followed by :: and the code of a global element. The XML model, from which you choose a global element, must be open in the workspace, mapped to a PDM, and linked with the SQL/XML extended model denition
702
After generation, the SQLXML macro is replaced by the SQL/XML query of the global element.
Syntax .SQLXML(code of an XML model::code of a global element)
703
PDM Variables
PDM Variables
Many objects have both a code variable and a generated code variable. The code variable is the attribute code that is dened in the object property sheet. The generated code variable is computed from the attribute code according to available generation options. The values for the code and generated code variables can be different in the following situations: When the Code is a reserved word or it contains invalid characters, the generated code is quoted When the code is longer than authorized by the database, the generated code is truncated Note: To access variables of sub-objects (columns in a table for example) you have to use loop macros or GTL macros to browse the list of sub-objects. For example, in a trigger the following macro loops on table columns and for each column with the CannotModify attribute outputs the code of the column followed by cannot be modied:
.foreach_item(Table.Columns) .if(%CannotModify%) -- "%Code%" cannot be modified .endif .next
The following variables can be used for all named object denitions:
Variable name Comment
704
Variable name
Comment
Object comment. If no comment is dened the object name is used Generated code of the object owner, or the object parent Database prex of object (name of database + . if database dened) Whole object qualier (database prex + owner prex) SQL text dening physical options for object Object constraint name Object constraint SQL body. For example(A <= 0) AND (A >= 10) Concatenation of server expression for business rule associated with object
Table variables
Generated code of the table Table name Table code Table comment List of primary key columns. For example: A, B Complete body of the table denition. It contains denition of columns, checks and keys Abstract data type name List of columns used for the cluster
The following variables can be used in domain check parameter and column check parameter denitions:
Variable name Comment
UNIT
705
PDM Variables
Variable name
Comment
FORMAT DATATYPE DTTPCODE LENGTH PREC ISRDONLY DEFAULT MINVAL MAXVAL VALUES LISTVAL MINMAX ISMAND MAND NULL NOTNULL IDENTITY WITHDEFAULT ISUPPERVAL ISLOWERVAL
Standard check format attribute Data type. For example int, char(10) or numeric(8, 2) Data type code. For example int, char or numeric Data type length. For example 0, 10 or 8 Data type precision. For example 0, 0 or 2 TRUE if the read-only attribute of standard check is selected Default value Minimum value Maximum value List of values. For example(0, 1, 2, 3, 4, 5) SQL constraint associated with a list of values. For example C1 in (0, 1, 2, 3, 4, 5) SQL constraint associated with minimum and maximum values. For example(C1 <= 0) AND (C1 >= 5) TRUE if the domain or column is mandatory Contains the keywords null or not null depending on if the attribute is mandatory or not mandatory Contains keyword null if the domain or column is not mandatory Contains Keyword not null if the domain or column is mandatory Keyword identity if the domain or column is identity (Sybase specic) Keyword with default if the domain or column is with default TRUE if the upper-case attribute of standard check is selected TRUE if the lower-case attribute of standard check is selected
706
Column variables
Generated code of the column Position of Column in List of columns of Table Column name Column code Contains Keyword primary if the column is a primary key column TRUE if the column is part of a primary key TRUE if the column is part of a foreign key Compute constraint text
Generated code of the abstract data type Type of Abstract data type. For example array, or list Abstract data type size TRUE if the abstract data type is of type array TRUE if the abstract data type is of type list TRUE if the abstract data type is of type structure TRUE if the abstract data type is of type object TRUE if the abstract data type is of type JAVA class Contains denition of the abstract data type
The following variable can be used in an abstract data type attribute denition:
Variable name Comment
PDM Variables
Variable name
Comment
Generated code of a business rule Rule name Rule code Rule client expression Rule server expression
TABLE INDEX INDEXNAME INDEXCODE UNIQUE INDEXTYPE CIDXLIST INDEXKEY CLUSTER INDXDEFN
Generated code of the parent of an index, can be a table or a query table (view) Generated code of the index Index name Index code Contains keyword unique when an index is unique Contains the index type (DBMS dependant) List of index columns. For example A asc, B desc, C asc Contains keywords primary, unique or foreign depending on an index origin Contains keyword cluster when an index is a clustered index Used for dening an index within a table denition
708
Variable name
Comment
Contains keywords ASC or DESC depending on the sort order TRUE if the index column sort is ascending
REFR PARENT PNAME PCODE PQUALIFIER CHILD CNAME CCODE CQUALIFIER REFRNAME REFRCODE FKCONSTRAINT PKCONSTRAINT CKEYCOLUMNS FKEYCOLUMNS UPDCONST
Generated code of the reference Generated code of the parent table Parent table name Parent table name Parent table qualier. See also QUALIFIER Generated code of a child table Child table name Child table code Child table qualier. See also QUALIFIER Reference name Reference code Foreign key (reference) constraint name Constraint name of the primary key used to reference the object List of parent key columns. For example: C1, C2, C3 List of child foreign key columns. For example: C1, C2, C3 Update declarative constraint. This can be any of the following keywords Restrict Cascade Set null Set default
709
PDM Variables
Variable name
Comment
DELCONST
Delete declarative constraint. This can be any of the following keywords Restrict Cascade Set null Set default
Minimum cardinality Maximum cardinality Parent table owner name Child table owner name TRUE when check on commit is selected on a reference (ASA 6.0 specic) Reference joins Reference number in the child table collection of references
Generated code of the parent table column (primary key) Generated code of a child table column (foreign key) Generated code of a primary key column Primary key column name Generated code of a foreign key column Foreign key column name Alternate key column code (same as PK) Alternate key column name (same as PKNAME) Primary key column data type Foreign key column default value Primary key column data type used in procedure declaration. For example: without length
710
Key variables
COLUMNS COLNLIST ISPKEY PKEY AKEY KEY ISMULTICOLN CLUSTER Variables for views
List of key columns. For exampleA, B, C TRUE when a key is the primary key for the table Primary key constraint name Alternate key constraint name Key constraint name True if the key has more than one column Cluster keyword
Generated code of the view View name View code List of columns of a view. For example: A, B, C SQL text of a view. For example Select * from T1 Contains the keyword with check option if this option is selected in the view property sheet Complete view creation order. For example create view V1 as select * from T1
The variables listed below can be used in a trigger denition. You can also use owning table variables in a trigger denition.
Variable name Comment
Order number of Trigger (where the current DBMS supports more than one trigger of one type) Generated code of the trigger Reference order number in the list of references for the table Error number for standard error
711
PDM Variables
Variable name
Comment
Error message for standard error Name of a table containing user-dened error messages Name of a column containing error numbers in a userdened error table Name of a column containing error messages in a user-dened error table SQL script of trigger or procedure. Trigger body (only for Oracle live database reverse engineering) Trigger description (only for Oracle live database reverse engineering) Trigger denition
The following variables can be used for database, procedure, and trigger generation:
Variable name Comment
Generation date & time Login name of the user executing the generation Path where the le script will be generated Name of the le script where SQL orders will be written Description explaining how to execute a generated script TRUE if upper case generation option is set TRUE if lower case generation option is set Name of the DBMS associated with the generated model Code of the database associated with the generated model
The following variables can be used when reverse engineering a database into a PDM:
712
Variable name
Comment
Set to TRUE during reverse engineering Allows to skip a word. The string is parsed for reverse engineering but is not generated Allows to skip a numeric value. The numeric value is parsed for reverse engineering but is not generated Allows to skip all text. The text is parsed for reverse engineering but is not generated True if the current user is the connected user Catalog name that will be used in live database reverse engineering queries Schema that will be used in live database reverse engineering queries Data type size of a column or a domain. Used for live database reverse engineering, when a data type length is not dened in the system tables One value from the list of values in a column or domain Variable used in the Create order of a trigger. Trigger type uses keywords for each trigger type, for example BeforeInsert, or AfterUpdate Variable used in the Create order of a trigger. Trigger event uses keywords for each trigger event, for example Insert, Update, and Delete Variable used in the Create order of a trigger. Timing of trigger uses the keywords Null, Before, and After
VALUE TRGTYPE
TRGEVENT
TRGTIME
Database The following variables can be used for database generation when synchronization variables synchronizing a modied PDM with an existing database:
Variable name Comment
Old owner name of the object. See also OWNER New owner name of the object. See also OWNER Old qualier of the object. See also QUALIFIER New qualier for the object. See also QUALIFIER
713
PDM Variables
Variable name
Comment
Old code of the table New code of the table Old code of the column New code of the column
PRIVLIST PERMLIST GRANTEE ID GROUP ROLE OBJECT PERMISSION PRIVILEGE GRANTOPTION REVOKEOPTION
List of privileges for a grant/revoke order List of permissions for a grant/revoke order Name of the user, group, or role for a grant/revoke order Name of the user Name of the group Name of the role Database objects (table, view, column, and so on) SQL grant/revoke order for a database object SQL grant/revoke order for an ID (user, group, or role) Option for grant: with grant option / with admin option Option for revoke: with cascade
Metadata variables
Localized name for an object class. For example: Table, View, Column, Index Object class code. For example: TABL, VIEW, COLN, INDX
714
Variable name
Comment
The following DBMS specic variables are available for Sybase Adaptive Server Anywhere and Microsoft SQL Server:
Variable name Comment
Name of a business rule object associated with a domain Name of a default object associated with a domain Use sp_primary key to create primary keys (SQL Server) Use sp_foreign key to create foreign keys (SQL Server)
Name of sequence
Generated code of a procedure (also available for trigger when a trigger is implemented with a procedure) Generated code of a procedure where the procedure is a function (with a return value)
Generated code for join index Complete body of join index denition List of references (for live database connection) List of reference joins (for live database connection)
715
.L .T .U .c .n
Lower-case characters Removes blank spaces Upper-case characters Upper-case rst letter and lower-case next letters Maximum length where n is the number of characters Justies to xed length where n is the number of characters Right justify variable text to xed length where n is the number of characters
n -n
For example:
%.L:TABLE%
The table below shows formatted variables and their results in a script for the table EMPLOYEE.
Template statement with variable Resulting script statement
create trigger %TABLE% create trigger %.L:TABLE% create trigger %.U:TABLE% create trigger %.4:TABLE% create trigger %.4L:TABLE%
create trigger EMPLOYEE create trigger employee create trigger EMPLOYEE create trigger EMPL create trigger empl
716
CHAPTER 13
This appendix explains how to migrate from ERwin to PowerDesigner. You will learn about the differences between the two design environments and how to import your models into PowerDesigner.
Topic: Introducing the ERwin Import Process Preparing to Import your ERwin models The Import Process After Importing Getting Started Using PowerDesigner page 718 720 721 723 728
Contents
717
File types
PowerDesigner supports the import of the following ERwin le types: ERwin v3.x (.erx) ERwin v4.x (.xml) ERwin v7.x (.xml) the ERwin model must be saved as Standard XML Format, and you must uncheck the Only save minimum amount of information check box in the ERwin Save as XML File dialog box. Versions 4.x or 7.x are recommended, as they contain more metadata. ERwin and PowerDesigner implement database design in different ways. An ERwin logical model can be imported into either: a PowerDesigner conceptual data model (CDM), or a PowerDesigner logical data model An ERwin Physical Model is imported into a PowerDesigner physical data model (PDM)
In the PowerDesigner Physical Data Model you can use two design levels: the logical model allows you to design the database structure and perform some database denormalization actions without taking into account any DBMS physical requirement. The physical model allows you to design the database taking into account the physical requirements of a given DBMS 718
Limitations
You cannot import the following ERwin objects: ERwin triggers and stored procedures (not directly possible, but see the process in Post-import checklist on page 725) ERwin reports ER1 les ERwin data sources ERwin target clients While PowerDesigner can import all your object display preferences and will retain color and font information, it does not support multiple colors for columns in a single table. The default column color will be used during the import.
719
720
The options available depend on the type of ERwin model that you are importing. The traditional approach to data modeling in PowerDesigner is to create a Conceptual Data Model synchronized with a Physical Data Model. The full set of options is as follows: A Conceptual Data Model can be created when you are importing an ERwin Logical Model. It provides a platform-independent representation of a system, giving an abstract view of its static data structures, and permitting real normalized data structures with many-to-many and inheritance relationships. A Logical Data Model can be created when you are importing an ERwin Logical Model. It allows you to resolve many-to-many and super/sub-type relationships, de-normalize your data structures, and dene indexes, without specifying a particular RDBMS. In PowerDesigner, a Logical Data Model is an RDBMS-independent version of a Physical Data Model. 721
A Physical Data Model can be created when you are importing an ERwin Physical Model. It is a representation of a real database and associated objects running on a server with complete information on the structure of the physical objects, such as tables, columns, references, triggers, stored procedures, views, and indexes. Select the checkbox for each type of models that you want to create. 4. If your ERwin model contains a logical model, and you want to create a conceptual data model, then you can choose to merge identical data items. This is a powerful metadata management technique that is not available in the ERwin environment. For example, your ERwin logical model may contain multiple entities that contain an attribute address. By default, PowerDesigner will create a separate data item for each of these entity attributes. However if you select the Merge identical data items checkbox, then a single data item will be created, and adjustments to it will automatically cascade down to all the associated entity attributes. 5. If your ERwin model contains a physical model, then you can choose whether to implement referential integrity using triggers. 6. Click OK to begin the import. When the process is complete, the imported models will appear in the Browser.
722
After Importing
This section describes what you should expect in your newly-imported models.
Model Stored display and subject area Business rule Domain Symbols ( including symbol size and position) Description Notes Text block IE notation IDEF1X notation User-dened properties
Model Diagram Business rule Domain Symbols ( including symbol size and position) Description Annotation Text symbol Entity/Relationship notation IDEF1X notation Imported as extended attributes stored into a specic extended model denition embedded in the model. The name of this extended model denition is Imported Attributes, you can manage it from the resource editor. For more information, see Extended Model Definitions in the Resource Files and the Public Metamodel chapter of the Customizing and Extending PowerDesigner manual.
723
After Importing
PowerDesigner conceptual data model objects The import process converts ERwin logical model objects into conceptual data model (CDM) objects as follows:
ERwin logical model PowerDesigner CDM
Data item, entity attribute Identier Entity Relationship Inheritance link Inheritance
PowerDesigner physical data model objects The import process translates ERwin physical model objects into physical data model (PDM) objects as follows:
ERwin physical model PowerDesigner PDM
Column Key Table Relationship Index View table Fact, dimension, outrigger Target database Valid value Tablespace Segment
Column Key Table Reference Index View Table Current DBMS Check parameter Tablespace Storage
724
Post-import checklist
This section lists a series of recommended post-import checks and processes. Import triggers: Triggers cannot be directly imported from ERwin. There are, however, two methods for transferring your constraint trigger information to PowerDesigner: Automatically generate triggers: To do this, select Tools Rebuild Objects Rebuild Triggers. Creating triggers in this way ensures that they will be synchronized automatically by PowerDesigner, but the actual code may be different from that which you are used to in ERwin. Reverse engineer triggers: To do this, generate the triggers from ERwin, and then reverse engineer them into PowerDesigner. Creating triggers in this way ensures that they use exactly the same code as before, but they will not be automatically synchronized by PowerDesigner. Import procedures: Procedures cannot be directly imported from ERwin. You can, however transfer them by generating the triggers from ERwin, and then reverse engineering them into PowerDesigner. Set up your object naming conventions and other model options: To control the naming conventions of model objects in PowerDesigner, select Tools Model Options, and then click on the object entry in the Naming Convention category in the Category pane:
725
After Importing
You can control other object creation defaults by clicking on the object entry in the Model Settings category:
726
Differences to Expect
This section lists certain differences that you may encounter when working with your imported ERwin model in PowerDesigner. Why do I see errors in Check Model when my ERwin model was clean? PowerDesigner performs stricter checks than ERwin. For example, duplicate objects are not permitted in PowerDesigner, and the existence of orphaned items will generate a warning. Why do some of my object symbols appear with numeric sufxes? If an object is required to appear more than once in a diagram (for, example, to improve readability), PowerDesigner will create a graphical synonym to represent it. Thus, if the table Purchase is displayed twice in a diagram, the two symbols will be labeled as Purchase: 1 and Purchase: 2.
727
How do I nd objects? All the objects in the model are listed, organized by type, in the Browser. PowerDesigner provides various methods for locating your objects: To nd the symbol for an object in the Browser: Right-click the object in the Browser and select Find in Diagram from the contextual menu. To nd the browser entry for an object symbol: Right-click the symbol in the diagram and select Find in Browser from the contextual menu. To search for an object: Type CTRL+F to open the Find Objects dialog box. Enter the text to search for (you can use the asterisk as a wild card) and click Find Now. Right-click any of the results choose whether to nd it in the Browser or Diagram. How do I edit objects? You can edit the name of an object by selecting its symbol in the diagram and typing F2. To edit other object properties, double-click the symbol or the object entry in the Browser and enter the necessary information in its property sheet. How do I share objects? You can share objects between packages and models using shortcuts and replications. For more information, see the Shortcuts and Object Replications chapter in the Core Features Guide .
Packages/Subject Areas
How do I create subject areas? In PowerDesigner, you can create multiple views of your model by adding additional diagrams. You can also divide your model into smaller subdivisions using packages. To add a diagram to your model: Right-click the diagram background and select Diagram New Diagram [Diagram Type] from the contextual menu. To convert a diagram into a package: Right-click the diagram background and select Diagram Convert to Package. The Convert Diagram to Package wizard will open, permitting you to name the package and select objects to move into it. The package will appear in the Browser with its own diagram and associated objects. For more information about packages, see Packages in the Models chapter of the Core Features Guide .
Reports
How do I create a report? PowerDesigner provides wizards to create two different types of report:
728
To create a report about a specic type of object: Select Report List Report Wizard and follow the wizard instructions. To create a report about multiple object types or the whole model: Select Report Report Wizard and follow the wizard instructions. For more information about PowerDesigner reports, see the Reports chapter in the Core Features Guide .
Databases
How do I create a model from a database? Select File Reverse Engineer Database and complete the dialog box. For more information, see the Reverse Engineering a Database into a PDM chapter. How do I update my model from a database? Select Database Reverse Engineer Database and complete the dialog box. A Merge window will open to allow you to verify the changes to be made before committing them. For more information, see the Reverse Engineering a Database into a PDM chapter. How do I generate a database from my model? Select Database Generate Database and complete the dialog box. For more information, see the Generating a Database from a PDM chapter. How do I update a database from my model? Select Database Apply Model Changes to Database and complete the dialog box. A Database Synchronization window will open to allow you to verify the changes to be made before committing them. For more information, see the Generating a Database from a PDM chapter.
Models
How do I compare two models? Select Tools Compare Models and complete the dialog box. For more information, see the Comparing and Merging Models chapter in the Core Features Guide . How do I merge two models? Select Tools Merge Model and complete the dialog box. For more information, see the Comparing and Merging Models chapter in the Core Features Guide .
729
730
Index
A
abstract data type 64, 129 abstract object 381 attribute variable 707 categories 129 check model 381 create 130, 447 drop 447 instantiable object 381 link to Java class 133 properties 130 use in PowerDesigner 129 variable 707 abstract data type procedure check model 382 denition 382 name conict with attribute 382 return type 382 Access 97 460, 530 access.mdb 460 add-in MS SQL Server 586 administrator permission 516 AKCOLN 693 alias 302 ALLCOL 693 Alter (permission) 290 alter (script) 506 alternate key 58 column 98 constraint 100, 101 dene 95 designate 98 generate 448, 450 generate index 107 index 103, 106, 451 name 99 number 101 physical option 450 variable 101 ambiguous detection in Java reverse engineering 525 Analysis server (MS SQL Server) 586 Analysis services (MS SQL Server) 586 apm 9 archive 9 ASK column default 86 association 44, 196, 220 cardinality 47 change to entity 49 check model 383, 385 create 45, 220 dene 49 dependent 48 display preferences 349 entity 49 entity attribute 49 properties 46, 220 reexive 47 association attribute 50 association link cardinality 47 dene 45 display preferences 350 properties 46 asymmetric key 563 attribute 27, 196, 211 association 50 create 27, 211 delete 29 enforce coherence 332 identier 29 link to identier 38 migrate 38 properties 27, 211 reuse 29 attribute (multidimensional diagram) 385 auto-increment column in Sybase ASA 649 auto-layout during reverse engineering 524 auto-migrate 139 check parameter 139 column 140 columns (model option) 342 default join 37, 143 domain 139 validation rule 139
731
Index
B
Barker notation base object bend reference bend a reference bibliography binary (data type) bitmap index bitmap (data type bitmap join index add reference check model column create options in Oracle properties rebuild table BLOB block terminator boolean data type buffer pool build index reference business rule apply create expression business rule (PDM) apply constraint domain expression properties validation variable byte (data type) 363 302 150 150 ix 119 106 119 621 624 407 623 621 622 622 621 622 502 524 117 460 107 148 179 182 180 181 177 182 121 177 180 177, 446, 448, 449 708 117
C
candidate key 95
cardinality association dene dene for an association link format maximum minimum reference referential integrity relationship case sensitivity (model option) CDM association association link attribute check model create data item dene environment description display preferences domain enforce domain entity Entity Relationship Diagram ERD error identier import inheritance logical model model options notation open PAM option relationship role validation CDM/PDM pair certicate Change to Entity Wizard character data prole format mask script check model
47 34 47 146 146 146 146, 355 146 34, 41 337 44 44 27 381 5 21 332 2 348 115 332 24 2 2 23, 40 30 718 51 2 332 361 15 22, 40, 332 32 2 381 721 561 40 478 457, 510 478 457, 510
732
Index
abstract data type abstract data type procedure association (CDM) association (PDM) attribute (multidimensional diagram) bitmap join index CDM column cube cursor data item data source object database package default dimension dimension hierarchy domain entity entity attribute entity identier exception fact fact measure group horizontal partitioning index inheritance join index key LDM package package procedure package type PDM procedure reference relationship role sequence storage synonym table table collapsing tablespace trigger user variable
381 382 383 385 385 407 381 385 387 390 393 394 389 395 395 397 397 401 399 400 391 403 403 404 404 405 406 407 408 381 409 391 392 381 411 412 413 414 415 415 416 417 419 419 420 420 392
vertical partitioning view view index view reference Web operation Web service check parameter additional auto-migrate column constraint data prole data type dene domain entity attribute generate properties standard table type validation validation rule child table circular extended dependency client expression CLIENTEXPRESSION CLR aggregate function assembly function integration procedure trigger user-dened type cluster key Oracle referential integrity clustered index CODASYL code data item option relationship unique
421 422 422 423 424 424 175 139 93, 174, 177, 449 67, 93 488 90 174 121, 174, 177 174 446, 448, 449 174 174 67, 448 174 177 174, 179 101, 150 166, 275 177 701 557 555 559 555 559 560 558 96 635 146 103, 106 151 22 40 40 22, 40
733
Index
collapse tables 73 column 58, 86 alternate key 98 bitmap join index 623 check model 385 check parameter 174, 177, 449 check parameter variable 705 comment 449 computed 86, 89 constraint business rule 185 create 86, 448, 449 data type 90 default 86 details 87 domain 91, 121 duplicate 92 ll parameter 486 foreign key 86, 99 generate 448, 449 identity 86 indicated property 486 link to key 145 migrate 145 non-divergence from domain 121 permission 293, 295 primary key 86, 96 properties 86, 154 sort 94 statistics 532 validation rule 177, 449 variable 177, 696, 706 view 153 column denormalization 75 delete replica 76 duplicate columns 75 replication 75 revert 76 select column 75 wizard 75 column mandatory by default (model option) 341 command storage 462 tablespace 462 comment column 449 generate name for empty comment 457 script 457, 510
table view computed column conceptual data type conceptual diagram association attribute create data item entity identier inheritance relationship connect database connection prole constraint alternate key business rule column delete foreign key generate insert link index name primary key table unique update constraint business rule apply to table or column create generate reverse engineer constraint name default display label contract CSV le cube check model create display preferences duplicated association existence of association existence of fact
448 453 86, 89 117, 365 44 27 15 21 24 30 51 32 437, 513, 514 436 100, 101 182 93 146, 252 100, 101 98 251 103 67, 93, 100, 101 100 67 98 146, 252 182 185 184 186 187 101, 102 355 355 575 484 196, 198 387 198 350 387 387 387
734
Index
generate cube data 205 generate in MS SQL Server 589 generate in MS SQL Server 2005 592 properties 198 rebuild 200 reverse engineer in MS SQL Server 590 reverse engineer in MS SQL Server 2005 597 cube data generation 205 data elds 206 dimension 206 member 206 text le 206 cursor check model 390 database package 389 denition 390, 629 in database package 629 parameters 390, 629 public 629 return data type 629 return type 390 customize function 255 procedure 255 script 444, 448, 464, 465, 467, 469
D
data access data elds data item association check model code copy create delete error option properties reuse unique unique code data movement script (Sybase IQ) data prole assign assign from table check parameter 68 206 21 50 393 22 25 21 29 23 25 21 22, 29, 332 332 22 668 488 489, 490 488
data source date/time dene export foreign key import data source in a PDM automatic check model CSV le database differing DBMS disconnect existence of PDM list test data data type average length binary bitmap BLOB boolean byte character column convert to conceptual create date decimal default domain drop oat image integer length money number OLE precision select serial show full name time translate undened database
474 475 472 492 488 491 475 394 484 483 394 437 394 482 474 117 502 119 119 502 117 117 118 90 365 446 119 117 332 115, 121 446 117 119 117 117 117 117 119 117 90 117 332 119 365 90, 115, 119 7
735
Index
access 282, 513 add user to group 301 change 365 checks 388 close 444 connect 437, 513, 514 create 8, 438, 444, 464 dene 7 denormalization 68 display 437, 513, 514 drop 444 estimate size 500 generate 438, 464, 506 generate PDM 528 generate privileges 289 group 283, 300 information 437 modify 506 MS Access 97 460, 530 open 444 optimize reverse engineering 531 options variable 714 owner 284 parameter 508 permission 290 physical option 444 prex tablespace in DB2 OS/390 191, 539 preserve object 365 privilege 286 properties 7 quick launch 441 reverse engineer 516 reverse engineer tablespace physical options in Oracle 633 role 283, 298 script 438, 506 select 365 settings sets 441 size 500 statistics 532 synchronization variable 713 target 365 test data 483 user 283 variable 712 database link Oracle 636
database mirroring 571 database package 624 body 624 check model 389 create during generation 632 default owner 348 dene 625 dene cursors 629 dene exceptions 630 dene procedure 627 dene types 630 dene variables 628 drop during generation 632 generate 632 insert procedure 626 owner 625 privilege 625 reverse engineer 633 specication 624 database package cursor 629 database package exception 630 database package procedure 626 check model 391 denition 391, 627 parameters 391, 627 public 627 replication of stored procedure 626 return data type 627 type 627 database package procedure dependencies 261 database package type 630 check model 392 denition 392 database partition group 542 database space 460 DATE 662 date data prole 475 data type 119 DB2 537 column default 86 reverse engineer 528 DBCreateAfter 166, 275 DBMS 364 editor 364 non supported object 365 physical option 188
736
Index
trigger template 240 decimal (data type) 117 decision support object 586 default 111 assign 112 automatic rebuild 113 check model 395 column 86 constraint name 101, 102 create 111, 447 delete and rebuild 113 drop 447 generate 447 physical option 188 physical options objects 188 properties 111 rebuild 113 reuse 113 same value 395 test data prole 473 value empty 395 DEFINE 694 DEFINEIF 695 Delete (permission) 290 delete data item 29 denormalization 68 column denormalization 75 horizontal partitioning 69 table collapsing 73 vertical partitioning 71 dependency procedure 257 trigger 257 dependent association 48 detail attribute 212 detail column 87 dimension 196, 206, 209 check model 395 create 209 detail attribute 212 display preferences 350 generate for Oracle 634 Oracle 634 properties 209 dimension attribute (display preferences) 351 dimension hierarchy check model 397
existence of attribute disconnect data source discriminant column display preference association association link cube dimension dimension attribute entity hierarchy inheritance procedure reference relationship table view view reference display preferences package diverge from domain domain CDM check model create data type dene diverge from enforce coherence LDM modify PDM properties domain (CDM) non-divergence domain (LDM) non-divergence domain (PDM) assign default attach column auto-migrate business rule check parameter check parameter variable coherence column data type
397 437 70 349 350 350 350 351 351 351 354 354 355 356 357 359 360 354 332 115 397 115 115 115 332 332 115 120 115 115 121 121 112 91 139 121 121, 174, 177 705 121 121 117, 121
737
Index
dene 115 enforce 121 length 117 mandatory 121 non-divergence 121 precision 117 use 121 validation rule 177 variable 177, 707 Domain and Attribute option 332 domain mandatory by default (model option) 341 dominant relationship 34 drag a reference reference 150 drop abstract data type 447 data type 446 database 444 default 447 foreign key 450, 452 index 451 join index 455 primary key 449, 450 sequence 448 storage 445 synonym 454 table 448 tablespace 444 view 453 DSO metamodel 587 DTTM 662 duplicate columns 75
E
E/R + Merise edit script trigger enabledbprex EnableMultiCheck encoding for reverse engineering encryption encryption key Sybase ASE end point enforce domain non-divergence 332 465, 467, 469 233 539 182 525 561 655 572 121 121, 341
entity add to inheritance association associative attribute change from association change from relationship check model copy create delete display preferences entity attribute generate table identier inheritance properties wizard entity attribute add to identier association check model copy identier inheritance properties relationship specifying entity attribute entity identier entity/relationship entity/relationship notation ERD CDM Entity Relationship Diagram ERROR error message data item relationship unique code user-dened ERwin embedded extended model denition import migrate CDM/PDM pair migrating from user-dened properties estimate
24 55 49 40 29 49 40 401 25 24 29 351 25 373 25, 29 373 24 40 30 49 399 25 25 54 54 40 54 400 332 332 2 2 695 695 23 40 23, 40 278, 279 718 718 721 721 718
738
Index
database size 500 model database size 503 tables database size 504 event 229 EventDelimiter 239 multiple 239 trigger 229 event notication 579 EventDelimiter 239 events Sybase Anywhere 674 Sybase IQ 672 exception check model 391 database package 389 exception (database package) 630 Execute (permission) 290 execute query 514 export data prole 492 expression business rule 177 client 177 server 177 extended attribute DB2 537 IBM DB2 543 import PowerBuilder extended model denition 83 Informix 549 Interbase 551 MS Access 552 MySQL 617 NonStop SQL 619 Oracle 638 PostgreSQL 643 PowerBuilder 82 Sybase ASA 653 Sybase ASE 657 Sybase IQ 672 Sybase SQL Anywhere 675 Teradata 680 extended dependencies circular 166, 275 PDM 369 stored procedures 275 view 165, 166 extended model denition 649
367 83 68 202
F
fact check model create existence of measure mapping not dened properties fact measure FASTPROJECTION le encoding in reverse engineering legroup ll parameter dene value indicated column property FKCOLN oat (data type) PDM force column list FOREACH_CHILD FOREACH_COLUMN FOREACH_PARENT foreign identier change attribute foreign key auto-migrate change column column constraint data prole dene designate drop generate generate from identier generate index index name number referential integrity variable format cardinality 196, 214 403 214 403 403 214 403 662 525 460 486 486 695 117 453 696 697 698 38 58 139 144 86, 99 100, 101 488 95 99 450, 452 448, 450, 452 371 107 103, 106, 451 103 359 146 101, 700 146
739
Index
character script variable full-text catalog index search function create custom dene edit with SQL editor insert SQL/XML macro permission SQL code SQL/XML wizard function-based index Oracle 8i Oracle 8i2 reverse engineer SqlListQuery use variables
457, 510 457, 510 470, 716 565 566 565 255 255 255 270 270 293 270 270 103 103 103 103 103 103
G
general option generate alternate key alternate key index automatic archive automatic test data source CDM check parameter column congure CDM options constraint constraint business rule cube data cubes in MS SQL Server data source database database package default error message extraction script for MS Access 97 foreign key foreign key index 22, 40 448, 450 107 9 475, 478, 480 376 446, 448, 449 448, 449 376 98 186 205 589 83 438, 464, 506 632 447 278, 279 202 460 371, 448, 450, 452 107
index 98, 107, 448, 451 inheritance 373 inside table 448 join index 455, 666 name for empty comment 457 options 428 options for test data 493 outside table 448 PDM from database 528 physical option 444, 448, 451 PowerBuilder extended attribute 83 primary key 371, 448, 449 primary key index 107 privileges 289 procedure 275 proxy table script 652 public names 83 quick launch 441 quotation marks 178 reference 148 referential integrity 146, 448 rule 446 script 438, 444, 448, 457, 506, 510 select object 458 sequence 448 settings sets 441 storage 445 stored procedures order 275 synonym 454 synonyms 306 table 373, 448 tablespace 444 test data 472, 482484, 493 trigger 275 validation rule 177, 446, 448, 449 view 448, 453 views order 166 XML model via XML Builder Wizard 376 generated code variables 704 Grant permission 290 privilege 286 Grant with admin option (privilege) 286 Grant with grant option (permission) 290 group 283, 300 add user 301 assign role 299
740
Index
H
HG index hierarchy create display preferences properties HIGHGROUP HIGHNONGROUP HNG (index) horizontal partitioning check model create MS SQL Server 2005 object preserve during generation properties remove wizard 106 196, 218 218 351 218 662 662 106 404 69 553 77 78 77 81 70
I
IBM DB2 auxiliary table database partition group extended attributes index extension trusted context web services IDEF1X identier attribute child copy create delete entity attribute generate key link attribute parent properties identier delimiter script identity column 538 542 543 542 537 312 151, 332 30 29 54 25 30 29 25, 30 371 38 54 30 457 86
column in Sybase ASE 649 column in Sybase ASE 11, 12 655 Sybase 86 image (data type) 119 import CDM 718 CSV le 484 data prole 491 deprecated PDM logical model 19 ERwin 718 interconnected PDM logical models 20 model 718 web service as service provider 311 XPF le 491 INCOLN 699 index 58, 103 alternate key 103, 106, 451 bitmap 106 change DBMS 106 check model 405 clear 107 clustered 103, 106 column variable 708 create 103, 448 drop 451 drop join 455 estimate database size 500 foreign key 103, 106, 451 function-based 103 generate 98, 107, 448, 451 HG 106 HNG 106 key constraint 103 LF 106 link to key/reference 103 owner 106 primary key 103, 106, 451 properties 106 query table 110 rebuild 107 rebuild option 107 table 103 type 662 types 106 unique 98, 103, 106 user dene 103 variable 708
741
Index
Index (permission) index extension Informix inheritance add child entity check model child create display preferences entity attribute generate generation mode mutually exclusive parent primary key properties insert constraint procedure in template trigger template Insert (permission) inside table install java class instead of (trigger) integer (data type) Interbase extended attribute sequences IQ index rebuild
290 542 549 51 55 406 54 51 354 54 54 54 56 54 54 53, 54 251 237 237, 243 290 449, 450, 452 447 156 117 551 124 659, 660
primary key reference reuse attribute reuse column table collapsing view reference join index check model create dene generate properties Sybase AS IQ table variable
143 355 38 145, 172 73 171 407 664 663 666 665 663 664 715
K
key add column alternate check model cluster code create dene foreign link column name primary properties variable key number (foreign key) 95 100 95 408 96 96 95 95 95 145 96 95 96 711 359
J
Java class link remove reverse engineer JOIN join change child attribute change child column create default dene index index generate migrate attribute migrate column primary identier 133 447 137 699 38 144 37, 143 37, 143 37, 38, 143, 145 455 455 38 145 37
L
label constraint name referential integrity LDM attribute check model dene environment display preferences domain entity identier inheritance logical diagram 355 355 27 381 332 348 115 24 30 51 17
742
Index
migration settings model options notation relationship validation LF (index) link Java class OOM reverse Java class list column test data LISTVAL check parameter logical diagram attribute create entity identier inheritance objects relationship logical model loop macro LOWFAST
335 332 361 32 381 106 129, 137 133 129 94 482 175 27 18 24 30 51 17 32 2 704 662
M
macro CLIENTEXPRESSION SERVEREXPRESSION SQLXML trigger trigger template manual creation of triggers mask character materialized query table materialized view materialized view (index) materialized view log Oracle measure create properties member Merise Merise notation message 701 701 702 693 693 225 478 164 164 110 637 196, 216 216 216 206 332 332
contract type metadata variables migrate ERwin model into CDM/PDM pair migrate from ERwin migration settings LDM MINMAX check parameter model copy DBMS create ERwin import open option properties share DBMS model option auto-migrate columns auto-reuse columns change parent allowed check on commit CODASYL column mandatory by default conceptual data item data type full name database package default owner default constraints delete default constraints update default data type default implementation default link on creation domain and attribute domain mandatory by default enable links to requirements enforce non-divergence IDEF1X ignore identifying owner join index default owner mandatory parent name/code case sensitive notation procedure default owner propagate column properties rebuild automatically triggers
576 574 714 721 721 335 175 5 5 718 718 15 22, 40 6 5 342 342 342 342 337 341 337 332 332 348 342 342 332, 341 342 342 332 341 337 341 337 340 346 342 337 332, 337 346 342 340
743
Index
relational relationship sequence default owner table default owner table trigger default owner unique code view default owner view trigger default owner money (data type) move reference to table MS Access MS Access extended attributes MS SQL Server ActiveX Analysis server Analysis Services cube extended attributes customize attributes customize cubes customize dimensions customize hierarchy customize multi-dimensional objects data source data source extended attributes database database extended attributes decision support object dimension extended attributes DSO metamodel enable add-in extended attributes generate cubes hierarchy extended attributes repository reverse engineer cubes MS SQL Server 2000 MS SQL Server 2005 asymmetric key certicate CLR aggregate function CLR assembly CLR function CLR integration CLR procedure CLR trigger CLR user-dened type contract
337 332 345 340, 345 346 342 340, 345 346 117 150 552 552 553 586 586 586 602 606 602 603 612 601 611 611 609 609 586 603 587 586 601, 606 589 612 586 590 553 553 563 561 557 555 559 555 559 560 558 575
database mirroring encryption end point event notication full-text catalog full-text index full-text search generate cubes horizontal partitioning message contract message type partition function partition scheme queue remote service binding reverse engineer cubes route service service broker symmetric key synonym user schema WithOption XML data type XML index XML indexing XML schema collection XML table column MS SQL Server 2008 Resource Governor resource pool workload group MS SQL Server 7.x multidimensional diagram association attribute basics create cube dimension fact hierarchy measure retrieve objects user multiple database checks
571 561 572 579 565 566 565 592 553 576 574 553 554 577 582 597 581 580 573 564 585 601 601 569 567 567 569 570 553 583 584 583 553 220 211 194 196 198 209 214 218 216 199 283 388
744
Index
7 238 617
N
NMFCOL non supported object non-divergence NonStop SQL extended attributes non-unique primary index normalization notation Barker CODASYL conceptual Entity/Relationship IDEF1X Merise model option (PDM) model options reference relational Notation option number alternate key data type reference rows for test data 700 365 121 619 679 68 363 151, 337 151, 337 332 151, 337 332 337 359 151, 356 151, 337 332 101 117 101 493
O
object attach to user owner PDM object abstract data type inherit procedure object data type in Oracle OLE data type OOM link link Java class operation procedure option CDM code congure for generated CDM data item 284 284 58 132 132 620, 659 119 133 129 263 22, 40 40 376 25
for reverse engineering 530 general 22, 40 model 22, 40 physical 444, 448, 451 relationship 40 script 457, 510 Oracle add reference to bitmap join index 624 bitmap join index 621 bitmap join index properties 622 cluster 635 create bitmap join index 621 database link 636 database package 624 dimensions 634 extended attribute 638 generate dimensions 634 materialized view log 637 object data type 620, 659 rebuild bitmap join index 621 reverse engineer tablespace physical options 633 sequences 124 special variables 620 SQLJ object data type 620 transparent data encryption (TDE) 634 order trigger 238 outside table 449, 450, 452 owner 106, 284 database object 290 index 106
P
package check model display preferences PAM opened into CDM parameter generate test data modify database test data source parent table partition add corresponding table delete horizontal manage 409 354 15 474 508 475, 478, 480 101, 150, 524 77 77 77 70 77
745
Index
vertical partition function partition scheme PBCatCol PBCatTbl PDM archive check model create database DBMS overview dene environment display preferences domain extended dependencies generate from database object role save as select extended model denition validation permission Alter column database objects dene for user dene from object property sheet Delete Execute Grant Grant with grant option Index Insert object owner References reverse engineer Revoke Revoke with cascade Select Update physical data type physical diagram abstract data type column create default dene
72 553 554 83 83 9 381 5 7 364 332 348 115 369 528 58 3 9 367 381 290 295 290 290 293 290 290 290 290 290 290 290 290 282 290 290 290 290 365 129 86 61 111 58
group index key reference role synonym table user view view reference web operation web parameter web service physical option alternate key default dene primary key query table storage tablespace PKCOLN PostgreSQL extended attributes PowerBuilder extended attribute extended model denition generate extended attributes PBCatCol PBCatTbl reverse extended attributes pragma database package exception database package procedure precision preview bookmark change generation options keyboard shortcuts predened set of options refresh SQL tools storage command table tablespace command primary identier join primary index
300 103 95 138 298 302 62 283 152 169 316 321 311 450 188 188, 191 449 165 191 191 701 643 82 83 83 83 83 84 630 627 117 428 428 428 428 428 428 462 428 462 37
746
Index
non-unique Teradata unique primary key child column constraint dene designate drop generate generate from identier generate index index inheritance join name physical option rebuild referential integrity variable privilege create in DBMS editor dene dene for group dene for role dene for user generate Grant Grant with admin option reverse engineer Revoke procedure attach to table check model custom database package dene dependency display preferences edit with SQL editor example function insert generate inherit in abstract data type insert SQL/XML macro macro insert
679 679 679 58 54 86, 96 100 95 96 449, 450 448, 449 371 107 103, 106, 451 54 143 103 449 97, 524 146 100, 700 286 286 286 286 286 286 289 286 286 282 286 263 411 255 389 255 257 354 270 237 270 275 132 270 270
OOM operation operator insert permission properties SQL/XML wizard stored trigger template variable variable insert procedure (database package) procedure dependencies procedure template create identify model modify DBMS modify model properties type user-dened properties horizontal partitioning vertical partitioning proxy table create dene remote server extended model denition generate script Sybase ASA Sybase ASE
263 270 293 256 270 255 237 712, 715 270 626, 627 261 266 266 268 268 268 268 269 268 268 77 77 651 652 649 652 649 649, 655
Q
query execute performance SQL query table dene index materialized view physical options snapshot summary table view type queue quick launch quotation mark to generate 514 68 514 163 110 163 165 163 163 164 577 441 178
747
Index
R
rebuild bitmap join index 621 cube 200 database package procedure dependencies 261 defaults 113 index 107 IQ index 659, 660 primary key 97, 524 procedure dependencies 261 reference 148, 524 trigger dependencies 261 rebuild triggers create trigger automatically 224 delete and rebuild 232 delete trigger 232 insert trigger 232 select trigger template 232 template item 232, 246 trigger template 232, 246 update trigger 232 user-dened trigger 232 reference 58, 138 add to bitmap join index 624 add to join index 668 auto-migration 140 bend 150 cardinality 146, 355 change table 150 check model 412 child table 146 CODASYL 151 column variable 710 conceptual 151 create 138 delete 148 display 150, 151 display preferences 355 drag 150 generate 148 join 355 mode 150 model options 356 modify 150 move to table 150 name 355 notation 151, 356
number 101 number of children 146 preference 150, 151, 355 properties 142 rebuild 148, 524 relational 151 reuse column 140 straighten 150 text 355 variable 101, 709 view 157 References (permission) 290 referential integrity 146, 224 cardinality 146 cluster 146 delete 146 display 355 generate 146, 448 label 355 properties 146 update 146 reexive association 47 relational notation 151 relational to multidimensional mapping 205 relational to relational mapping 202 relationship 32 associative entity 40 cardinality 34, 41 change to entity 40 check model 413 code 40 create 32, 39 dene 34, 40 dependent 34 dominant 34 entity attribute 40 error 40 example 41 mandatory 34 option 40 optional 34 properties 32 reexive 39 unique code 40 relationship display preferences 356 remote server 652 remote service binding 582
748
Index
replication (PDM) repository in MS SQL Server requirements (model option) Resource Governor resource pool result column data type denition is element retrieve multidimensional objects WarehouseArchitect object reverse engineer Access 97 administrator permissions auto-layout block terminator constraint business rule cubes in MS SQL Server database package DB2 from a data source from database from script les from scripts generate PDM from database Java class link Java class optimization options owner lter parent tables permission PowerBuilder extended attributes privilege public names qualier lter rebuild primary key rebuild reference retrieve number of rows in tables script script les order shortcuts synonym creation synonyms system login in Oracle table with triggers
75 586 337 583 584 320 320 320 199 199 282 530 516 524 524 187 590 633 528 520 516 516 517 528 137 129 531 524, 530 528 524 282 84 282 84 528 524 524 524 282 516 527 524 306 633 528
tablespace physical options in Oracle terminator trigger script les user-dened and abstract data types variable reverse engineering encoding le encoding statistics Revoke permission privilege Revoke with cascade (permission) role assign role assign to a group assign to a user check model create privilege properties route RULES check parameter
633 524 530 528 712 525 525 532 290 286 290 283, 298 299 299 299 414 298 286 298 581 175
S
script alter begin comment create database create table customize database create edit end extraction format generate identier delimiter model modify database option preview table text color code title variable 506 444, 448, 455, 465, 467, 469 457, 510 438, 464 464 444, 448, 464, 465, 467, 469 444, 465 465, 467, 469 444, 448, 455, 465, 467, 469 202 457, 510 438, 444, 448, 457, 506, 510 457 444, 465 506 457, 510 428 448, 467 428 457, 510 465, 467
749
Index
security variables 714 segment 460 Select (permission) 290 sequence 124, 224 check model 415 create 124, 448 drop 448 generate 448 Interbase 124 properties 126 variable 715 serial (data type) PDM 117 server expression 177 SERVEREXPRESSION 701 service 580 service broker 573 service provider in web service import 311 settings sets 441 shortcuts reverse engineering in PDM 527 size database 500 snapshot 164 snapshot (index) 110 SOAP 311 sort columns 94 source (test data generation) 475, 478, 480 special variables in Oracle 620 specifying entity attribute 54 SQL query 514 SQL Server variable 715 SQL tools editor 426 preview 428 SQL/XML wizard 271 SQLBase column default 86 SQLJ object abstract data type 132 SQLJ object data type in Oracle 620 SqlListQuery 103 SQLXML macro 702 storage check model 415 command 462 congure 460 create 445
dene drop generate not used preview select storage group stored procedure create extended dependencies generation order straighten reference subtype in database package summary table Sybase AS Anywhere events Sybase AS IQ add reference to join index create join index data movement script dene join index events extended attribute features generate join index index type join index in table join index properties rebuild IQ indexes Sybase ASA auto-increment columns dene remote server of proxy extended attribute generate script for proxy tables proxy tables web services Sybase ASE dene remote server of proxy encryption key extended attribute generate script for proxy tables identity columns proxy table proxy tables web services Sybase IQ web services Sybase SQL Anywhere extended attribute
191, 462 445 445 415 462 191 460 255 275 275 150 630 110, 164 674 668 664 668 663 672 672 659 666 662 664 663 659, 660 649 652 653 652 649 311 652 655 657 652 649, 655 655 649 311 311 675
750
Index
symmetric key synonym alias base object check model code create create view dene drop lter generate name owner properties reverse engineer type visibility syntax (variables) System Administrator system login in database reverse for Oracle system privilege system role System Security Ofcer
564 302, 585 302 302 416 302 302, 454 305 302 454 454 306, 454 302 302 304 306, 524 302 302 470, 716 298 633 286 298 298
T
table alternate key attach procedure based on abstract data type bitmap join index check model check parameter comment constraint constraint business rule create create trigger data prole display preferences drop estimate database size external foreign key generate index indicate record 58, 62 98 263 64 622 417 448 448 67 185 62, 448, 464 225 489, 490 357 448 500 68 99, 139 448 103 501
join index message modify trigger multidimensional type notation permission physical option preview code primary key properties reverse engineer table triggers script statistics validation rule variable XML type table collapsing check model eliminate joins input tables object references remove target table wizard table generation tablespace begin script check model command congure create database prex in DB2 OS/390 dene drop enabledbprex end script generate not used preview reverse physical options in Oracle select TDE template item add to trigger template create from existing template item create new
664 278 233 199 359 293 448, 451 428 96 62 528 448, 467 532 448 705 65 73 419 73 74 74 74 81 74 74 373 469 419 462 460 444 191, 539 191, 462 444 539 469 444 419 462 633 191 634 248 246 248 248
751
Index
declare in trigger dene identify insert in trigger insert in trigger template modify DBMS properties rebuild triggers Teradata extended attributes primary index primary key transform group terminator test data assign data prole automatic generation column ll parameter data source distinct values export data prole generate generate from database generate from le generate from list generate option generation parameter import data prole number of rows restriction triggers use test data prole assign create default dene text reference TIME time data prole data type title script transform group Teradata transformation
235 224, 248 251 234 234 253 254 246 680 679 679 678 524 472 488 475, 478, 480 486 474 87 492 472, 493 483 484 482 493 474, 493 491 493 473 493 472 472 473 473 472 355 662 475 119 457, 510 678
column denormalization horizontal partitioning table collapsing vertical partitioning translate data types transparent data encryption (TDE) trigger check model create create automatically create manually declare template item dene dependency edit edit with SQL editor event function insert generate insert SQL/XML macro insert template item instead of macro macro insert modify modify from table multiple multiple events name convention operator insert order overview properties referential integrity reverse engineer script les reverse engineer table with triggers same type sequence SQL/XML wizard test data time user-dened variable variable insert view trigger dependencies trigger template
75 69 73 71 365 634 420 224 224 225 235 224 257 233 228 229 228, 233 275 228 234 156 693 228, 233 233 233 238 239 236 228, 233 238 224 228 224 530 528 238 224 228 493 229 225 711, 712 228, 233 156 261 240
752
Index
add template item create DBMS declare template item dene delete duplicate example identify insert insert template item macro model modify DBMS modify model name procedure properties rebuild triggers type update user-dened trusted context IBM DB2 type database package type (database package) denition public subtype typographic conventions
246 241 240, 241 235 224 244 241 237 243 237, 243 234 693 243 244 244, 253 236 237 245 246 243 244 243 537 389 630 630 630 ix
attach object check model create dene permission privilege properties role vs owner user schema user-dened error message generate index
284 420 283 284 290 286 283 298 284 601 278 279 103
V
validation CDM LDM PDM validation rule apply auto-migrate business rule check parameter column dene domain generate table variable abstract data type abstract data type attribute Adaptive Server Anywhere all named objects all objects business rule (PDM) check model code column column check parameter common constraint name data type database database options database package 381 381 381 174 177 139 177 177 177, 449 177 177 177, 446, 449 448 707 707 715 704 704 708 392 704 177, 696, 706 705 704 100, 101 392 712 714 389
U
undened data type unique code (model option) constraint index primary index UniqueConstName update constraint trigger template Update (permission) user add to group assign role 90, 115 342 98 98, 103, 106 679 185 146, 252 244 290 283 301 299
753
Index
database synchronization domain domain (PDM) domain check parameter foreign key format generated code index index column join index justify key list loop macro metadata primary key procedure reference reference column reverse engineer script security sequence SQL Server syntax table trigger view variable (database package) vertical partitioning check model preserve during generation properties remove wizard view check model column columns comment create create from synonym dene query display preferences drop extended dependencies force column list
713 177 707 705 700 470, 716 704 708 708 715 470, 716 711 704 704 714 700 715 101, 709 710 712 465, 467 714 715 715 470, 716 100, 101, 705 711, 712 711 628 71 421 79 77 81 72 58, 152 422 154 153 453 152, 448, 453 305 157 359 453 165, 166 453
generate generation order materialized query table modify column properties multidimensional type permission properties reference select table select view snapshot summary table table trigger type variable XML type view index view reference check model create display preferences join properties
448, 453 166 164 154 199 293 152 157 156 156 164 164 157 156 164 711 65 422 169 423 169 360 171 169
W
WarehouseArchitect retrieve object Web operation check model web operation create properties security properties web parameter create properties Web service check model in PowerDesigner local path web service create DADX extended model denition DADX les general denition generate web services for IBM DB2 import as service provider 199 58 424 316 316 316 319 321 321 321 58 424 311 311 311 312 324 312 310 324 311
754
Index
prex name properties reverse engineer web services types with default (column properties) WithOption workload group WSDL
X
XML data type index indexing table table column view XML schema collection XML Builder Wizard XPF import 569 567 567 65 570 65 569 376 491
755