Beruflich Dokumente
Kultur Dokumente
User’s Guide
POWERDESIGNER 7
Copyright (c) 1988–1999 Sybase, Inc. All rights reserved.
Information in this manual may change without notice and does not represent a commitment on the part of Sybase, Inc. and its
subsidiaries.
The software described in this manual is provided by Sybase, Inc. under a Sybase License agreement. The software may be used
only in accordance with the terms of the agreement.
No part of this publication may be reproduced, transmitted, or translated in any form or by any means, electronic, mechanical,
manual, optical, or otherwise, without the prior written permission of Sybase, Inc. and its subsidiaries.
Sybase, SYBASE (logo), ADA Workbench, Adaptable Windowing Environment, Adaptive Component Architecture, Adaptive
Server, Adaptive Server Anywhere, Adaptive Server Enterprise, Adaptive Server Enterprise Monitor, Adaptive Server
Enterprise Replication, Adaptive Server Everywhere, Adaptive Server IQ, Adaptive Warehouse, AnswerBase, Anywhere
Studio, Application Manager, AppModeler, APT Workbench, APT-Build, APT-Edit, APT-Execute, APT-FORMS, APT-
Translator, APT-Library, ASEP, Backup Server, BayCam, Bit-Wise, Certified PowerBuilder Developer, Certified SYBASE
Professional, Certified SYBASE Professional Logo, ClearConnect, Client-Library, Client Services, CodeBank, Column Design,
ComponentPack, Connection Manager, CSP, Data Pipeline, Data Workbench, DataArchitect, Database Analyzer, DataExpress,
DataServer, DataWindow, DB-Library, dbQueue, Developers Workbench, Direct Connect Anywhere, DirectConnect,
Distribution Director, E-Anywhere, E-Whatever, Electronic Case Management, Embedded SQL, EMS, Enterprise Application
Server, Enterprise Application Studio, Enterprise Client/Server, Enterprise Connect, Enterprise Data Studio, Enterprise
Manager, Enterprise SQL Server Manager, Enterprise Work Architecture, Enterprise Work Designer, Enterprise Work
Modeler, EWA, First Impression, Formula One, Gateway Manager, GeoPoint, ImpactNow, InfoMaker, Information Anywhere,
Information Everywhere, InformationConnect, InstaHelp, Intellidex, InternetBuilder, iScript, Jaguar CTS, jConnect for JDBC,
KnowledgeBase, Logical Memory Manager, MainframeConnect, Maintenance Express, MAP, MDI Access Server, MDI
Database Gateway, media.splash, MetaWorks, MethodSet, MySupport, Net-Gateway, Net-Library, NetImpact, Next
Generation Learning, Next Generation Learning Studio, O DEVICE, OASiS, OASiS logo, ObjectConnect, ObjectCycle,
OmniConnect, OmniSQL Access Module, OmniSQL Toolkit, Open Client, Open ClientConnect, Open Client/Server, Open
Client/Server Interfaces, Open Gateway, Open Server, Open ServerConnect, Open Solutions, Optima++, Partnerships that
Work, PB-Gen, PC APT Execute, PC DB- Net, PC Net Library, Power++, Power Through Knowledge, power.stop,
PowerAMC, PowerBuilder, PowerBuilder Foundation Class Library, PowerDesigner, PowerDimensions, PowerDynamo,
PowerJ, PowerScript, PowerSite, PowerSocket, Powersoft, PowerStage, PowerStudio, PowerTips, Powersoft Portfolio,
Powersoft Professional, PowerWare Desktop, PowerWare Enterprise, ProcessAnalyst, RelationalBeans, Report Workbench,
Report-Execute, Replication Agent, Replication Driver, Replication Server, Replication Server Manager, Replication Toolkit,
Resource Manager, RW-DisplayLib, RW-Library, S Designor, S-Designor, SAFE, SAFE/PRO, SDF, Secure SQL Server,
Secure SQL Toolset, Security Guardian, SKILS, smart.partners, smart.parts, smart.script, SQL Advantage, SQL Anywhere,
SQL Anywhere Studio, SQL Code Checker, SQL Debug, SQL Edit, SQL Edit/TPU, SQL Everywhere, SQL Modeler, SQL
Remote, SQL Server, SQL Server Manager, SQL SMART, SQL Toolset, SQL Server/CFT, SQL Server/DBM, SQL Server
SNMP SubAgent, SQL Station, SQLJ, STEP, SupportNow, Sybase Central, Sybase Client/Server Interfaces, Sybase
Development Framework, Sybase Financial Server, Sybase Gateways, Sybase Learning Connection, Sybase MPP, Sybase SQL
Desktop, Sybase SQL Lifecycle, Sybase SQL Workgroup, Sybase Synergy Program, Sybase Virtual Server Architecture,
Sybase User Workbench, SybaseWare, Syber Financial, SyberAssist, SyBooks, System 10, System 11, System XI (logo),
SystemTools, Tabular Data Stream, The Enterprise Client/Server Company, The Extensible Software Platform, The Future Is
Wide Open, The Learning Connection, The Model For Client/Server Solutions, The Online Information Center, Transact-SQL,
Translation Toolkit, Turning Imagination Into Reality, UltraLite, UNIBOM, Unilib, Uninull, Unisep, Unistring, URK Runtime
Kit for UniCode, Viewer, Visual Components, VisualSpeller, VisualWriter, VQL, WarehouseArchitect, Warehouse Control
Center, Warehouse Studio, Warehouse WORKS, Watcom, Watcom SQL, Watcom SQL Server, Web Deployment Kit,
Web.PB, Web.SQL, WebSights, WebViewer, WorkGroup SQL Server, XA-Library, XA- Server and XP Server are trademarks
of Sybase, Inc. or its subsidiaries
Unicode and the Unicode Logo are registered trademarks of Unicode, Inc.
iii
Naming a table constraint................................................. 30
Displaying text in table symbols ....................................... 31
Defining domains .................................................................... 35
Domain properties ............................................................ 35
Creating a domain ............................................................ 36
Indicating data type, length, and precision ....................... 37
Selecting a data type for a domain................................... 38
Selecting a data type from a list of standard data types... 40
Modifying domain properties ............................................ 43
Enforcing non-divergence from a domain ........................ 44
Using abstract data types ....................................................... 47
Types of abstract data types used in PowerDesigner ...... 47
How are abstract data types used in PowerDesigner? .... 48
Abstract data type properties ........................................... 49
Creating an abstract data type ......................................... 49
Linking an abstract data type to a Java class................... 51
Automatic linking to a Java class after reverse engineering55
Accessing a linked Java class in an OOM ....................... 55
Defining columns .................................................................... 58
Column properties ............................................................ 59
Creating a column ............................................................ 60
Selecting a data type for a column ................................... 61
Attaching a column to a domain ....................................... 63
Copying a column to another table................................... 65
Making a column mandatory or optional .......................... 66
Naming a column constraint............................................. 66
Configuring the display of the list of columns ................... 67
Defining keys .......................................................................... 69
Designating a primary key................................................ 70
Designating a foreign key................................................. 70
Adding parent table columns to a key .............................. 71
Auto-migrating foreign keys.............................................. 71
Designating an alternate key............................................ 73
Naming key constraints .................................................... 74
Defining references................................................................. 77
Reference properties........................................................ 78
Defining model options for references ............................. 79
Automatic reuse and migration of columns ...................... 80
Creating a reference......................................................... 82
Defining reference joins.................................................... 84
Changing a table at either end of a reference .................. 87
Sorting the list of references............................................. 88
Rebuilding references ...................................................... 89
Using referential integrity.................................................. 91
Referential integrity properties.......................................... 92
Defining referential integrity.............................................. 94
iv
Displaying text with reference symbols ............................ 96
Modifying a reference graphically..................................... 98
Defining indexes ................................................................... 100
Index properties.............................................................. 100
Creating an index ........................................................... 101
Removing a column from an index................................. 105
Rebuilding indexes ......................................................... 106
Deleting an index............................................................ 109
Defining views ....................................................................... 110
View properties............................................................... 110
Creating a view............................................................... 111
Modifying view properties ............................................... 114
Defining a query for a view ............................................. 115
Assigning an alias to a table or a column....................... 120
Inserting clauses in a query............................................ 121
Displaying query syntax.................................................. 125
Editing a query................................................................ 126
Displaying text in view symbols ...................................... 127
Defining check parameters ................................................... 129
Setting standard check parameters for objects.............. 129
Defining additional check parameters for objects .......... 131
Using a validation rule in check parameters................... 132
Managing quotation marks around values ..................... 134
Defining physical options ...................................................... 135
5 Reverse Engineering......................................................159
Reverse engineering a database schema ............................ 160
Generating a PDM from a database ..................................... 161
Filters and options for reverse engineering .................... 161
Reverse engineering database objects to a PDM .......... 162
v
Generating a PDM from a database creation script.............. 166
vii
8 Generating a Conceptual Data Model from a Physical Data
Model .............................................................................. 281
Generating CDM objects ...................................................... 282
Translating PDM to CDM objects ................................... 282
Translating PDM to CDM data types .................................... 283
Translating physical data types ...................................... 283
Generating a CDM from a PDM............................................ 286
Generating and updating a CDM.................................... 286
CDM generation parameters and options ...................... 287
Object selection parameters .......................................... 288
Generating a new CDM from a PDM.............................. 288
Updating an existing CDM.............................................. 291
Generating and updating a PDM .......................................... 295
PDM generation parameters and options....................... 296
viii
Defining default physical options in a DBMS.................. 331
Defining physical options in a DBMS.............................. 332
Glossary .........................................................................................353
Index .........................................................................................357
ix
x
About This Book
Subject This book describes the PowerDesigner Physical Data Model data modeling
environment. It shows you how to do the following:
♦ Build a Physical Data Model (PDM)
♦ Create and use business rules and other model objects
♦ Generate triggers, procedures, scripts, and databases
♦ Reverse engineer existing databases
♦ Generate a Conceptual Data Model and an Object-Oriented data Model
from a PDM
Audience This book is for anyone who will be building data models with
PowerDesigner. Although it does not assume you have knowledge about any
particular topic, having some familiarity with relational databases, SQL, and
design methodology is helpful.
Where to find This book focuses on the design and construction of a Physical Data Model.
information General information about the PowerDesigner modeling environment, for
example using many of the graphic tools, interface features, merging models,
and using the Browser, can be found in the PowerDesigner General Features
Guide.
To help you do your work more easily, this book is divided into chapters that
focus on particular goals.
xi
About This Book
xii
C H A P T E R 1
About this chapter This chapter presents the Physical Data Model (PDM) and explains the role
of physical modeling in the design process.
Contents
Topic Page
What is a PDM? 2
Objects in a PDM 3
Defining a PDM 4
Using the PDM palette tool bar 14
1
What is a PDM?
What is a PDM?
The PDM specifies the physical implementation of the database.
With the PDM, you consider the details of actual physical implementation. It
takes into account both software or data storage structures. You can modify
the PDM to suit your performance or physical constraints.
PDM roles The PDM fills the following roles:
♦ Represent the physical organization of data in a graphic format
♦ Generate database creation and modification scripts
♦ Define referential integrity triggers and constraints
♦ Reverse engineer existing databases
2
Chapter 1 Physical Data Model Basics
Objects in a PDM
A PDM represents the interaction of the following objects:
Object Description
Table Collection of rows (records) that have associated columns (fields)
Column Data structure that contains an individual data item within a row
(record), model equivalent of a database field.
Key Column or columns whose values uniquely identify each row in a
table. A key can be designated as a primary or alternate key
Primary key Column or columns whose values uniquely identify each row in a
table, and are designated as the primary identifier of each row in
the table
Alternate key Column or columns whose values uniquely identify each row in a
table, and which is not a primary key
Foreign key Column or columns whose values depend on and migrate from a
primary or alternate key in another table.
Index 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
Reference 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
View Data structure that results from a SQL query and that is built from
data in one or more tables
3
Defining a PDM
Defining a PDM
You can open existing PDM, or create a new PDM. You can also set options
to define how your model is modified, and the type of information that it
displays.
Creating a PDM
When you create a new PDM you must choose a current DBMS. All of the
objects that you create in a PDM conform to the SQL specifications of the
current DBMS.
DBMS library In PowerDesigner the current DBMS is a text file in XML format that
contains all the SQL syntax and specifications for an actual Database
Management System.
PowerDesigner has a DBMS definition for each supported database. These
DBMS definition files are stored in the DBMS Library directory in the
PowerDesigner path. Each DBMS definition file has the extension .XDB
which signifies XML Database File.
4
Chapter 1 Physical Data Model Basics
When you create a PDM you can choose to connect to a DBMS in one of the
following ways:
DBMS Description
Link Current DBMS for the PDM refers to the DBMS definition
file stored in the DBMS library. Any modifications made to
the DBMS are available to the linked PDM
Local to the model Current DBMS for the PDM is a copy of the DBMS
definition file stored in the DBMS library. The current
DBMS is independent of the original DBMS definition file
so any modifications made in the DBMS definition file in
the DBMS library are not available to the PDM. The
DBMS is saved with the PDM and can not be used
externally of it
5
Defining a PDM
Columns and From the Model Options dialog box, you can choose to enforce non-
Domains divergence between a domain definition and the columns using the domain,
for the following column properties:
6
Chapter 1 Physical Data Model Basics
Non-divergence Result
Not enforced Columns that are divergent from the domain definition can
remain attached to the domain
Enforced Columns that are divergent from the domain (for certain
column properties) must be detached from the domain
Column property When you choose to enforce non-divergence for a column property, each
can not be instance of that column property in the List of Columns and the Columns
modified page for the table property sheet, appears grayed and can not be modified.
If you want to modify a column property that is defined as non-divergent, you
must detach the column from its domain, or clear the Enforce non-divergence
checkbox in Model Options.
7
Defining a PDM
Enforce non- You can also clear the Enforce Non-divergence checkbox and select one or
divergence not more of the column properties listed below the checkbox.
selected
When you modify a column property and it diverges from the domain
definition that it is using, you are asked if you want to keep a modification
and diverge from the domain.
If you modify PDM model options, these options apply only to the current
PDM.
$ For information on other model options, see the PowerDesigner
Features Guide.
Reference You can select the following model options for references in your PDM:
8
Chapter 1 Physical Data Model Basics
9
Defining a PDM
Database properties
You can define a database for a PDM.
$ For more information on creating a database, see the section Creating a
database.
A database definition includes the following properties
10
Chapter 1 Physical Data Model Basics
Creating a database
You create a database for the model from the model property sheet.
v To create a database:
1 Select Model➤Model Properties.
The model properties sheet appears.
2 Click the Create tool at the end of the Database box.
11
Defining a PDM
Package properties
A package is a piece of a model.
When working with a large model, you can split the model into smaller
subdivisions to avoid manipulating the entire set of model objects. Packages
can be useful to assign portions of a model, representing different tasks and
subject areas, to different development teams.
12
Chapter 1 Physical Data Model Basics
You can create as many packages as you need in a model. The name of each
package must be unique in the model.
Packages have properties displayed on property sheets. All packages share
the following common properties:
13
Using the PDM palette tool bar
The majority of the tools in the Palette are common to all PowerDesigner
modules and are described in the PowerDesigner General Features Guide.
The following table indicates the names and functions of each tool that is
specific to the PDM in the Palette:
PDM object tools Tool Name Action
Table Insert table symbol
14
C H A P T E R 2
About this chapter This chapter describes how business rules help you model information.
Contents
Topic Page
15
What is a business rule?
16
Chapter 2 Using Business Rules
17
Defining business rules in a PDM
18
Chapter 2 Using Business Rules
19
Using business rules in a PDM
20
Chapter 2 Using Business Rules
21
Using business rules in a PDM
22
C H A P T E R 3
About this chapter This chapter describes how to build a Physical Data Model (PDM). It
explains the role of each object in a PDM. It also shows how to modify PDM
objects.
Contents
Topic Page
Defining tables 24
Defining domains 35
Using abstract data types 47
Defining columns 58
Defining keys 69
Defining references 77
Defining indexes 100
Defining views 110
Defining check parameters 129
Defining physical options 135
23
Defining tables
Defining tables
A table represents a collection of data arranged in columns and rows. It is the
model equivalent of a database table.
Table properties
A table definition includes the following properties:
Maximum
Property Description length
Name Name for the table. This name improves the 254
readability of the model
Code Reference Code for the table. This code is 254
generated in database scripts
Comment Descriptive label for the table 32K
Owner Name of table owner. You choose an owner from 254
a list of users. A table can only have one owner at
a time. This is normally the table creator
Number Estimated number of occurrences in the physical —
database for the table (the number of records).
This number is used to compute database size
Generate Indicates to generate the table in the database —
Type Table can be of type Dimension or Fact —
Check Table constraint that enforces data requirements —
of check parameters.
Script Begin and end scripts for table creation —
Preview SQL code for table —
Options Physical options for the table. These are DBMS —
specific
Version Table owner, version number, modification and
Information creation details
Notes Description associated with table
24
Chapter 3 Building Physical Data Models
A table definition also includes the following properties, each with their own
respective property sheet that can be accessed independently of the table.
♦ Columns
♦ Indexes
♦ Keys
♦ Triggers
♦ Business rules
Creating a table
There are three approaches to creating a table.
♦ Insert a table symbol directly in the diagram
♦ Add a new table to the list of tables
♦ Insert a table symbol in the diagram from the Browser
In each approach you must assign a name and a code to the table.
25
Defining tables
26
Chapter 3 Building Physical Data Models
27
Defining tables
28
Chapter 3 Building Physical Data Models
Up one page
Up one line
Bottom of list
29
Defining tables
The property page appears listing all instances of the property for that
table.
3 Select one or more items in the list.
4 Use the arrow buttons to move the items in the list.
5 Click OK.
5 Click OK.
30
Chapter 3 Building Physical Data Models
31
Defining tables
Table Columns You can display information about columns in each table.
display
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:
32
Chapter 3 Building Physical Data Models
33
Defining tables
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.
4 Click OK.
34
Chapter 3 Building Physical Data Models
Defining domains
Domains help you identify the types of information in your project. They
define the set of values for which a column is valid. Applying domains to
columns makes it easier to standardize data characteristics for columns in
different tables.
In a PDM, you can associate the following information with a domain:
♦ Data type, length, and precision
♦ Check parameters
♦ Business rules
♦ Mandatory property
Domain properties
Each domain definition includes the following properties:
35
Defining domains
A domain definition can also include the following properties, which have
associated values or information used by columns attached to the domain:
Property Description
Standard checks Check parameters defined for the domain
Additional checks Domain constraints or validation rules not defined by
standard check parameters
Rules Business rules attached to the domain
Creating a domain
v To create a domain:
1 Select Model➤Domains.
The list of available domains appears.
2 Click a blank line in the list.
or
Click the Add a Row tool.
An arrow appears at the beginning of the line.
3 Type a domain name and a domain code.
4 Click Apply.
The creation of the new domain is committed.
5 Click the new domain line.
An arrow appears at the beginning of the line.
6 Click the Properties tool.
or
Double-click the arrow at the beginning of the line.
36
Chapter 3 Building Physical Data Models
37
Defining domains
In the list of available data types, a variable indicates where you have to type
a length or precision, as follows:
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).
Undefined data All target DBMS allow you to select the <undefined> data type. The
type <undefined> data type indicates which domains remain without data types. If
an <undefined> data type is present when you generate your database, it is
replaced by the default data type for your database.
The list of standard When you select a data type for a domain from its property sheet, you can
data types choose a data type from a list of standard data types available in
PowerDesigner. This list presents the available data types in a more
structured and complete format than the abbreviated format used in the data
type dropdown listbox in the list of domains.
38
Chapter 3 Building Physical Data Models
5 Click OK.
5 Type the maximum number of characters for the data item in the Length
box.
6 If the data type can include values that take a decimal point, type the
number of places after the decimal point in the Precision box.
7 Click OK.
The change of data type appears in the list of domains.
39
Defining domains
Numeric data types Conceptual data type What it stores Length? Precision?
Integer 32-bit integer — —
Short Integer 16-bit integer — —
Long Integer 32-bit integer — —
Byte 256 values — —
Number Numbers with a fixed Fixed á
decimal point
Decimal Numbers with a fixed Fixed á
decimal point
Float 32-bit floating decimal Fixed —
numbers
Short Float Less than 32-bit floating — —
decimal number
Long Float 64-bit floating decimal — —
numbers
Money Numbers with a fixed Fixed á
decimal point
40
Chapter 3 Building Physical Data Models
41
Defining domains
5 Click the radio button corresponding to the data type you want to apply.
The code for the data type appears in the Code box.
42
Chapter 3 Building Physical Data Models
6 Type the maximum number of characters for the data type in the Length
box.
7 If the data type can include values that take a decimal point, type the
number of places after the decimal point in the Precision box.
8 Click OK.
The change of data type appears in the Data Type box.
43
Defining domains
5 Click OK.
If the domain is used by one or more columns, an update confirmation
box appears asking if you want to modify domain properties for the
columns using the domain.
If the domain is not used by any columns, then you do not receive the
update confirmation box.
6 Select the properties that you want to be updated for all columns using
the domain.
7 Click Yes.
Non-divergence Result
Not enforced Columns that are divergent from the domain definition can
remain attached to the domain
Enforced Columns that are divergent from the domain (for certain
column properties) must be detached from the domain
Enforcing non- In a PDM, you can enforce non-divergence from a domain for the following
divergence for column properties that are listed below the Enforce non-divergence checkbox
column properties in Model Options:
44
Chapter 3 Building Physical Data Models
45
Defining domains
46
Chapter 3 Building Physical Data Models
47
Using abstract data types
Abstract data
type is Description
Created You can create an abstract data type for each category
supported by the current DBMS. If you create a abstract data
type of type JAVA, you can link it to a Java class in an OOM
to access the Java class properties
Reverse Declaration of an abstract data type is reverse engineered into
engineered a PDM
You create abstract data types in the List of Abstract Data Types. When you
reverse engineer a database that contains abstract data types, the data type is
automatically added to the List of Abstract Data Types.
An abstract data type must be listed in the List of Abstract Data Types before
it is available as a data type for columns and domains in the PDM.
$ For more information on reverse engineering a database into a PDM,
see the chapter Reverse Engineering.
$ For more information on linking Java classes, see the section Linking
an abstract data type to a Java class.
Linking to Java You cannot create a Java class in a PDM. You need to specify the name and
classes in the code of a Java class in the List of Abstract Data Types, then link it to a Java
object-oriented class in a PowerDesigner Object-Oriented Model. The OOM must be open in
model the current Workspace. Once an abstract data type is linked to a Java class,
you can access the Java class property sheet.
Automatic linking You can reverse engineer a database that contains Java classes into a PDM.
of reversed Java To have access to the Java class properties, you must also reverse engineer
classes the Java classes into an OOM. The columns or domains that use the Java
classes as data types in the PDM are then automatically linked to the
corresponding Java classes in the OOM.
$ For more information on creating and reverse engineering Java classes
into a PowerDesigner Object-Oriented Model, see the PowerDesigner
Object-Oriented Model User’s Guide.
48
Chapter 3 Building Physical Data Models
Depending on its type, an abstract data type definition 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
49
Using abstract data types
50
Chapter 3 Building Physical Data Models
Depending on the type of abstract data type that you select, other
property boxes or page tabs may appear on the property sheet. For
example, the property sheet for an VARRAY in Oracle 8 shows the
properties Data Type, Size, Length, and Precision.
51
Using abstract data types
or
Double-click the arrow at the start of the line.
The abstract data type property sheet appears.
52
Chapter 3 Building Physical Data Models
A Java class selection box appears. It lists all the Java classes that are
available in the PowerDesigner object-oriented models that are currently
open in the Workspace.
53
Using abstract data types
8 Click the Properties button at the end of the Target Object box.
The target class property sheet appears.
9 Click OK.
You return to the shortcut property sheet.
10 Click Close
54
Chapter 3 Building Physical Data Models
55
Using abstract data types
5 Click the Properties button at the end of the Target Object box.
56
Chapter 3 Building Physical Data Models
6 Click OK.
You return to the Shortcut property sheet.
7 Click Close
8 Click OK in each of the dialog boxes.
57
Defining columns
Defining columns
A column contains an individual data item within a row. It is the model
equivalent of a database column. A column is always defined 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.
58
Chapter 3 Building Physical Data Models
Column properties
Each column definition includes the following properties:
Maximum
Property Description length
Name Name for the column. This name improves the 254
readability of the model
Code Reference code for the column 254
Comment Descriptive label for the column 32K
Table Table which contains column
Data type Form of the data corresponding to the column, 30
such as numeric, alphanumeric, boolean, or others
Length Maximum length of the data type —
Precision Maximum number of places after the decimal 1000
point
Domain Name of the associated domain —
Primary key When selected, designates a column whose values —
uniquely identify a row in the table
Foreign key When selected, designates a column that depends —
on and migrates from a primary key column in
another table
Mandatory When selected, indicates a column that must be —
assigned a value
Identity (For Sybase System 10, Sybase System 11, and —
MS SQL Server 6 only). When selected, indicates
that the data is auto-incremented
With default (For Ingres, DB2, SQLBase, Xdb, Datacom, and —
OpenIngres only) When selected, indicates if a
default value is assigned to the column when a
Null value is inserted
59
Defining columns
A column definition also includes the following properties, each with their
respective property sheets:
Property Description
Detail Column fill parameters. These determine the percentage of
column entries for which a null value is permitted, and the
percentage of column rows that contain unique values
Standard checks Standard check parameters
Additional checks SQL expression defining a check parameter
Creating a column
A column is always defined for a table. When you create a column you must
assign it a name and a code.
v To create a column:
1 Double-click a table in the model.
The table property sheet appears.
2 Click the Columns tab.
The Columns page appears. It lists columns defined for the table.
60
Chapter 3 Building Physical Data Models
61
Defining columns
62
Chapter 3 Building Physical Data Models
7 Click OK.
You return to the Columns page. The new data type for the column
appears in the Data Type column.
8 Click OK.
or
Click another column in the list.
63
Defining columns
5 Select a domain from the Domain dropdown listbox at the bottom of the
dialog box.
6 Click OK.
You return to the Columns page. In the Data Type column, the domain’s
data type replaces the data type previously defined for the column.
7 Click OK.
or
Click another column in the list.
64
Chapter 3 Building Physical Data Models
65
Defining columns
66
Chapter 3 Building Physical Data Models
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.
67
Defining columns
68
Chapter 3 Building Physical Data Models
Defining keys
A key is a column, or a combination of columns, that uniquely identifies a
row in a table. Each key can generate a unique index or a unique constraint in
a target database.
The PDM supports the following types of keys:
Key Description
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 identifies 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 identified 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.
69
Defining keys
You can define one or more columns as the primary key of a table from the
list of columns.
70
Chapter 3 Building Physical Data Models
71
Defining keys
The following table shows the results of different actions when you choose to
auto-migrate foreign key columns:
Action Result
Modify reference Migrate primary key in parent table to foreign key in child
attach point table
Delete unused foreign key columns
Modify reference join
Delete primary Delete corresponding foreign key and reference join
key
72
Chapter 3 Building Physical Data Models
6 Click Apply.
The constraint name and code are committed.
7 Click the new key name.
An arrow appears at the beginning of the line.
73
Defining keys
Variable Description
%TABLE% Code of the table
$ For a full list of all variables that can be used in PowerDesigner, see the
appendix PowerDesigner Variables.
74
Chapter 3 Building Physical Data Models
The Keys page appears. It lists keys defined for the table.
3 Select the primary key.
4 Click the Properties tool.
The property sheet for the primary key appears.
5 Type changes to the name in the Constraint Name box.
The User-Defined button at the end of the Constraint box is pressed
automatically.
Variable Description
%REFRNAME% Name of the reference
%REFRCODE% Code of the reference
%PARENT% Code of the parent table
%CHILD% Code of the child table
$ For a full list of all variables that you can use in PowerDesigner, see the
appendix Variables in PowerDesigner.
75
Defining keys
Variable Description
%AK% Code of the alternate key
%AKNAME% Name of the alternate key
%TABLE% Code of the table
$ For a full list of all variables that you can use in PowerDesigner, see the
appendix Variables in PowerDesigner.
76
Chapter 3 Building Physical Data Models
Defining references
A reference is a link between a parent table and a child table. It defines a
referential integrity constraint between column pairs for a primary key, or
alternate key, and a foreign key, or between user specified 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
specified 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).
Linking keys and Depending on its properties, a reference can link a parent table and a child
user-specified table in two ways:
columns
Reference links Description
Primary key, alternate key Primary or alternate key in the parent table is
and foreign keys linked to a foreign key in the child table
User specified columns One or more columns in the parent table are linked
to corresponding columns in the child table. The
linked columns in both tables are specified by the
user, and are linked independently of primary key,
alternate key, and foreign key columns
77
Defining references
Reference properties
The definition of a reference includes the following properties:
Maximum
Property Description length
Name Name for the reference. This name 254
improves the readability of the model
Code Code for the reference 254
Comment Descriptive label for the reference 32Kb
Parent table Parent table of reference. This table —
contains the primary key, or alternate
key, linked by the reference
Child table Child table of reference. This table —
contains the foreign key linked by the
reference
Generate When selected, indicates to generate the —
reference in the database
Joins Links between parent table columns and —
child table columns
Integrity Integrity constraints defined for reference —
78
Chapter 3 Building Physical Data Models
79
Defining references
80
Chapter 3 Building Physical Data Models
Auto-reuse From Model Options, you can choose to automatically reuse an existing child
columns table column as a foreign key column by selecting the following model
options:
♦ Default Link on Creation: Primary key
♦ Auto-reuse Columns
The Child table column must have the same code as the migrating primary
key column, and can not already be a foreign key column.
PowerDesigner does not automatically reuse existing foreign key columns.
This must be done manually from the Joins page of the reference property
sheet.
Matching child The following table shows the results of migrating primary key columns to a
table column exists child table that contains a matching column for one of the primary key
columns. The original two tables are also shown below:
81
Defining references
Matching child The following table shows the results of migrating primary key columns to a
table column is child table that contains a matching child table column that is already a
already a FK foreign key column for another table. The original two tables are also shown
column below:
Creating a reference
You can create a reference that links a primary key, or alternate key, to a
foreign key, or user-specified columns in both parent and child tables.
When you create a reference, its properties depend on the current model
options, and the existence, or non-existence, of a foreign key column in the
child table with the same code as a migrating primary key column.
$ For more information on selecting model options for references see the
sections Defining model options for references.
$ For more information on column migration and reuse, see the section
Auto-migrating foreign keys.
82
Chapter 3 Building Physical Data Models
v To create a reference:
1 Click the Reference tool in the tool palette.
2 Drag the reference link from the child table to the parent table containing
the primary key, or alternate key, to migrate.
The link appears between the two tables.
83
Defining references
84
Chapter 3 Building Physical Data Models
Linking columns in For any reference you can choose to link a primary key, or alternate key, to a
a primary or corresponding foreign key. When you select a key from the Joins page of the
alternate key reference property sheet, all the key columns are linked to matching foreign
key columns in the child table.
Reuse and You can use the following buttons on the Joins page to reuse or migrate
Migration option for columns linked by joins.
a selected
reference Button Name 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
85
Defining references
3 Select a key from the Parent Key dropdown listbox to create joins
between primary key, or alternate key, and foreign key columns.
or
Select <NONE> from the Parent Key dropdown listbox to create joins
between user-specified columns.
The columns linked by the joins are listed in the Parent Table and Child
Table columns. If you selected <NONE>, the column lists are empty.
86
Chapter 3 Building Physical Data Models
For example, when you click the column heading Name, the references are
listed by reference name alphabetically when the down arrow is indicated,
and in reverse order when the up arrow is indicated.
88
Chapter 3 Building Physical Data Models
Rebuilding references
Rebuilding references in a PDM creates default references between tables
with matching key columns.
Rebuilding references is useful following the reverse engineering of a
database in which all of the references could not be reverse engineered.
You can choose to rebuild references in one of two ways:
You can choose to rebuild all references in your model, or select the tables
that are linked by the references that you want to rebuild.
v To rebuild references:
1 Select Tools➤Rebuild References.
The Rebuild References dialog box appears.
2 Select the Delete and Rebuild radio button.
or
Select the Preserve radio button.
3 Click the Selection tab.
89
Defining references
A selection page appears. It lists all the tables in the current model.
5 Click OK.
If you selected the Delete and Rebuild mode, a confirmation box asks
you to confirm your choice. If you selected the Preserve mode, you do
not receive a confirmation box.
6 Click Yes to confirm the deletion and rebuild of the selected references.
90
Chapter 3 Building Physical Data Models
91
Defining references
Property Description
Constraint name Name of the referential integrity constraint. Maximum
length is 254 characters
Implementation Indicates whether implementation of referential integrity is
declarative, or by the use of triggers
Cardinality Indicates the maximum and minimum number of instances
in a child table that can appear for each corresponding
instance in the parent table
User-defined Indicates a user-defined constraint name
Update constraint How updating a key value, in the parent table affects the
foreign key value in the child table
Delete constraint How deleting a row in the parent table affects the child table
Mandatory parent Each foreign key value in the child table must have a
corresponding key value, in the parent table
Change parent A foreign key value can change to select another value in
allowed the referenced key in the parent table
Check on commit* Verifies referential integrity only on the commit, instead of
verifying it after row insertion. You can use this feature to
control circular dependencies
* Only available for Sybase SQL Anywhere 5.0 and 5.5.
Cardinality Defining cardinality allows you to control the minimum and maximum
number of children permitted for each parent. You can use the following
values to define cardinality:
92
Chapter 3 Building Physical Data Models
Update and delete Update constraint and delete constraint take any of the following values:
constraints
93
Defining references
You define referential integrity from the Integrity page of the reference
property sheet.
94
Chapter 3 Building Physical Data Models
The Integrity page appears. If no constraint name has been defined, the
default constraint name is shown in the Constraint name box.
95
Defining references
Label Displays
Name Name or code of the reference*
Constraint name Referential integrity constraint name
Join Statement of linked columns between the two tables
Referential integrity Update and delete referential integrity constraints.
Cardinality Minimum and maximum number of instances in a child
table that can appear for each corresponding instance in
the parent table
Implementation Implementation mode of referential integrity, declarative
or by triggers
*Displayed text depends on whether the Name or Code radio button is selected.
Referential integrity The referential integrity label indicates update and delete integrity, as
label follows:
96
Chapter 3 Building Physical Data Models
Default Cardinality The default cardinality labels for PowerDesigner indicate the minimum and
labels maximum number of children as follows:
[minimum..maximum]
For example, the cardinality label [0..n] indicates that any number of children
is acceptable.
Referential integrity The referential integrity label shown below indicates the following:
example
♦ Cascade on update
♦ Set null on delete
♦ Cardinality is 0..n (any number of children is acceptable).
97
Defining references
98
Chapter 3 Building Physical Data Models
4 Click OK.
99
Defining indexes
Defining indexes
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.
Index properties
Each index definition includes the following properties:
Maximum
Property Description length
Name Name of the index 254
Code Reference name of the index 254
Comment Descriptive label for the index 32Kb
Table Indicate table to index —
Type Proprietary index type (for RedBrick, Unify, and 30
Oracle only)
Unique Indicate whether an index is a unique index —
Cluster Indicate whether an index is a cluster index
An index definition also includes the following properties, which are defined
on associated property sheets:
Property Description
Columns Columns associated with index
Column Definition Indicate primary key, foreign key, or alternate key to
index. The index is associated with the columns of the
selected key
Options Physical options for the index. These are DBMS specific
Rules Business rules attached to the index
100
Chapter 3 Building Physical Data Models
Type Description
User defined Identifies a row in the table for a column that is not a key column
Linked to Uniquely identifies a row in the table
primary key
Linked to Depends on and migrates from a primary key in another table
foreign key
Linked to Uniquely identifies a row in the table, which is not also indexed
alternate key by a primary key
Unique Index in which no two rows can have the same index value. All
primary key indexes must be unique
Cluster Index in which the physical order and the logical (indexed) order
is the same
Creating an index
You can either create a user defined index which is associated with one or
more columns, or create an index that you link to a primary key, alternate
key, or foreign key.
Index naming Use the following naming conventions for indexes:
conventions
Index Naming convention
Primary key Table code followed by PK; for example EMPLOYEE _PK
Foreign key Table code followed by FK; for example PROJECT _ FK
Alternate key Table code followed by AK; for example EMPLOYEE _ AK
Index ascending or You can indicate the index order for each column attached to an index, by
descending order selecting or clearing the A checkbox at the end of the line, for each column
listed on the Columns page of the Index property sheet. When the A
checkbox is selected the order is ascending, when it is cleared the order is
descending.
101
Defining indexes
102
Chapter 3 Building Physical Data Models
The Columns page appears. It lists columns associated with the index. At
index creation the list is empty as there are no columns yet associated
with an index.
8 Click the Add a Row tool.
A list of columns defined for the table appears.
9 Select one or more columns.
Click OK.
You return to the Columns page. The columns associated with the index
appear in the column list.
10 Select the A checkbox at the end of the column line, if you want index
entries to be in ascending order for that column.
or
Clear the A checkbox at the end of the column line, if you want index
entries to be in descending order for that column.
11 Click OK in each of the dialog boxes.
103
Defining indexes
The Indexes page appears. It lists indexes associated with the table.
104
Chapter 3 Building Physical Data Models
9 Select the A checkbox at the end of the column line, if you want index
entries to be in ascending order for that column.
or
Clear the A checkbox at the end of the column line, if you want index
entries to be in descending order for that column.
10 Click OK in each of the dialog boxes.
105
Defining indexes
Rebuilding indexes
Rebuilding indexes in a PDM automatically updates any changes that you
have made to primary keys, foreign keys, or alternate keys in your model.
You can rebuild indexes for one or more tables in a PDM. You can also
choose to rebuild indexes from the model, or a from a package.
Rebuilding index You can indicate the following parameters to rebuild indexes:
options
Parameters Description
Primary key only When selected, rebuilds primary key indexes. The text
box shows the naming convention for primary keys. By
default this is %TABLE%_PK
Other keys When selected, rebuilds alternate key indexes. The text
box shows the naming convention for alternate keys. By
default this is %AKEY%_AK
Foreign key indexes When selected, rebuilds foreign key indexes. The text
box shows the naming convention for foreign keys. By
default this is %REFR%_FK
Foreign key threshold 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 defined in the
Number box in the table property sheet. If the table has
no specified number of occurrences, the foreign key
indexes are generated by default
Delete and Rebuild When selected all existing indexes are deleted before
index rebuilding
Preserve Indexes When selected, preserves all existing indexes in a PDM.
106
Chapter 3 Building Physical Data Models
107
Defining indexes
108
Chapter 3 Building Physical Data Models
Deleting an index
There are two ways to delete an index:
♦ Delete an index from the list of indexes
♦ Delete an index from a table
109
Defining views
Defining views
View properties
The view definition includes the following properties:
Maximum
Property Description length
Name Name for the view 254
Code Code for the view. This code is generated in 254
database scripts
Comment Descriptive label for the view 32Kb
Owner 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
Usage Group of properties that affect database script —
generation
Property Description
Query only Defines view for consultation only. View cannot update
tables
Updateable Defines view for consultation and update. View can update
tables
With check option Implements controls on view insertions
Generate Includes view generation as part of database generation
script
110
Chapter 3 Building Physical Data Models
A view definition also includes the following properties, each with their
respective page:
Property Description
Columns Columns of the view
SQL Query SELECT statements defining the view
Preview SQL preview of view definition
Creating a view
You have two ways to create a view:
♦ Create a view for tables selected in the diagram
♦ Create an empty view then select tables from a list of tables
111
Defining views
A view symbol appears in the model. It displays all the columns in each
of the tables selected for the view. The names for the tables appear at the
bottom of the view symbol.
112
Chapter 3 Building Physical Data Models
2 Select checkboxes for tables that you want to be included in the view.
3 Click OK.
A view symbol appears in the model. It displays all the columns in each
of the tables selected for the view. The names for the tables appear at the
bottom of the view symbol.
113
Defining views
114
Chapter 3 Building Physical Data Models
4 Click OK.
or
Click a different view in the list.
115
Defining views
The SQL Query page appears. It shows each SELECT query in the
Query dropdown listbox. The text for the query appears in the textbox.
3 Select a query from the Query dropdown listbox. This is the query that
contains the SELECT statement to which you want to add a table.
4 Click the Properties tool from the tool bar at the top of the page.
The property sheet for the SELECT query appears. The query definition
is shown in the textbox.
5 Click the Tables tab if you want to add a table to the view.
or
Click the Columns tab if you want to add columns to the view.
The Tables or Columns page appears. It lists the tables or columns
currently included in the SELECT statement.
6 Click the Add a Row tool.
Click the new line in the list.
or
Click a new line in the list.
116
Chapter 3 Building Physical Data Models
A dropdown list appears. It lists all the available tables in the model, or
all the available columns for the tables currently defined for the view.
8 Click OK.
You return to the SQL query page. The table and all of its columns, or
the selected new columns, are added to the SELECT statement. If you
select tables that share a reference link, the reference is automatically
added in a WHERE clause to the query.
9 Click OK.
The new table and columns appear in the view symbol.
117
Defining views
The property sheet for the SELECT query appears. The query definition
is shown in the textbox.
5 Click the Where tab.
118
Chapter 3 Building Physical Data Models
The Where page appears. It shows the SQL expression for the parent
table column and the child table column that are linked by the =
operator.
119
Defining views
A dropdown list appears. It lists all the available columns in the tables
defined for the view.
7 Select a column.
Click in the Operator column for the same line.
A dropdown listbox appears listing SQL operators.
8 Select the = operator.
Click in the second Expression column for the same line.
A dropdown listbox appears listing available columns.
Select a column.
9 Click OK.
10 You return to the SQL Query page. The new reference is added to the
WHERE clause.
120
Chapter 3 Building Physical Data Models
The property sheet for the SELECT query appears. The query definition
is shown in the textbox.
5 Click the Tables tab.
or
Click the Columns tab.
The Table or Columns page appears.
6 Click the number at the start of the line for the table or column to which
you want to assign an alias.
An arrow appears at the start of the line, and the line is highlighted.
7 Click the Alias column for the same line.
8 Type an alias in the Alias column.
9 Click OK in each of the dialog boxes.
121
Defining views
6 Select a column.
7 Type a prefix in the Prefix column.
Type a suffix in the Suffix column.
8 Click OK.
122
Chapter 3 Building Physical Data Models
Customizing an expression
You can customize a column expression by clicking the Ellipsis
button next to the down arrowhead. An SQL Editor appears. Type an
expression in the textbox and click OK. The new expression appears
in the column list.
5 Click OK.
The selected columns appear in a GROUP BY clause in the textbox
containing the SQL statement in the SQL Query page.
123
Defining views
Customizing an expression
You can customize an expression by clicking the Ellipsis button next
to the down arrowhead. An SQL Editor appears. Type an expression
in the textbox and click OK. The new expression appears in the
Expression column.
4 Select a column.
Click in the Operator column for the same line.
A dropdown listbox appears listing SQL operators.
5 Select an operator.
Click in the second Expression column for the same line.
A dropdown listbox appears listing available columns.
6 Select a column.
7 Type a prefix in the Prefix column.
Type a suffix in the Suffix column.
8 Click OK.
124
Chapter 3 Building Physical Data Models
Customizing an expression
You can customize a column expression by clicking the Ellipsis
button next to the down arrowhead. An SQL Editor appears. Type an
expression in the textbox and click OK. The new expression appears
in the column list.
5 Click OK.
The selected columns appear in an ORDER BY clause in the textbox
containing the SQL statement in the SQL Query page.
125
Defining views
Editing a query
You can use editing features in the SQL Editor to edit a query.
The SQL Editor appears. It displays the SQL query in the textbox. The
category of objects that you can add to the query are listed in the box to
the top left, and the individual objects that you can add within each
category are listed in the center box.
4 Click the position in the definition textbox where you want to insert the
SQL script for an object.
5 Select a category from the top left box.
For example, select Tables to display the list of available tables. The list
of available objects in that category appear in the middle box.
6 Double-click the item that you want to add to the script.
or
126
Chapter 3 Building Physical Data Models
Text display
preference When selected, what it displays
Columns All columns in the view, an asterisk (*) for multiple column
selection, or a defined number (limit) of columns depending on
the selections listed below*
*All columns All columns in the view. Multiple column selection is represented
by an asterix (*)
*No formulas All columns in view including multiple column selection
*Limit (x) Number of columns depending on defined value of x
Tables Tables in the view
Owner Name of view owner
Name Column name specific to the view
Expression SQL expression for each column
Data types Data type for each column
127
Defining views
Default options
Click the Default button to display default View display preferences.
Click the Set As Default button to set current display preferences as
default selections.
4 Click OK.
128
Chapter 3 Building Physical Data Models
Can be
Parameter type Description attached to
Standard check Common data constraints which define a Columns
parameters data range. For example minimum and Domains
maximum values for a column
Additional check SQL expression defining a data Columns
parameters constraint using the %MINMAX%, Domains
%LISTVAL%, and %RULES% variables
that are instantiated with standard
parameter values
Validation rule Business rule that is defined as a server Tables
expression, and is attached to one of the Columns
following listed objects Domains
Parameter Description
Minimum Lowest acceptable numeric value
Maximum Highest acceptable numeric value
Default Value assigned in absence of an expressly entered value
Unit Standard measure
Format Data format (for example, 9999.99)
Lowercase Forces all alphabetical characters to lowercase
Uppercase Forces all alphabetical characters to uppercase
Cannot Modify Protects from changes, results in a non-modifiable column in
the table when generated in the database
129
Defining check parameters
Parameter Description
List of Values Authorized values
Label String that identifies an authorized value in the list
130
Chapter 3 Building Physical Data Models
Variable Description
%MINMAX% Minimum and maximum values defined in Values groupbox on
Standard Checks page
%LISTVAL% Customized values defined in List Values groupbox on
Standard Checks page
%RULES% Validation rule expression defined on Expression page of the
Rules property sheet
You define additional check parameters for data constraints where standard
check parameters are not sufficient.
Example A table in a data model for a clothing shop may contain check parameters
defined for a column SIZE, which depend on the check parameters defined
on another column 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 defined for both columns.
131
Defining check parameters
Variable Value
%COLUMN% Code of the column to which the business rule applies
%DOMAIN% Code of the domain to which the business rule applies
132
Chapter 3 Building Physical Data Models
Variable Value
%TABLE% Code of the table to which the business rule applies
%MINMAX% Minimum and maximum values for the column or domain
%LISTVAL% List values for the column or domain
%RULES% Server validation rules for the column or domain
$ For more information on defining business rules, see the chapter Using
Business Rules.
133
Defining check parameters
134
Chapter 3 Building Physical Data Models
135
Defining physical options
Tablespace and You can choose a tablespace or storage already defined in the model as a
storage options value for a tablespace or storage that you define for a table. These are listed
in a dropdown listbox at the bottom of the Options page when you choose to
add a tablespace or storage for a table.
136
Chapter 3 Building Physical Data Models
3 Select an option from the options listed on the Syntax page in the left
pane.
4 Click the Add tool.
The name of the option appears on the Items page in the right pane
5 Select the option in the Items page in the right pane.
137
Defining physical options
The option name appears with an equals sign next to a text box at the
bottom of the dialog box. Depending on the type of value the option can
take, a dropdown listbox can appear instead of a text box.
6 Type a value for the option in the text box below the right pane
or
Select a value from the dropdown listbox below the right pane.
7 Click OK.
138
C H A P T E R 4
About this chapter This chapter describes how to manage objects in a Physical Data Model
(PDM) with users and object owners. It also describes checking the validity
of a PDM, retrieving multidimensional objects used in a WarehouseArchitect
Model (WAM), importing an ERwin model.
Contents
Topic Page
139
Managing users and owners
The user is a name that identifies a person or group working with objects in a
PDM, which has the ability to own other objects in the PDM. You can create
a user and then attach the user to an object.
Owners When a user is attached to an object, it becomes the owner of that object.
Each object can only have one owner at a time. Only an object owner has the
right to modify the object. In a PDM, you use the owner relationship to help
to organize and keep track of modifications to objects in the model.
Example When you create a table, by default the object has no owner. You can select
your user name from a list of users, and attach it to the table. You then
become the table’s owner.
Owners for tables In a PDM, the following objects can have owners:
views, procedures
♦ Tables
and functions
♦ Views
Each table or view in a PDM, can have only one owner at a time.
You can also attach a user to a procedure or function.
Owner uses You can use object owners for the following purposes:
Purpose Description
Managing object In a model where many users have access to the same
modifications in a objects, you can control object modifications by attaching
PDM owners to objects
Generating a In a model where many users have access to the same
database for owner objects, you can generate a database only for the objects
specific objects that belong to a particular owner
140
Chapter 4 Managing Physical Data Models
Creating a user
You need to create a user before you can attach that user to an object.
v To create a user:
1 Select Model➤Users.
The List of Users appears.
2 Click a blank line in the list.
or
Click the Add a Row tool.
An arrow appears at the beginning of the line.
3 Type a user name and a user code.
4 Click OK.
141
Managing users and owners
4 Click OK.
142
Chapter 4 Managing Physical Data Models
Checking a PDM
You can use the Check Model to check the validity of a PDM at any time.
The following general rules apply to PDM:
♦ Each object name must be unique
♦ Model constraints must be compatible with database constraints
♦ Each table must have at least one column
♦ Each index must have a column
♦ Each reference must have at least one column pair
The procedure that generates a database starts by checking the validity of the
PDM. If an error is found, the database (or database generation script) is not
generated.
143
Checking a PDM
Object Parameter
Package Circular references
Constraint name uniqueness
Tables Table name and code uniqueness and length
Existence of key, index, column, and reference
Number of auto-incremented columns
Domains and Domain name and code uniqueness and length
columns Incoherent default values and validation rules
Data type precision and definition
Column and domain divergence
Indexes Index name and code uniqueness and length
Existence and numbers of index columns
Multiple clustered and identical indexes
Unidentified PK,AK,FK indexes
Key consistency
Divergence from cluster status
Primary and alternate Key name and code uniqueness
keys Key code length
Keys without, with too many, and with identical columns
References Reference and constraint code uniqueness
Reference code length
Circular dependency
Existence of reference joins
Declarative referential integrity constraints
Default integrity options
FK data type, business rule definition divergence from
relevant key column definition
Views View name and code uniqueness and length
Incomplete query
Users User name and code uniqueness
User code length
Triggers Trigger code length
Procedures Procedure code length
144
Chapter 4 Managing Physical Data Models
Message Description
Error Major problem that impedes database generation
Warning Minor problem or recommendation
145
Checking a PDM
Indicating error You can use the following tools from the Check Model Parameters dialog
severity box to indicate either an error or warning level of problem severity, and also
if you want PowerDesigner to automatically correct an error:
Include Sub-
Parent object packages Displays
Model Selected All objects in model including all objects
contained in packages and sub-packages
Model Not selected All objects in model except objects
contained in packages and sub-packages
Package Selected All objects contained in package including
all objects contained in sub-packages
Package Not selected All objects in package except objects
contained in sub-packages
146
Chapter 4 Managing Physical Data Models
147
Checking a PDM
6 Select a model from the dropdown list at the top of the dialog box.
7 Click an object tab.
The corresponding object page displays all the objects in the current
PDM.
8 Select checkboxes for objects that you want to be checked.
Clear checkboxes for objects that you do not want to be checked.
9 Click OK.
148
Chapter 4 Managing Physical Data Models
The Check Model Result List displays errors and warnings based on
your choice of check options.
149
Checking a PDM
Navigating in the The Check tool bar also contains navigation tools that you can use to move to
error list the first, previous, next, or last errors that are listed. You can also navigate in
the list of errors by right-clicking an object parameter and selecting Go To
First error, Previous error, Next error, or Last error from the context menu.
150
Chapter 4 Managing Physical Data Models
Automatic Automatic correction fixes the following types of errors and warnings:
correction
♦ Inappropriate foreign key columns
♦ Non-unique names
♦ Code too long for target database (if you select Database Constraints)
♦ Inappropriate primary keys, foreign keys, and unique indexes
♦ Divergence in domain values, check parameters, and validation rules for
auto-migrated foreign keys
151
Checking a PDM
152
Chapter 4 Managing Physical Data Models
Opening a WAM
You can open a version 6 WarehouseArchitect Model (WAM) in
PowerDesigner. To do so, select File ➤ Open, and type *.wam in the File
Name box. Select a model from the list of existing models that appears,
and click OK. The WAM is converted into a PDM.
153
Importing an ERwin model into a PDM
You cannot import ERwin triggers and stored procedures, Erwin rules, Erwin
user-defined properties, ERwin reports, or ER1 files. Text color and fonts are
also not imported. If you are using ERwin/SQL, generate a database from
your ER1 file and then reverse engineer that database into a PDM.
154
Chapter 4 Managing Physical Data Models
6 Select a format.
7 Click OK.
A progress box shows the progress rate of the import process. At the end
of the import process, the model appears in the diagram.
155
Exporting a PowerDesigner 7 model to PowerDesigner 6
156
Chapter 4 Managing Physical Data Models
157
Exporting a PowerDesigner 7 model to PowerDesigner 6
158
C H A P T E R 5
Reverse Engineering
About this chapter This chapter describes how you can reverse engineer database objects to a
PDM.
Contents
Topic Page
159
Reverse engineering a database schema
Generate PDM
using Description
Script file You reverse engineer an SQL script which contains creation
statements. This is normally the script used to generate the
database
ODBC data source You reverse engineer the schema for an existing database,
specifying an ODBC data source, and connection
information
160
Chapter 5 Reverse Engineering
User-defined and You can reverse engineer user defined and abstract datatypes. In the
abstract data types generated PDM, the names of these data types appear in the List of Abstract
Data Types.
161
Generating a PDM from a database
Filter Description
Qualifier A qualifier is a database or partition in a database that contains one
or more tables. When a qualifier is selected as a filter, it restricts the
objects available for reverse engineering to the objects contained
within the selected qualifier
Owner Normally the creator of a database object is its owner. When Owner
is selected as a filter; it restricts the objects available for reverse
engineering to the objects owned by the selected owner
Reverse options Reverse engineering options are dependant on object type, and the selected
DBMS. To display, or modify, the reverse engineering options for an object
type, you click the appropriate page tab in the ODBC Reverse engineering
dialog box. Unavailable options appear grayed.
You can select reverse engineering options for the following object types:
162
Chapter 5 Reverse Engineering
Automatic When you merge database objects that have been reverse engineered into a
archiving current PDM, you can choose to archive the newly generated PDM, by
selecting the Automatic Archive checkbox from the model merge window.
$ For more information on comparing and merging two models, see the
chapter Comparing and Merging Models in the PowerDesigner General
Features Guide.
163
Generating a PDM from a database
8 Select a filter for Qualifier and Owner in the dropdown listboxes at the
top of the dialog box.
9 Click an object type tab.
Select checkboxes for objects to reverse engineer.
Clear checkboxes for objects that you do not want to reverse engineer.
Select or clear checkboxes for options where they are available for each
object type.
164
Chapter 5 Reverse Engineering
10 Select or clear object and option checkboxes for each object type that
you want to reverse engineer.
11 Click OK.
The progress of the generation is shown in the Output window.
At the end of the generation, the new PDM appears in the PDM window.
165
Generating a PDM from a database creation script
166
C H A P T E R 6
About this chapter This chapter presents triggers and procedures used to generate database
constraints.
Contents
Topic Page
167
Trigger overview
Trigger overview
What is a trigger? A trigger is a segment of SQL code associated with a table, 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.
You can use triggers to enforce referential integrity, where declarative
constraints are not sufficient.
168
Chapter 6 Triggers and Procedures
A template item can be stored in the current model, or in the current DBMS.
PowerDesigner ships pre-defined template items for each supported DBMS.
The type of pre-defined template items available depends on the current
DBMS.
The availability of The availability of a trigger template, or template item, to models other than
trigger templates the current model, depends on where the template is stored:
and template items
Template stored in Available to
Model Current model only
DBMS Link All models using the DBMS (.XDB file)
DBMS Local To Current model only
Model
Overview of trigger An overview of the creation of triggers by the Rebuild Triggers function is
creation by Rebuild shown below:
Triggers
169
Using triggers
Using triggers
A trigger is a segment of SQL code associated with a table, 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.
$ For an overview of how triggers are used in PowerDesigner, see the
section How are triggers used in PowerDesigner?
Trigger properties
Each trigger definition includes the following properties:
The Definition page of the trigger property sheet also includes the following
trigger properties:
Property Description
Template Template which trigger is based on
Type Type of trigger which is defined by the named template
Order Firing order of trigger
170
Chapter 6 Triggers and Procedures
You can use variables in triggers, trigger templates, and template items. At
trigger generation these variables are replaced by values for a specific model
or table.
$ For a complete list of variables used in PowerDesigner, see the
appendix Variables in PowerDesigner.
Formatting You can also use formatting variables that have a syntax that can force a
variables format on their values, as follows:
♦ Force values to lower-case or upper-case characters
♦ Truncate the length of values
$ For a complete list of formatting variables used in PowerDesigner, see
the appendix Variables in PowerDesigner.
You can select trigger types, trigger templates, and template items by
expanding the appropriate nodes and selecting or clearing the checkboxes as
required.
The Rebuild Triggers General page for Sybase Adaptive Server Anywhere 6
is shown below. The node for the BeforeInsert Trigger is expanded showing
the BeforeInsertTrigger template that it is based on, and the two template
items InsertChildParentExist and InsertToo Many Children:
Template items When you select a template item it is included in the corresponding trigger
template. If a trigger is generated from the template, the template item is
generated in the trigger script if one of the following criteria apply:
♦ Template item implements trigger referential integrity constraints that
apply to a reference. A template item can therefore be defined in a
trigger template, but will only exist in the generated trigger if it
implements the referential integrity defined for a reference
♦ Template item is user defined. User-defined template items for a
generated trigger are generated independently of referential integrity
constraints
172
Chapter 6 Triggers and Procedures
Trigger as You must select Trigger as the implementation option for referential
referential integrity integrity, for one or more of the references attached to the table. This can be
option done on the Integrity page for the relevant reference.
You can select Trigger as the implementation option for multiple references,
by selecting Trigger from the Implementation dropdown listbox for each
reference from the List of References.
$ For more information on selecting referential integrity options from the
Reference property sheet, see the section Defining referential integrity in the
chapter Building Physical Data Models.
2 Select the Delete and Rebuild radio button if you want to delete all
existing triggers and rebuild using trigger templates.
or
Select the Preserve radio button if you want to keep all existing triggers
and create triggers using trigger templates.
173
Using triggers
174
Chapter 6 Triggers and Procedures
Naming triggers
When you name a trigger, you cannot use a name that has already
been used for another trigger attached to the same table. Each new
trigger must have a name that is unique in the list.
5 Click Apply.
The creation of the new trigger is committed.
6 Click the new trigger line.
An arrow appears at the start of the line.
7 Click the Properties tool.
or
Double-click the arrow at the start of the line.
The property sheet for the new trigger opens to the General page.
8 Select the Generate checkbox.
or
Clear the Generate checkbox.
9 Click the Definition tab.
175
Using triggers
The type of trigger that is defined by the template appears in the Type
dropdown listbox, and the trigger definition appears in the text box.
11 Type modifications to the definition.
12 Select the order that you want the trigger to fire from the Order
dropdown listbox.
176
Chapter 6 Triggers and Procedures
Modifying a trigger
You can customize a trigger as follows:
♦ Modifying its definition code directly. You can type changes to the
trigger definition, and also use editing tools to insert pre-defined
variables, operators, functions, and macros into the trigger definition
code.
♦ Inserting template items into the definition code to implement referential
integrity constraints, or do any work updating or modifying tables in the
database
.
Accessing a trigger You can modify a trigger from its property sheet. You can access a trigger
property sheet property sheet in several ways:
♦ From the table property sheet click the Triggers tab, select a trigger from
the list of triggers that appears, and click the Properties tool
♦ From the List of Triggers, select a trigger and click the Properties tool
♦ From the Browser, right-click the trigger node under the appropriate
table node in the tree view, and select Properties from the contextual
menu
177
Using triggers
Inserting script You can modify a trigger definition by typing changes directly to the trigger
items script. You can insert pre-defined operators; variables, functions and macros
into the trigger definition by clicking on the appropriate tool from the Insert
Script tool bar, and selecting an item from the menu that appears. The
selected script item is inserted at the cursor position in the definition code.
You can use the following tools to insert script items into the trigger
definition:
Variable
Function
Macro
Adding template You can add a template item defined in the current model or defined in the
items current DBMS to a trigger definition. A template item can call a macro to
implement referential integrity, or perform any other type of action on
database tables.
$ For more information on creating and using template items, see the
section Using template items.
v To modify a trigger:
1 Click the Definition tab from the trigger property sheet.
178
Chapter 6 Triggers and Procedures
The Definition page appears. It shows the definition code of the trigger
template selected for the trigger.
179
Using triggers
Multiple triggers
Depending on the current DBMS, you can have multiple triggers of the same
type defined 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 field, 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 proposed salary
is less than that of the prospective manager.
create trigger tibTestSalry1 before insert order 1 on
EMPLOYEE
referencing new as new_ins for each row
begin
declare user_defined_exception exception for
SQLSTATE ’99999’;
declare salary_out_of_range_exception exception for
SQLSTATE ’99991’;
declare minsal integer;
declare maxsal integer;
180
Chapter 6 Triggers and Procedures
from EMPLOYEE
where EMPFUNC=new_ins.EMPFUNC;
181
Using triggers
Previewing a trigger
You preview a trigger in order to display the generated contents of a trigger
with instantiated variables. You can preview a trigger from the Preview page
of the trigger property sheet.
v To preview a trigger:
♦ Click the Preview tab from the trigger property sheet.
The Preview page appears. The trigger definition appears in the preview
text box.
♦ Click OK in each of the dialog boxes.
182
Chapter 6 Triggers and Procedures
DBMS trigger DBMS trigger templates are defined in the current DBMS.
templates
The availability of DBMS trigger templates to other models depends on where
the templates are stored:
You can create a trigger template in the DBMS. You can also use and modify
the pre-defined trigger templates delivered with PowerDesigner.
183
Using trigger templates
PowerDesigner The pre-defined DBMS templates that ship with PowerDesigner indicate
pre-defined DBMS referential integrity constraints for one of the three trigger types: insert,
templates update, and delete. Depending on the current DBMS, there is a before and
after event template for each trigger type.
You can modify the trigger definition in the PowerDesigner pre-defined
trigger templates, but they cannot be deleted or renamed.
$ For more information on creating and copying a DBMS, see the chapter
DBMS Basics.
User-defined A user-defined trigger template is any trigger template that has been created
trigger templates in the model or in the current DBMS.
Model trigger A model trigger template is a trigger template defined in a model. It can not
templates be used by other models. Model trigger templates are always user-defined.
184
Chapter 6 Triggers and Procedures
Update templates
Template type Generates trigger or procedure that executes ...
UpdateTrigger With update
BeforeUpdateTrigger Before update
AfterUpdateTrigger After update
UpdateProc When called by UpdateTrigger
BeforeUpdateProc When called by BeforeUpdateTrigger
AfterUpdateProc When called by AfterUpdateTrigger
Delete templates
Template type Generates trigger or procedure that executes ...
DeleteTrigger With delete
BeforeDeleteTrigger Before delete
AfterDeleteTrigger After delete
DeleteProc When called by DeleteTrigger
BeforeDeleteProc When called by BeforeDeleteTrigger
AfterDeleteProc When called by AfterDeleteTrigger
185
Using trigger templates
Template items in The Template Item page that can be accessed from the trigger template
a trigger template property sheet, lists the template items that are defined 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 page is not deleted
from the trigger template definition.
You can therefore limit the template items available for generation by
removing template items from the Template Item page, without having to
remove them from the trigger template definition.
Rebuild triggers When you use Rebuild Triggers to automatically create triggers for selected
tables, the template items that are listed on this page are those that are
available to be generated. 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 defined for a reference attached to the
table
♦ Template items are generated in a trigger if they are user-defined. User-
defined template items are generated independently from trigger
referential integrity constraints
186
Chapter 6 Triggers and Procedures
Adding template You can add any template item from the model or DBMS to the Trigger
items to trigger template definition by clicking an Add Template Items tool from the
template definition Definition page of the trigger template property sheet, and selecting a
template item. It is automatically added to the Template Items page.
You can use variables in triggers, trigger templates, and template items. At
trigger generation these variables are replaced by values for a specific model
or table.
$ For a complete list of variables used in PowerDesigner, see the
appendix Variables in PowerDesigner.
Formatting You can also use formatting variables that have a syntax that can force a
variables format on their values, as follows:
♦ Force values to lower-case or upper-case characters
♦ Truncate the length of values
$ For a complete list of formatting variables used in PowerDesigner, see
the appendix Variables in PowerDesigner.
187
Using trigger templates
Associating a You can associate a trigger name with a trigger template. It is recommended
trigger name with a that you follow trigger naming conventions when naming triggers. For
template example, tib2_%TABLE%.This helps prevent duplicating a trigger for the
same table.
$ For information on trigger naming conventions, see the section Trigger
naming conventions
188
Chapter 6 Triggers and Procedures
A selection box appears. It lists all the trigger templates available in the
current DBMS.
189
Using trigger templates
4 Select a checkbox for the type of trigger template that you want to use as
the basis for your new template.
5 Click OK.
6 You return to the Trigger Templates page. The duplicate DBMS
template is listed.
7 Type a new name and code for the new template.
8 Click Apply.
The creation of the new template is committed.
9 Click the new template line.
An arrow appears at the beginning of the line.
10 Click the Properties tool.
or
Double-click the arrow at the beginning of the line.
The property sheet for the new trigger template appears.
190
Chapter 6 Triggers and Procedures
191
Using trigger templates
192
Chapter 6 Triggers and Procedures
A selection box appears. It lists all the trigger templates available in the
current DBMS.
3 Select a checkbox for the type of trigger template that you want to use as
the basis for your new template.
4 Click OK.
5 You return to the Trigger Templates page. The duplicate DBMS
template is listed.
6 Type a new name and code for the new template.
7 Click Apply.
The creation of the new template is committed.
8 Click the new template line.
An arrow appears at the beginning of the line.
9 Click the Properties tool.
or
193
Using trigger templates
Inserting script You can modify a trigger template definition by typing changes directly to
items the template script. You can insert pre-defined operators; variables, functions
and macros into the trigger template definition by clicking on the appropriate
tool from the Insert Script tool bar, and selecting an item from the menu that
appears. The selected script item is inserted at the cursor position in the
definition code.
You can use the following tools to insert script items into the trigger template
definition:
195
Using trigger templates
Variable
Function
Macro
Adding template You can add a template item defined in the current model or defined in the
items current DBMS to a trigger template definition. A template item can call a
macro to implement referential integrity, or perform any other type of action
on database tables.
$ For more information on creating and using template items, see the
section Using template items.
196
Chapter 6 Triggers and Procedures
or
Click in the trigger template definition where you want to insert a script
item.
Click a script item tool.
Select a script item from the menu.
or
Click in the trigger template definition where you want to insert a
template item.
Click the Add Template Item tool.
Select a template item from the list that appears, and click OK.
7 Click OK.
A confirmation box appears asking if you want to save the changes to the
DBMS.
8 Click Yes.
197
Using trigger templates
198
Chapter 6 Triggers and Procedures
Some target databases do not accept code within a trigger statement. For
these databases, a trigger template can call a related procedure as a
parameter, which is defined in a procedure template. In these cases,
procedure templates are listed in the list of trigger templates.
Example 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%", "", ",", "));")
/
The template InsertProc defines the procedure, as follows:
-- 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;
/
199
Using template items
200
Chapter 6 Triggers and Procedures
How are template Template items are inserted in a trigger or trigger template definition using a
items inserted in a point followed by the template item name: . template item name. For
trigger definition? example the script below 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
/
Certain DBMS require that a cursor and variables are declared for each
template item before the template item name appears in the script. You can
use the following format to declare a template item:
.Decl template item name.
$ For more information on declaring template items in a trigger or trigger
template, see the section Declaring a template item in a trigger definition.
PowerDesigner PowerDesigner ships pre-defined template items for each pre-defined trigger
pre-defined template defined in the supported DBMS. The Rebuild Triggers function
template items uses both pre-defined and user-defined trigger templates to automatically
create triggers for selected tables.
In the pre-defined trigger templates, each pre-defined template item
corresponds to a referential integrity constraint. Although a pre-defined
template item is defined in a trigger template, it is only generated in a trigger
script if it implements the trigger referential integrity defined for a reference.
Template items have the following generation conditions:
201
Using template items
User-defined You can create template items in the model or current DBMS.
template items
Unlike the PowerDesigner pre-defined template items, user-defined template
items are generated in triggers by Rebuild Triggers independently from
referential integrity constraints. If a user-defined template is listed on the
Template Items page of the trigger template property sheet, it will always be
generated in the trigger.
You can create a template item in the current DBMS. If the DBMS is a
DBMS Link, then the template item is available to other models using the
same DBMS. If the DBMS is local to the model, or if you create the template
item in the model, it is available only to the current model.
$ For more information on creating and copying a DBMS, see the chapter
DBMS Basics.
202
Chapter 6 Triggers and Procedures
Update constraints The template items below implement referential integrity in update trigger
templates.
Delete constraints The template items below implement referential integrity in delete trigger
templates.
203
Using template items
Constraint You can insert the following template items in any trigger template. They
messages generate error messages that indicate the violation of an integrity constraint.
You can use variables in triggers, trigger templates, and template items. At
trigger generation these variables are replaced by values for a specific model
or table.
$ For a complete list of variables used in PowerDesigner, see the
appendix Variables in PowerDesigner.
Formatting You can also use formatting variables that have a syntax that can force a
variables format on their values, as follows:
♦ Force values to lower-case or upper-case characters
♦ Truncate the length of values
$ For a complete list of formatting variables used in PowerDesigner, see
the appendix Variables in PowerDesigner.
204
Chapter 6 Triggers and Procedures
205
Using template items
A selection box appears. It lists all the template items available in the
current DBMS.
4 Select a checkbox for the type of template item that you want to use as
the basis for your new template item.
5 Click OK.
206
Chapter 6 Triggers and Procedures
6 You return to the Trigger Template Items page. The duplicate DBMS
template item is listed.
7 Type a new name and code for the new template item.
8 Click Apply.
The creation of the new template item is committed.
9 Click the new template item line.
An arrow appears at the beginning of the line.
10 Click the Properties tool.
or
Double-click the arrow at the beginning of the line.
The property sheet for the new template item appears.
207
Using template items
208
Chapter 6 Triggers and Procedures
A selection box appears. It lists all the trigger templates available in the
current DBMS.
3 Select a checkbox for the type of trigger template that you want to use as
the basis for your new template.
4 Click OK.
5 You return to the Trigger Templates page. The duplicate DBMS
template is listed.
6 Type a new name and code for the new template.
7 Click Apply.
The creation of the new template is committed.
8 Click the new template line.
An arrow appears at the beginning of the line.
9 Click the Properties tool.
or
Double-click the arrow at the beginning of the line.
209
Using template items
You can customize a template item by modifying its definition code directly.
You can type changes to the template item definition, and also use editing
tools to insert pre-defined variables, operators, functions, and macros into the
template item definition code.
.
Inserting script You can modify a template item definition by typing changes directly to the
items template item script. You can insert pre-defined operators; variables,
functions and macros into the template item definition by clicking on the
appropriate tool from the Insert Script tool bar, and selecting an item from
the menu that appears. The selected script item is inserted at the cursor
position in the definition code.
211
Using template items
You can use the following tools to insert script items into the template item
definition:
Variable
Function
Macro
212
Chapter 6 Triggers and Procedures
A confirmation box appears asking if you want to save the changes to the
DBMS.
8 Click Yes.
213
Using template items
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;
/
In a generated trigger script, .DeclInsertChildExist corresponds to the
following definition:
.FOREACH_PARENT()
-- Declaration of InsertChildParentExist constraint for
the parent "[%PQUALIFIER%]%PARENT%"
.DEFINE "CURSOR" "cpk%REFNO%_%.25L:TABLE%"
cursor %CURSOR%(.JOIN("var_%.L26:FK% %.L:COLTYPE%", "",
",", ") is")
select 1
from [%PQUALIFIER%]%PARENT%
where .JOIN("%PK% = var_%.L26:FK%", "and ")
and .JOIN("var_%.L26:FK% is not null", "and ",
"", ";")
.ENDFOR
You define a declaration statement for a template item in the Declaration
page from the template item property sheet. The declaration statement is
automatically inserted in the trigger script when the trigger is generated.
You can use editing tools to insert script items into the template item
declaration.
$ For a description of the editing tools available to insert script items in a
definition, see the section Modifying a template item.
214
Chapter 6 Triggers and Procedures
215
Defining stored procedures and functions
Variable
Function
Macro
216
Chapter 6 Triggers and Procedures
The property sheet for the new procedure or function opens to the
General page.
An arrow appears at the beginning of the line.
7 Click the Definition tab.
The Definition page appears.
8 Select Procedure from the dropdown listbox at the top of the page.
or
Select Function from the dropdown listbox at the top of the page.
The template definition appears in the text box.
9 Type the procedure or function definition code in the text box.
217
Using macros
Using macros
You can use predefined macros in trigger templates, template items, triggers,
and procedures. Macros perform specific functions.
AKCOLN
Description Repeats a statement for each alternate key in a table
Syntax .AKCOLN("statement","prefix","suffix","last_suffix", "condition")
Argument Description
statement Statement to repeat for each column
prefix Prefix for each new line
suffix Suffix for each new line
last suffix Suffix for the last line
condition Alternate key code (if condition argument is left empty the macro
returns a statement for each alternate key in the table)
ALLCOL
Description Repeats a statement for each column in a table
Syntax .ALLCOL("statement","prefix","suffix","last_suffix")
Argument Description
statement Statement to repeat for each column
218
Chapter 6 Triggers and Procedures
Argument Description
prefix Prefix for each new line
suffix Suffix for each new line
last suffix Suffix for the last line
DEFINE
Description Defines a variable and initializes its value.
Syntax .DEFINE "variable" "value"
Argument Description
variable Variable name (without % signs)
value Variable value (may include another variable surrounded by %
signs)
219
Using macros
DEFINEIF
Description Defines a variable and initializes its value if the test value is not null
Syntax .DEFINEIF "test_value" "variable" "value"
Argument Description
test_value Value to test
variable Variable name (without % signs)
value Variable value (may include another variable surrounded by %
signs)
ERROR
Description Handles errors
Syntax .ERROR (errno, "errmsg")
Argument Description
errno Error number
errmsg Error message
FKCOLN
Description Repeats a statement for each foreign key column in a table
Syntax .FKCOLN("statement","prefix","suffix","last_suffix")
Argument Description
statement Statement to repeat for each column
prefix Prefix for each new line
suffix Suffix for each new line
220
Chapter 6 Triggers and Procedures
Argument Description
last suffix Suffix for the last line
FOREACH_CHILD
Description Repeats a statement for each parent-to-child reference in the current table
fulfilling a condition
Syntax .FOREACH_CHILD ("condition")
"statement"
.ENDFOR
Argument Description
condition Reference condition (see below)
statement Statement to repeat
Condition Selects
UPDATE RESTRICT Restrict on update
UPDATE CASCADE Cascade on update
UPDATE SETNULL Set null on update
UPDATE SETDEFAULT Set default on update
DELETE RESTRICT Restrict on delete
DELETE CASCADE Cascade on delete
DELETE SETNULL Set null on delete
DELETE SETDEFAULT Set default on delete
221
Using macros
FOREACH_COLUMN
Description Repeats a statement for each column in the current table fulfilling a condition
Syntax .FOREACH_COLUMN ("condition")
"statement"
.ENDFOR
Argument Description
condition Column condition (see below)
statement Statement to repeat
Condition Selects
empty All columns
PKCOLN Primary key columns
FKCOLN Foreign key columns
AKCOLN Alternate key columns
NMFCOL Non-modifiable columns (columns that have Cannot Modify
selected as a check parameter)
INCOLN Triggering columns (primary key columns, foreign key columns;
and non-modifiable columns)
222
Chapter 6 Triggers and Procedures
FOREACH_PARENT
Description Repeats a statement for each child-to-parent reference in the current table
fulfilling a condition
Syntax .FOREACH_PARENT ("condition")
"statement"
.ENDFOR
Argument Description
condition Reference condition (see below)
statement Statement to repeat
INCOLN
Description Repeats a statement for each primary key column, foreign key column,
alternate key column, or non-modifiable column in a table.
Syntax .INCOLN("statement","prefix","suffix","last_suffix")
223
Using macros
Argument Description
statement Statement to repeat for each column
prefix Prefix for each new line
suffix Suffix for each new line
last suffix Suffix for the last line
JOIN
Description Repeats a statement for column couple in a join
Syntax .JOIN("statement","prefix","suffix","last_suffix")
Argument Description
statement Statement to repeat for each column
prefix Prefix for each new line
suffix Suffix for each new line
last suffix Suffix for the last line
224
Chapter 6 Triggers and Procedures
NMFCOL
Description Repeats a statement for each non-modifiable column in a table. Non-
modifiable columns have Cannot Modify selected as a check parameter.
Syntax .NMFCOL("statement","prefix","suffix","last_suffix")
Argument Description
statement Statement to repeat for each column
prefix Prefix for each new line
suffix Suffix for each new line
last suffix Suffix for the last line
PKCOLN
Description Repeats a statement for each primary key column in a table
Syntax .PKCOLN("statement","prefix","suffix","last_suffix")
Argument Description
statement Statement to repeat for each column
prefix Prefix for each new line
suffix Suffix for each new line
last suffix Suffix for the last line
225
Using macros
226
Chapter 6 Triggers and Procedures
Parameter Description
DBMS Current DBMS
Directory Destination directory for the script file
File Name Destination filename for the script file
Generation Type Trigger generation by script or using ODBC
One File Only When selected creates one script file, instead of a separate
script file for each trigger
227
Generating triggers and procedures
Script options indicate the format of generation scripts for triggers and
procedures.
Referential integrity options indicate whether to generate referential integrity
as a trigger or as a declarative statement.
The availability of these options depends on the current database.
Unavailable options display in gray and you cannot select them.
228
Chapter 6 Triggers and Procedures
Error message
parameters Parameter Resulting generation command
Standard Generate standard error messages
User-defined Generate user-defined error messages
229
Generating triggers and procedures
Include Sub-
Parent object packages Displays
Model Selected All tables or procedures in model including
all those contained in packages and sub-
packages
Model Not selected All tables or procedures in model except
those contained in packages and sub-
packages
Package Selected All tables or procedures contained in
package including all those contained in
sub-packages
Package Not selected All tables or procedures in package except
those contained in sub-packages
Listing objects for You can apply a filter to list only tables belonging to a particular owner. If
an owner you select the Owner <NONE> you display all the tables belonging to all
owners for the selected model or package.
230
Chapter 6 Triggers and Procedures
231
Generating triggers and procedures
232
Chapter 6 Triggers and Procedures
233
Generating triggers and procedures
234
Chapter 6 Triggers and Procedures
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 the section
Creating triggers automatically.
9 Click OK.
The trigger rebuilding process is shown in the Output window.
Select Database➤Generate Triggers and Procedures.
The Trigger and Procedure Generation dialog box appears.
236
Chapter 6 Triggers and Procedures
237
Generating triggers and procedures
238
C H A P T E R 7
About this chapter This chapter explains how to generate and modify databases using scripts and
via ODBC drivers.
Contents
Topic Page
239
Using the ODBC interface
240
Chapter 7 Database Creation and Modification
241
Using the ODBC interface
You can use the ODBC administrator program to configure a data source.
242
Chapter 7 Database Creation and Modification
243
Using the ODBC interface
244
Chapter 7 Database Creation and Modification
Accessing a database
PowerDesigner allows you to change the target database of your model,
display data from the database that corresponds to your model, and send SQL
queries to a connected data source.
245
Accessing a database
Link and Local to When you change the current DBMS, you can choose to connect to a target
the model DBMS DBMS in one of the following ways:
DBMS Description
Link Target DBMS for the PDM refers to the DBMS definition
file stored in the DBMS library. Any modifications made to
the DBMS are available to the linked PDM
Local to the model Target DBMS for the PDM is a copy of the DBMS
definition file stored in the DBMS library. The target
DBMS is independent of the original DBMS definition file
so any modifications made in the DBMS definition file in
the DBMS library are not available to the PDM. The
DBMS is saved with the PDM and can not be used
externally of it
2 Select a target DBMS from the dropdown listbox in the New groupbox.
3 Select the Link radio button.
or
Select the Local To The Model radio button.
4 Click the Options tab.
246
Chapter 7 Database Creation and Modification
The Options page appears. It displays options for database objects that
can be preserved or lost when the target DBMS is changed.
247
Accessing a database
248
Chapter 7 Database Creation and Modification
249
Configuring tablespace and storage
250
Chapter 7 Database Creation and Modification
251
Configuring tablespace and storage
The Options page appears. The syntax page in the left pane lists the
database options available for a tablespace or storage. These options are
DBMS specific, and not all DBMS support options for tablespaces and
storages.
6 Select an option from the options listed on the Syntax page in the left
pane.
7 Click the Add button.
The name of the option appears on the Items page in the right pane
8 Select the option in the Items page in the right pane.
252
Chapter 7 Database Creation and Modification
The option name appears with an equals sign next to a text box at the
bottom of the dialog box. Depending on the type of value the option can
take, a dropdown listbox can appear instead of a text box.
9 Type a value for the option in the text box below the right pane
or
Select a value from the dropdown listbox below the right pane.
10 If you want to include more options in the tablespace or storage
definition, select other options and type or select their parameter values.
11 Click OK.
253
Configuring tablespace and storage
5 Click OK.
254
Chapter 7 Database Creation and Modification
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 specific to the
generated script.
If an organization requires that generated scripts are filed using a naming
system which may be independent from a script name, a header script could
direct a generated script to be filed under a different name than the name
indicated in the creation script.
Access rights can be added as a footer to a table creation script.
255
Customizing scripts
Variable Description
%DATABASE% Name of the current PDM
%DATE% Date of script generation
%DBMSNAME% Name of the DBMS for the target database
%NAMESCRIPT% Filename of script file
%PATHSCRIPT% Filename and path of script file
%STARTCMD% Command that runs the script
%USER% Author of the current model
256
Chapter 7 Database Creation and Modification
3 Click Yes.
The database property sheet appears.
257
Customizing scripts
Variable Description
%COLNLIST% Column list
%DATABASE% Code of the current PDM
%DATE% Date of script generation
%DBMSNAME% Code of the DBMS for the target database
%NAMESCRIPT% Filename of script file
%OWNER% Table owner
%OWNERPREFIX% Owner prefix of table owner
%PATHSCRIPT% Filename and path of script file
%STARTCMD% Command that runs the script
%TABLE% Name or code of current table (based on display
preferences)
%TCODE% Code of the current table
%TLABL% Label of the current table
%TNAME% Name of the current table
%USER% Author of the current model
258
Chapter 7 Database Creation and Modification
259
Generating a database
Generating a database
You can create or modify a database in two ways:
♦ Directly execute a script on a connected data source using an ODBC
driver
♦ Generate a script to be executed on a DBMS at a later time
In both cases, the database generation commands are saved in a script file.
You must always provide the following information about the script file:
Parameter Description
Directory Destination directory for the script file
File name Destination filename for the script file
One file only When selected creates one script file, instead of a separate script
file for each table
Generation Database generation by script or using ODBC
type
260
Chapter 7 Database Creation and Modification
Column creation
parameters Parameter Result of selection
User-defined type Generate user-defined data types
Default value Assign default value to column at creation
Check Generate check parameters and validation rules for column
Comment Generate comment indicating column label or name
View creation
parameters Parameter Result of selection
Create view Generate views
Comment Generate comment containing view label or name
Begin script Insert customized script before view creation
End script Insert customized script after view creation
Drop view Delete an existing view before creating a new view
261
Generating a database
Index creation
parameters Parameter Result of selection
Create index Generate indexes
Physical options Generate physical options for indexes
Comment Generate comment containing index label or name
Drop index Deletes an existing index before creating a new index
Primary key Generate primary key indexes
Foreign key Generate foreign key indexes
Alternate key Generate alternate key indexes
Cluster Generate cluster indexes
Other indexes Generate indexes for all key columns with a defined index
262
Chapter 7 Database Creation and Modification
Tablespace and
storage Parameter Result of selection
parameters
Create tablespace Generate tablespaces
Drop tablespace Delete an existing tablespace, before creating a new
tablespace
Create storage Generate storages
Drop storage Delete an existing storage, before creating a new storage
User-defined data
type parameters Parameter Result of selection
Create data type Generate user-defined data types
Default value Default value for data type
Check Generate check parameters and validation rules for user-define
data types
Comment Generate comment containing data type label or name
Drop data type Delete an existing data type, before creating new data type
263
Generating a database
264
Chapter 7 Database Creation and Modification
Referential integrity
There are two ways to generate referential integrity in a database:
You indicate referential integrity generation options from the Integrity page
of the reference property sheet.
You can define a filter to generate all or certain references based on their
defined referential integrity constraints, by clicking the ellipsis button next to
the Decl. Integrity option in the Database Generation dialog box, and
selecting or clearing the appropriate checkboxes.
Include Sub-
Parent object packages Displays
Model Selected All objects in model including all objects
contained in packages and sub-packages
Model Not selected All objects in model except objects
contained in packages and sub-packages
Package Selected All objects contained in package including
all objects contained in sub-packages
Package Not selected All objects in package except objects
contained in sub-packages
Listing objects for You can apply a filter to list only objects belonging to a particular owner. If
an owner you select the Owner <NONE> you display all the objects belonging to all
owners for the selected model or package.
265
Generating a database
266
Chapter 7 Database Creation and Modification
The Selection page appears. It displays objects for each object type in
the current model.
267
Generating a database
2 Type a destination directory for the script file in the Directory box.
3 Type a destination filename for the script file in the File Name box.
4 Select the Script radio button.
5 Select creation parameters for tables, columns, and views.
6 Click the Keys and Indexes tab.
The Keys and Indexes page appears. It lists creation parameters for
keys, foreign keys and indexes.
7 Select creation parameters for keys and indexes.
268
Chapter 7 Database Creation and Modification
269
Generating a database
Archiving a PDM
When you generate a database from a PDM, you can save the PDM as an
archived file. You can use the archived PDM to synchronize the generation
of a database with a modified PDM.
You archive a PDM by selecting the Automatic Archive checkbox in the
Options page of the Database Generation dialog box.
271
Modifying a database
Modifying a database
You can generate a database by synchronizing a modified PDM with one of
the following existing database schema:
♦ Archived PDM
♦ ODBC data source
♦ Generation script file
The modified PDM and the existing database schema are merged using a
database synchronization window which displays an object tree view of the
modified PDM (source model) and the existing database schema (target
model). You can choose which objects are added, deleted, or updated in the
target database relative to the modified PDM.
Data preservation You can select the following database preservation parameters:
parameters
Parameter Result of selection
Create temporary tables Enforces creation of a temporary table to store data
from a modified table. A new table is then created, and
the data inserted into the new table from the temporary
table
Drop temporary tables If temporary table exists, drop temporary table after
generation of new table
272
Chapter 7 Database Creation and Modification
273
Modifying a database
2 Type a destination directory for the script file in the Directory box.
Type a destination filename for the script file in the File Name box.
3 Select the Script radio button.
or
Select the ODBC Generation radio button.
4 Select the Using an Archive Model radio button.
5 Type the file path of the archived file
or
Click the button at the end of the box to browse to the directory
containing the archived PDM.
Select the archived PDM file, and click Open.
6 Select or clear checkboxes in the Data Preservation groupbox.
274
Chapter 7 Database Creation and Modification
275
Modifying a database
2 Type a destination directory for the script file in the Directory box.
Type a destination filename for the script file in the File Name box.
3 Select the Script radio button.
or
Select the ODBC Generation radio button.
4 Select the Using an ODBC Data Source radio button.
276
Chapter 7 Database Creation and Modification
277
Modifying a database
278
Chapter 7 Database Creation and Modification
2 Type a destination directory for the script file in the Directory box.
Type a destination filename for the script file in the File Name box.
3 Select the Script radio button.
or
Select the ODBC Generation radio button.
4 Type the file path of the script file
or
279
Modifying a database
Click the button at the end of the box to browse to the directory
containing the script file.
Select the script file, and click Open.
5 Select or clear checkboxes in the Data Preservation groupbox.
6 Click the Options tab.
The Options page appears.
7 Select script options
8 Click the Selection tab.
The Selection page appears. It displays objects for each object type in
the current model.
9 Indicate selection details and select or clear object checkboxes for each
type of PDM object to generate.
$ For more information on selecting a model, owners, and PDM
objects see the section Selecting objects for generation.
10 Click OK.
The Database Synchronization window appears.
11 Select or clear checkboxes in the target model for objects that you want
to include or remove from the model.
$ For more information on comparing and merging models, see the
chapter Comparing and Merging Models in the PowerDesigner General
Features Guide.
12 Click OK.
♦ If you are generating a creation script, a at the generation end a
result box appears listing the file path of the generated script file. To
edit the script, click the file path in the result box and click the Edit
button. The script opens up in a text editor. To close the Result box,
click the Close button
♦ If you are generating a database directly, an ODBC Data Source
connection box appears. Enter connection details and click the
Connect button. A message window shows the progress of the
generation process. At the end of generation click OK to close the
box
280
C H A P T E R 8
About this chapter This chapter describes how to generate a Conceptual Data Model from a
Physical Data Model.
Contents
Topic Page
281
Generating CDM objects
282
Chapter 8 Generating a Conceptual Data Model from a Physical Data Model
283
Translating PDM to CDM data types
284
Chapter 8 Generating a Conceptual Data Model from a Physical Data Model
285
Generating a CDM from a PDM
Generate Description
New CDM Creates a new (default) CDM containing the objects translated
from the PDM
Updated CDM Create a default CDM that is then merged with an existing
CDM. You can choose to update, delete, or add objects in the
existing CDM (target model) based on modifications made in
the default CDM (source model).
$ For more information on merging two CDM, see the chapter Comparing
and Merging Models in the PowerDesigner General Features Guide.
Generate new You must indicate the following parameters when you generate a new CDM
Conceptual Data
Model Parameter Description
Name File name for the resulting PDM
Code Reference code for the resulting PDM
Update existing You must indicate the following parameters when you update an existing
Conceptual Data PDM:
Model
286
Chapter 8 Generating a Conceptual Data Model from a Physical Data Model
Parameter Description
Select Model Target Conceptual Data Model. This is the existing CDM that the
newly generated CDM (source model) is merged with to create
an updated CDM
Preserve When selected, allows a comparison and merge of the newly
Modifications generated CDM (default CDM) with the existing CDM
Option Description
Check Model When selected verifies the model before generating the CDM,
and stops generation if an error is found
Save Generation When selected PowerDesigner keeps track of the identity of
Dependencies each generated object. This is useful when merging two CDM
which have been generated from the same PDM. Objects can
be compared and recognized as the same object, even if the
object has been modified in the target CDM
Model Notation Indicates the modeling methodology used in the generated
CDM. You can choose Entity/Relationship, Merise, or Mixed.
If you select Mixed, the two methodologies are available in the
same model
287
Generating a CDM from a PDM
Include Sub-
Parent object packages Displays
Model Selected All objects in model including all objects
contained in packages and sub-packages
Model Not selected All objects in model except objects
contained in packages and sub-packages
Package Selected All objects contained in package including
all objects contained in sub-packages
Package Not selected All objects in package except objects
contained in sub-packages
288
Chapter 8 Generating a Conceptual Data Model from a Physical Data Model
You can only generate a CDM from the active PDM diagram.
289
Generating a CDM from a PDM
7 Select the name of a PDM from the Select Location dropdown list.
290
Chapter 8 Generating a Conceptual Data Model from a Physical Data Model
8 Select table checkboxes for each entity that you want to generate.
or
Clear table checkboxes for each entity that you do not want to generate.
9 Click OK.
The Output window shows the progress of the generation process. The
new CDM diagram appears in the work area.
When you select the Preserve Modifications checkbox, the Merge Models
window appears after the new CDM has been successfully generated. You
can use the Merge window to select objects to be updated, deleted, or added
to the target model.
The target model must be open in the workspace to be merged with a source
model.
You can only generate a CDM from the active PDM diagram.
291
Generating a CDM from a PDM
Preserve modifications
If you want to preserve objects in the target CDM in order to compare
and merge the source and target models, you must select the Preserve
modifications checkbox. If you clear this checkbox, the existing CDM
is replaced with the newly generated CDM.
292
Chapter 8 Generating a Conceptual Data Model from a Physical Data Model
7 Select the name of a PDM from the Select Location dropdown list. The
default CDM is generated from this PDM.
293
Generating a CDM from a PDM
8 Select table checkboxes for each entity that you want to generate.
or
Clear table checkboxes for each entity that you do not want to generate
9 Click OK.
If you selected the Preserve Modifications checkbox, the Merge Models
window appears.
If you cleared the Preserve Modifications checkbox, the updated CDM
diagram appears in the work area.
Merging models
The Merge Models dialog box shows the newly generated CDM in
the Source Model pane, and the existing CDM in the Target Model
pane. You can select or clear object check boxes in the Source Model
pane for CDM objects that you want to be included or deleted in the
target model.
294
Chapter 8 Generating a Conceptual Data Model from a Physical Data Model
Generate Description
New PDM Create a new PDM ( default PDM).
Updated PDM Create a default PDM that is then merged with an existing
PDM. You can choose to update, delete, or add objects in the
existing PDM (target model) based on modifications made in
the default PDM (source model).
$ For more information on merging two PDM, see the chapter Comparing
and Merging Models in the PowerDesigner General Features Guide.
To generate a PDM, you must indicate to generate one of the following:
♦ Generate new Physical Data Model
♦ Update existing Physical data Model
Generate new You must indicate the following parameters when you generate a new PDM:
Physical Data
Model Parameter Description
DBMS Database Management System definition (DBMS) for the
resulting PDM
Link DBMS for the resulting PDM refers to the DBMS definition
file stored in the DBMS library
Local to the Model DBMS for the resulting PDM is a copy of the DBMS
definition file stored in the DBMS library
Name File name for the resulting PDM
Code Reference code for the resulting PDM
295
Generating and updating a PDM
Update existing You must indicate the following parameters when you update an existing
Physical Data PDM:
Model
Parameter Description
Select Model Target Physical Data Model. This is the existing PDM
that the newly generated PDM (source model) is
merged with to create an updated PDM
DBMS Current Database Management System definition
(DBMS) for the existing PDM
Preserve Modifications When selected, allows a comparison and merge of the
newly created PDM (default PDM) with the existing
PDM
Option Description
Check Model When selected verifies the model before generating the PDM,
and stops generation if an error is found
Save Generation When selected PowerDesigner keeps track of the identity of
Dependencies each generated object. This is useful when merging two PDM
which have been generated from the same model. Objects can
be compared and recognized as the same object, even if the
object has been modified in the target PDM
296
Chapter 8 Generating a Conceptual Data Model from a Physical Data Model
Table parameters The following parameter defines the naming convention for tables:
Parameter Description
Table Prefix Prefix for the names of generated tables
Index parameters The following parameters define naming conventions for indexes:
Parameter Description
PK index Naming convention for primary keys, by default %TABLE%_PK
names
Key index Naming convention for alternate keys, by default %TABLE%_AK
names
FK index Naming convention for foreign keys, by default %REFR%_FK
names
FK threshold Minimum number of estimated occurrences of an object necessary
to create an index on a foreign key
If you enter a value for the index threshold, indexes on foreign keys are only
generated if the number of estimated occurrences is greater than the
threshold. The estimated number of occurrences is a property that you can
include in the entity or class definition.
If an object has no specified number of occurrences, the foreign key indexes
are generated by default.
297
Generating and updating a PDM
PK and key index You can use the following variables in the PK index names and Key Index
name variables Names fields:
Variable Value
%TABLE% Generated code of the table. This is the table code that is
generated in the database. It may or may not be truncated if
the code contains characters not supported by the DBMS
%TNAME% Table name
%TCODE% Table code
%TLABL% Table comment
FK index name You can use the following variables in the FK index name field. The
variables generated code of a variable is the code defined in the object property sheet,
but which may or may not be truncated when generated if the code contains
characters not supported by the DBMS
Variable Value
%REFR% Generated code of the reference
%PARENT% Generated code of the parent table
%PNAME% Parent table name
%PCODE% Parent table code
%CHILD% Generated code of the reference
%CNAME% Child table name
%CCODE% Child table code
%PQUALIFIER% Parent table qualifier
%CQUALIFIER% Child table qualifier
%REFRNAME% Reference name
%REFRCODE% Reference code
298
C H A P T E R 9
About this chapter This chapter describes how you can generate an Object-Oriented Model
(OOM) from a Physical Data Model (PDM).
Contents
Topic Page
299
Generating OOM Objects
300
Chapter 9 Generating an Object-Oriented Model from a Physical Data Model
Translation
Physical Code in example with
data type PDM What it stores Java
Char A Character strings char
Numeric(1) BL Two opposing values boolean
(true/false; yes/no; 1/0)
Smallint BT 256 values byte
Integer SI 16-bit integer short
Integer LI 32 bit integer integer
Integer I 32 bit integer long
Float F 32 floating decimal numbers float
Numeric N Numbers with a fixed double
decimal point
Long varchar TXT Character strings String
301
Generating an OOM from a PDM
Generate Description
New OOM Creates a new (default) OOM containing the objects translated
from the PDM
Updated OOM Create a default OOM that is then merged with an existing
OOM. You can choose to update, delete, or add objects in the
existing OOM (target model) based on modifications made in
the default OOM (source model).
Generate new You must indicate the following parameters when you generate a new OOM:
Object-Oriented
Model Parameter Description
Object Language Target object language
Link Object language for the resulting OOM refers to the Object
language definition file stored in the Object language library
Local to the Model Object language for the resulting OOM is a copy of the
Object language definition file stored in the Object language
library
Name File name for the resulting OOM
Code Reference code for the resulting OOM
302
Chapter 9 Generating an Object-Oriented Model from a Physical Data Model
Update existing You must indicate the following parameters when you update an existing
Object-Oriented OOM:
Model
Parameter Description
Select Model Target Object-Oriented Model. This is the existing
OOM that the newly generated OOM (source model) is
merged with to create an updated OOM
Object Language Current object language definition for the OOM
Preserve Modifications When selected, allows a comparison and merge of the
newly generated OOM (default OOM) with the
existing OOM
Option Description
Check Model When selected verifies the model before generating the OOM,
and stops generation if an error is found
Save Generation When selected PowerDesigner keeps track of the identity of
Dependencies each generated object. This is useful when merging two OOM
which have been generated from the same PDM. Objects can
be compared and recognized as the same object, even if the
object has been modified in the target OOM
Class Prefix Prefix for a class. It can help identify a class in a model
303
Generating an OOM from a PDM
Include Sub-
Parent object packages Displays
Model Selected All objects in model including all objects
contained in packages and sub-packages
Model Not selected All objects in model except objects
contained in packages and sub-packages
Package Selected All objects contained in package including
all objects contained in sub-packages
Package Not selected All objects in package except objects
contained in sub-packages
304
Chapter 9 Generating an Object-Oriented Model from a Physical Data Model
You can only generate a OOM from the active PDM diagram.
305
Generating an OOM from a PDM
7 Select the name of an OOM from the Select Location dropdown list.
306
Chapter 9 Generating an Object-Oriented Model from a Physical Data Model
8 Select table checkboxes for each class that you want to generate.
or
Clear table checkboxes for each class that you do not want to generate.
9 Click OK.
The Output window shows the progress of the generation process. The
new OOM diagram appears in the work area.
When you select the Preserve Modifications checkbox, the Merge Models
window appears after the new OOM has been successfully generated. You
can use the Merge window to select objects to be updated, deleted, or added
to the target model.
The target model must be open in the workspace to be merged with a source
model.
You can only generate an OOM from the active PDM diagram.
307
Generating an OOM from a PDM
The OOM Generation Options dialog box appears. If you do not have a
OOM in the current Workspace, the Update existing Object-Oriented
Model option is not available.
Preserve modifications
If you want to preserve objects in the target OOM in order to compare
and merge the source and target models, you must select the Preserve
modifications checkbox. If you clear this checkbox, the existing
OOM is replaced with the newly generated OOM.
308
Chapter 9 Generating an Object-Oriented Model from a Physical Data Model
7 Select the name of a PDM from the Select Location dropdown list. The
default OOM is generated from this PDM.
309
Generating an OOM from a PDM
8 Select table checkboxes for each class that you want to generate.
or
Clear table checkboxes for each class that you do not want to generate
9 Click OK.
If you selected the Preserve Modifications checkbox, the Merge Models
window appears.
If you cleared the Preserve Modifications checkbox, the updated OOM
diagram appears in the work area.
Merging models
The Merge Models dialog box shows the newly generated OOM in
the Source Model pane, and the existing OOM in the Target Model
pane. You can select or clear object check boxes in the Source Model
pane for OOM objects that you want to be included or deleted in the
target model.
310
C H A P T E R 1 0
About this chapter This chapter describes using the DBMS definition editor to edit a DBMS
definition. It also includes information on using variables in constraint name
templates and data type translations.
Contents
Topic Page
311
Using the DBMS Definition Editor
DBMS Overview
The DBMS is a required component of PowerDesigner when working with
Physical Data Models (PDM). It ensures that differences between actual
DBMS are handled correctly. Each actual DBMS supported by
PowerDesigner has its own DBMS definition file.
All DBMS have the same structure. Each DBMS is made up of a number of
categories. A category can contain sub-categories, fields, and field values.
These fields are parameters recognizable by PowerDesigner.
The values for DBMS fields vary for each current DBMS. Some fields may
not be available for a DBMS if that function does not apply to the specific
current DBMS.
312
chapter 10 DBMS Definition Editor
DBMS categories
Each DBMS contains two principle categories:
Category Description
General Database and target database identification
Script Database characteristics, command definition, and data type
translations
Sub-category Description
SQL Contains sub-categories Syntax, Format, File, and Keywords.
Each sub-category contains field values which define database
characteristics
Objects Contains subcategories for each object in the database, for
example TABL (table), or REFR (reference).
Each sub-category contains field values which define database
commands and characteristics
Data Type Contains data type translation fields. These fields list the
correspondence between PowerDesigner internal data types
and the target DBMS data types
$ For a list of all the variables used in PowerDesigner, see the appendix
Variables in PowerDesigner.
313
Using the DBMS Definition Editor
DBMS field data PowerDesigner uses the following symbols to represent DBMS field data
types types:
Boolean
Numeric
Long text
v To view a DBMS:
1 Select Tools➤Resources➤DBMS.
A list of DBMS appears.
2 Select a DBMS.
3 Click the Properties tool.
314
chapter 10 DBMS Definition Editor
The DBMS property sheet appears. The General page contains a tree
view of all of the objects listed in the DBMS, and a DBMS definition
editor to the right of the tree view.
315
Using the DBMS Definition Editor
316
chapter 10 DBMS Definition Editor
317
Using the DBMS Definition Editor
Saving a DBMS
You save a DBMS from the List of DBMS.
v To save a DBMS:
♦ Select a DBMS in the List of DBMS.
♦ Click the Save tool.
318
chapter 10 DBMS Definition Editor
Modifying a DBMS
Modifications that you make to a DBMS definition are applied differently
depending on whether the DBMS definition is a DBMS Link ,or Local to the
Model:
DBMS Description
Link Current DBMS for the PDM refers to the DBMS definition
file stored in the DBMS library. Any modifications made to
the DBMS are available to the linked PDM
Local to the model Current DBMS for the PDM is a copy of the DBMS
definition file stored in the DBMS library. The current
DBMS is independent of the original DBMS definition file
so any modifications made in the DBMS definition file in
the DBMS library are not available to the PDM. The
DBMS is saved with the PDM and can not be used
externally of it
When you modify a DBMS Link, you should always modify a copy of the
DBMS shipped with PowerDesigner.
319
Using the DBMS Definition Editor
DBMS edit menu When you right click a category or a field in the DBMS tree view, the
following editing options appear:
$ For a list of all the variables used in PowerDesigner, see the appendix
Variables in PowerDesigner.
v To modify a DBMS:
1 Select Tools➤Resources➤DBMS.
A list of DBMS appears.
2 Select a DBMS.
320
chapter 10 DBMS Definition Editor
321
Using the DBMS Definition Editor
The next time you open any PDM that uses the customized DBMS, the
PDM will take modifications into account. However, if you have
previously modified the same options directly in the PDM, the values in
the DBMS do not change these options.
You access the Trigger templates or Template items pages by clicking on the
corresponding tab.
Templates for stored procedures are defined under the Procedures node in the
DBMS tree view.
$ For information on using, creating, and editing trigger templates and
trigger template items, see the chapter Triggers and Procedures.
Category Description
TABLE Constraint name template for table checks
COLUMN Constraint name template for column checks
PKEY Constraint name template for primary keys
KEY Constraint name template for alternate keys
REFERENCE Constraint name template for foreign keys
322
chapter 10 DBMS Definition Editor
$ For a list of all the variables used in PowerDesigner, see the appendix
Variables in PowerDesigner.
Common naming The ConstName field for all objects can accept the following common
variables for variables:
ConstName
Variable Description
%@OBJTNAME% Object name
%@OBJTCODE% Object code
%@OBJTLABL% Comment for the object
%@OBJTDESC% Description for the object
TABLE The ConstName field for the object TABLE can accept the following
ConstName variables:
Variable Value
%TABLE% Generated code of the table
%TNAME% Table name
%TCODE% Table code
%TLABL% Table comment
323
Using the DBMS Definition Editor
COLUMN The ConstName field for the object COLUMN can accept the following
ConstName variables:
Variable Value
%COLUMN% Generated column code
%COLNAME% Column name
%COLNCODE% Column code
PKEY ConstName The ConstName field for the object PKEY can accept the following variable:
Variable Value
%CONSTNAME% Constraint name
KEY ConstName The ConstName field for the object KEY can accept the following variables:
Variable Value
%AKEY% Code of the alternate key
%TABLE% Code of the table
324
chapter 10 DBMS Definition Editor
REFERENCE The ConstName field for the object REFERENCE can accept the following
ConstName variables:
Variable Value
%REFR% Generated code of the reference
%PARENT% Generated code of the parent table
%PNAME% Parent table name
%PCODE% Parent table code
%CHILD% Generated code of the reference
%CNAME% Child table name
%CCODE% Child table code
%PQUALIFIER% Parent table qualifier
%CQUALIFIER% Child table qualifier
%REFRNAME% Reference name
%REFRCODE% Reference code
%PKCONSTRAINT% Parent key constraint name used to reference the object
%POWNER% Parent table owner
%COWNER% Child table owner
%CHCKONCMMT% TRUE when check on commit is selected on the
reference (ASA 6.0 specific)
Example The following example shows the use of constraint name templates for
Sybase Adaptive Server Anywhere 6.
The DBMS Adaptive Server Anywhere 6 contains the following values for
the field ConstName:
325
Using the DBMS Definition Editor
The resulting script that you could generate for a table using Adaptive Server
Anywhere 6 declares constraint names as follows:
create table DISCOUNT
(
DISCOUNT_ID T_IDENTIFIER not null,
STOR_ID T_AN_IDENTIFIER not null,
DISC_PERCENT T_PERCENT not null,
DISC_TYPE T_SHORT_TEXT null
constraint CKC_DISC_TYPE_DISCOUNT check
(DISC_TYPE in (’High’,’Medium’,’Low’)),
DISC_LOWQTY T_QUANTITY null ,
DISC_HIGHQTY T_QUANTITY null ,
constraint PK_DISCOUNT primary key (DISCOUNT_ID)
)
go
Format
code Description Example Result
.L Lower-case PK_%.L:TABLE% PK_customer priority
characters
326
chapter 10 DBMS Definition Editor
Format
code Description Example Result
.T Removes blank PK_%.T:TABLE%
spaces
.U Upper-case PK_%.U:TABLE% PK_CUSTOMER
characters PRIORITY
.n Maximum length PK_%.8:TABLE% PK_Customer
where n is the
number of
characters
n Left justify variable PK_%8J:TABLE%
text to fixed length
where n is the
number of
characters
-n Right justify PK_%-8J:TABLE%
variable text to fixed
length where n is
the number of
characters
327
Using the DBMS Definition Editor
You can transfer length and precision between conceptual data types and
physical data types.
The following symbols indicate length and precision:
Symbol Description
%n Length
%s Length for values that take a decimal point
%p Decimal precision
$ For more information on standard data types and their translation, see
the chapter Generating a Physical Data Model from a Conceptual Data
Model.
$ For a list of all the variables used in PowerDesigner, see the appendix
Variables in PowerDesigner.
328
chapter 10 DBMS Definition Editor
329
Using the DBMS Definition Editor
The resulting script contains the string CURRENT DATE without quotation
marks.
create table SALE
(
SALE_ID T_IDENTIFIER not null,
STOR_ID T_AN_IDENTIFIER not null,
TITLE_ISBN char(12) not null,
SALE_DATE T_DATE not null
default CURRENT DATE,
SALE_AMOUNT T_AMOUNT ,
SALE_TERMS T_LONG_TEXT ,
SALE_QTY T_QUANTITY ,
primary key (SALE_ID)
);
When you run this script, Sybase Adaptive Server Anywhere will recognize
CURRENT DATE as a reserved default value.
330
chapter 10 DBMS Definition Editor
331
Using the DBMS Definition Editor
Composite physical You can combine several physical options in a Create statement by using the
options syntax for a composite physical option. A composite physical option is a
physical option whose definition includes other physical options.
$ For more information on composite physical options, see the section
Composite physical option syntax.
$ For more detailed information on defining physical options and on
using the DBMS in general, see the DBMS Reference Guide. This document
is available for download from the Sybase website. You can contact
PowerDesigner customer support for the URL address.
332
chapter 10 DBMS Definition Editor
}
on %s : category=storage
WITH physical The With physical option includes the other options, separated by a comma.
option
You can use the following keywords to define a composite physical option:
Example The above syntax is defined as follows in the Oracle 7 DBMS definition file:
initrans %d : default=1
maxtrans %d
tablespace %s : category = tablespace
storage : category=storage, composite=yes, separator=no,
parenthesis=yes
{
initial %s : default=10K
next %s : default=10K
minextents %d : default=1
maxextents %s
maxextents unlimited
pctincrease %d : default=50
freelists %d : default=1
freelist groups %d : default=1
optimal %d
optimal NULL
}
pctfree %d : default=10
333
Using the DBMS Definition Editor
nosort
<recoverable> %s : list=recoverable | unrecoverable
noparallel
parallel : composite=yes, separator=no, parenthesis=yes
{
degree %s : default=DEFAULT
instances %s : default=DEFAULT
}
Combining The keywords Default= and/or List= can also be used with the composite=,
keywords separator= and parenthesis= keywords.
The keyword Category= can be used with the three keywords of a complex
option.
For example, the DB2 index options contain the following composite option:
<using_block> : composite=yes
{
using vcat %s
using stogroup %s : category=storage, composite=yes
{
priqty %d : default=12
secqty %d
erase %s : default=no, list=yes | no
}
Variable Description
%d Numeric value follows the physical option. You must enter a
numeric value in the edit field
%s String follows the physical option. You must enter a string in the edit
field
334
chapter 10 DBMS Definition Editor
The Options page for a table property sheet is shown below. When the
options pctthreshold is selected, the Value box appears next to the Equals
button.
Example In the Sybase Adaptive Server Enterprise 11 DBMS definition file the
max_rows_per_page is an index physical option. This option limits the
number of rows per data page. The Sybase syntax is the following:
with max_row_per_page = x
where x is the number of rows specified by the user.
This option is defined for the index object as follows:
with : composite=yes, separator=yes, parenthesis=no
{
max_rows_per_page=%d : default=0
fillfactor=%d : default=0
ignore_dup_key
sorted_data
<duprow> : list=ignore_dup_row | allow_dup_row
}
on %s : category=storage
The %d and %s variables are not currently checked by PowerDesigner.
Therefore it is possible to use %s for a numeric value.
The %d and %s variables must be at the last position and they must not be
followed by other options.
For example, the following syntax is wrong:
on %s with override
335
Using the DBMS Definition Editor
336
chapter 10 DBMS Definition Editor
For example, if ignore_dup_row is the default value for an index, the syntax
used in the DBMS definition file to define this value is the following:
IndexOption =
<duprow> %s: default= ignore_dup_row, list=ignore_dup_row | allow_dup_row
The values defined in Default= and List= cannot be used with the %d or %s
variable. For example, the following syntax is not correct:
with %s: list= default fill factor percent %s | max_row_per_page %s
337
Using the DBMS Definition Editor
Database If the Option parameter for the Database object is empty, the Physical
Options checkbox on the Database page of Generate Database dialog box is
grayed.
Pkey and key If the Option parameter for the objects Pkey and Key are empty, there is no
corresponding Options tab in object property sheet.
338
A P P E N D I X
Variables in PowerDesigner
About this chapter This chapter presents the variables that are available in PowerDesigner.
These variables can be used for database generation, trigger and procedure
generation, and reverse engineering.
Contents
Topic Page
339
List of PowerDesigner variables
Common variables The following variables can be used for all named object definitions:
for all named
objects Variable name Comment
@OBJTNAME Object name
@OBJTCODE Object code
@OBJTLABL Object comment
@OBJTDESC Object desciption
Common variables The following variables can be used in all object definitions:
for objects
Variable name Comment
COMMENT Object comment. If no comment is defined the object name is
used
OWNER Generated code of the object owner, or the object parent
DBPREFIX Database prefix of object (name of database + ’.’ if database
defined)
QUALIFIER Whole object qualifier (database prefix + owner prefix)
OPTIONS SQL text defining physical options for object
CONSTNAME Object constraint name
CONSTRAINT Object constraint SQL body. For example(A <= 0) AND (A
>= 10)
RULES Concatenation of server expression for business rule
associated with object
340
Appendix Variables in PowerDesigner
Variables for The following variables can be used in domain check parameter and column
domain and check parameter definitions:
column checks
Variable name Comment
UNIT Standard check unit attribute
FORMAT Standard check format attribute
DATATYPE Data type. For example int, char(10) or numeric(8, 2)
DTTPCODE Data type code. For example int, char or numeric
LENGTH Data type length. For example 0, 10 or 8
PREC Data type precision. For example 0, 0 or 2
ISRDONLY TRUE if the read-only attribute of standard check is selected
DEFAULT Default value
MINVAL Minimum value
MAXVAL Maximum value
VALUES List of values. For example(0, 1, 2, 3, 4, 5)
LISTVAL SQL constraint associated with a list of values. For example
C1 in (0, 1, 2, 3, 4, 5)
MINMAX SQL constraint associated with minimum and maximum
values. For example(C1 <= 0) AND (C1 >= 5)
ISMAND TRUE if the domain or column is mandatory
MAND Contains the keywords "null" or "not null" depending on if
the attribute is mandatory or not mandatory
NULL Contains keyword "null" if the domain or column is not
mandatory
341
List of PowerDesigner variables
342
Appendix Variables in PowerDesigner
Abstract data type The following variables can be used in an aabstract data type definition:
variables
Variable name Comment
ADT Generated code of the abstract data type
TYPE Type of Abstract data type. For example "array", or "list"
SIZE Abstract data type size
ISARRAY TRUE if the abstract data type is of type array
ISLIST TRUE if the abstract data type is of type list
ISSTRUCT TRUE if the abstract data type is of type structure
ISOBJECT TRUE if the abstract data type is of type object
ISJAVA TRUE if the abstract data type is of type JAVA class
ADTDEF Contains definition of the abstract data type
Abstract data type The following variable can be used in an abstract data type attribute
attribute variables definition:
Business rule The following variables can be used in a business rule definition:
variables
Variable name Comment
RULE Generated code of a business rule
RULENAME Rule name
RULECODE Rule code
RULECEXPR Rule client expression
RULESEXPR Rule server expression
343
List of PowerDesigner variables
Index column The following variables can be used in index column definitions:
variables
Variable name Comment
ASC Contains keywords "ASC" or "DESC" depending on the sort
order
ISASC TRUE if the index column sort is ascending
344
Appendix Variables in PowerDesigner
Reference column The following variables can be used in reference column definitions:
variables
Variable name Comment
CKEYCOLUMN Generated code of the parent table column (primary key)
FKEYCOLUMN Generated code of a child table column (foreign key)
PK Generated code of a primary key column
PKNAME Primary key column name
FK Generated code of a foreign key column
FKNAME Foreign key column name
345
List of PowerDesigner variables
Variables for views The following variables can be used in a view definition:
346
Appendix Variables in PowerDesigner
Trigger variables The variables listed below can be used in a trigger definition. You can also
use parent table variables in a trigger definition.
Database, trigger, The following variables can be used for database, procedure, and trigger
and procedure generation:
generation
variables Variable name Comment
DATE Generation date & time
USER Login name of the user executing the generation
PATHSCRIPT Path where the file script will be generated
NAMESCRIPT Name of the file script where SQL orders will be written
STARTCMD Description explaining how to execute a generated script
347
List of PowerDesigner variables
Reverse The following variables can be used when reverse engineering a database
engineering into a PDM:
variables
Variable name Comment
R Set to TRUE during reverse engineering
S Allows to skip a word. The string is parsed for reverse
engineering but is not generated
D Allows to skip a numeric value. The numeric value is parsed
for reverse engineering but is not generated
A Allows to skip all text. The text is parsed for reverse
engineering but is not generated
ISODBCUSER True if the current user is the connected user
CATALOG Catalog name that will be used in ODBC reverse engineering
queries
SCHEMA Schema that will be used in ODBC reverse engineering
queries
SIZE Data type size of a column or a domain. Used for ODBC
reverse engineering, when a data type length is not defined in
the system tables
348
Appendix Variables in PowerDesigner
Database The following variables can be used for database generation when
synchronization synchronizing a modified PDM with an existing database:
variables
Variable name Comment
OLDOWNER Old owner name of the object. See also OWNER
NEWOWNER New owner name of the object. See also OWNER
OLDQUALIFIER Old qualifier of the object. See also QUALIFIER
NEWQUALIFIER New qualifier for the object. See also QUALIFIER
OLDTABL Old code of the table
NEWTABL New code of the table
OLDCOLN Old code of the column
NEWCOLN New code of the column
DBMS, database The following DBMS and database options variables are available:
options variables
Variable name Comment
TABLESPACE Generated code of a tablespace
STORAGE Generated code of a storage
Variables for ASE The following DBMS specific variables are available for Sybase Adaptive
& SQL Server Server Anywhere and Microsoft SQL Server:
349
List of PowerDesigner variables
350
Appendix Variables in PowerDesigner
351
List of PowerDesigner formatting variables
352
Glossary
abstract data type User defined data type which encapsulates a range of data values and
(ADT) functions. The functions are both defined on, and operate on the set of values
alternate key Column or columns whose values uniquely identify a row in the table and are
not primary key columns
business rule Written statement specifying what the information system must do or how it
must be structured to support business needs
clustered index Index in which the physical order and the logical (indexed) order is the same
column Data structure that contains an individual data item within a row (record),
model equivalent of a database field
Conceptual Data Entity-relationship diagram that models the information system without
Model (CDM) considering the details of physical implementation
constraint Named check that enforces data requirements, default values, or referential
integrity on a table or a column
data source Identification of the data to access, its operating system, DBMS, and network
platform
DBMS Text file in XML format that contains all the SQL syntax and specifications
for a Database Management System.
353
Glossary
foreign key Column or columns whose values depend on and migrate from a primary key,
or an alternate key, in another table
index Data structure that is based on a key and that speeds access to data and
controls unique values
ODBC driver Part of the Open Database Connectivity (ODBC) interface that processes
ODBC functions calls, submits SQL requests to a specific data source, and
returns results to the application
Physical Data Table-reference diagram that models the information system including the
Model (PDM) details of physical implementation
primary key Column or columns whose values uniquely identify a row in a table
reference Link between a parent table and a child table. A reference can link tables by
shared keys or by specified columns.
referential integrity Rules governing data consistency, specifically the relationships among
primary keys and foreign keys of different tables
storage Named partition that stores tables and indexes on a storage device
354
Glossary
trigger Special form of stored procedure that goes into effect when you insert, delete,
or update a specified table or column
user Name that identifies a person or group working with objects in a PDM, and
which has the ability to own other objects in the PDM
unique index Index in which no two rows can have the same index value, including NULL
view Alternate way of looking at the data in one or more tables. Usually created as
a subset of columns from one or more tables
355
Glossary
356
Index
apply
business rule 20, 132
validation rule 132
A archive
abstract data type 353 PDM 271
attribute variable 343 syncronize generation 274
categories 47 ASK
create 49, 264 column default 59
define 47 assign
drop 264 alias to column 120
link to Java class 51 alias to table 120
property 49 attach
use in PowerDesigner 48 object to user 141
variable 343 automatic
access correct 152
database 245 error correction 151
Java class 55 rebuild triggers 171
trigger property 177 trigger creation 171
Adaptive Server Anywhere automatic archive
variable 349 merge models 163
add auto-migrate 71
column 65 check parameter 71
column to key 71 column 80
template item to trigger template 187 default join 84
ADT See abstract data type domain 71
AKCOLN 218 foreign key 8
ALLCOL 218 validation rule 71
alter auto-reuse
script 273 column 80
alternate key 3, 353
column 73
constraint 74, 76
define 69 B
designate 73 begin
display 31 script 255, 258, 260, 262, 263
generate 260, 261 bend
generate index 106 reference 98
index 100, 101, 103, 262 binary
list 29 data type 41, 285
name 73 bitmap
number 32, 76 data type 41, 285
physical option 261 boolean
variable 76 data type 40, 283
357
Browser referenced table 87
create domain 36 target database 245
create table 26 character
build format 228, 264, 273
index 106 script 228, 264, 273
reference 89 check
business rule 16, 17, 353 model See check model
apply 20, 132 check model
CDM 16, 17 automatic correction 145
create 18 correct 150
definition 18 correct manually 151
domain 44 global model 146, 147
expression 21, 132 option 145, 147
fact 18 package 146
formula 18 parameters verified 144
PDM 16, 17 PDM 143, 147, 150, 151
property 17 select object 146
type 18 set error severity 145
use in PDM 20 check parameter
validation 18, 132, 260, 261, 263 additional 131
variable 343 auto-migrate 71
byte column 66, 129, 132, 261
data type 40, 283 constraint 30, 66
data type 61
define 129
domain 44, 129, 132
C generate 260, 261, 263
cardinality property 129
format 93 standard 129
maximum 92 table 30, 260
minimum 92 type 129
reference 92, 96, 97 validation 132
referential integrity 92 validation rule 16, 17, 129
category child
DBMS 313 table 75
CDM 353 child table
data type 283, 328 change 87
generate 286, 287 choose
generate from package 288 DBMS 316
generate from PDM 288 clause
generation option 287 insert 121
global model 288 clear
modify 286 index 106
select object for generation 288 client
update 286, 291 business rule 21
CDM objects expression 21, 132
translate to PDM 282 close
change database 263
foreign key column 86 PDM 6
reference end 87 cluster
358
index 100, 101 value 329
CODASYL 99 variable 132, 221, 342
code view 115, 127
display 31 COLUMN
option define 79 ConstName 324
package 12 command
preference 31 storage 250, 253
reference 79 tablespace 250, 253
unique 79 comment
variable 323 column 261
column 3, 353 package 12
add 65 script 228, 264, 273
add to key 71 table 260
alias assign 120 view 261
alternate key 73 composite
attach domain 63 physical option 332
auto-migrate 80 configure
auto-reuse 80 data source 242
check parameter 129, 132, 261 storage 250
check parameter variable 341 tablespace 250
comment 261 confirm
constraint 66 delete 8
create 60, 65, 260, 261 connect
data type 31, 61, 127, 329 data source 243
default 59 database 244, 248, 249
define 58, 60 ConstName
display 31 COLUMN 324
domain 44 common name variable 323
domain coherence 44 KEY 324
duplicate 65 PKEY 324
enforce coherence 6 REFR 325
foreign key 59, 70 TABLE 323
generate 260, 261 constraint 353
identity 31, 59 alternate key 74, 76
indicator 31 column 66
link to key 85 delete 93, 203
list 29, 67 foreign key 74, 75
mandatory 66 generate 73
migrate 85 link index 103
non-divergence from domain 44 name 30, 66, 74, 75, 76, 322
null 31 primary key 74
optional 66 table 30
primary key 59, 70 template 322
property 59 unique 73
remove from index 105 update 93, 203
reuse 85 variable 323, 324, 325
sort 67 constraint name
table 29, 31 default 75, 76
update 7 display 96
validation rule 132, 261 filter 73
359
label 96 function 215, 216
copy procedure 215, 216
DBMS 316 script 255, 258, 260, 263
correct
automatic 145, 151, 152
check model 150
error 145 D
manual 151 data source 353
PDM 150, 152 configure 242
create connect 243
abstract data type 49, 264 define 241
business rule 18 disconnect 244
column 60, 65, 260, 261 synchronize generation 276
data type 263 data type 37, 40
database 11, 255, 260, 263, 268, 269 binary 41, 285
database script 274, 276, 279 bitmap 41, 285
DBMS 316 boolean 40, 283
domain 36 byte 40, 283
empty view 113 character 41
error message 234 column 31, 61, 127, 329
function 216 conceptual 283
index 101, 260 create 263
join 84 date 41, 284
message table 234 DBMS 328
new template item 208, 210 decimal 40, 283
parameter 260, 261, 263 default 8
PDM 2, 4 define 328
procedure 216, 228 display 31
reference 82 domain 38, 39, 40, 43, 44, 329
storage 263 drop 263
table 25, 255, 260 float 40, 283
table from Browser 26 generate 263
table in diagram 25 image 41, 285
table in list 26 integer 40, 283
tablespace 263 length 37, 40
template item 205 money 40, 283
temporary table 272 number 40, 283
trigger 168, 228, 231, 233 OLE 41, 285
trigger automatically 171 OOM 301
trigger manually 175 precision 37, 40
trigger template 187, 189, 192, 193 select 38, 61
user 141 serial 40, 283
user define index 102 time 41, 284
user-defined trigger 175 translate 283, 328
user-defined trigger template 193, 194 undefined 38, 40, 41, 43, 61, 285
view 111, 260, 261 user-defined 263
Creation script view 127
syncronize generation 279 database
customize access 245
DBMS 319 change 245
360
close 263 function template 322
connect 244, 248, 249 general 313
create 11, 255, 260, 263, 268, 269 import 316, 318
create script 255, 263 keyword 329
create trigger 233 library 4
creation script 166 link 4
define 10 list 316
display 244, 248, 249 local to the model 4
drop 263 modify 319
generate 255, 260, 263, 268, 269, 273 new 316
generate PDM 161, 162 option 322, 331
information 244 overview 312
modify 260, 272, 273, 274, 276, 279 physical option 136, 332
open 263 procedure template 322
options variable 349 property 316
owner 140 save 318
parameter 272 script 313
physical option 263 select 316
preserve data parameters 272 template 322
preserve object 245 trigger template 183, 322
property 10 variable 322
script 268, 273 decimal
select 245 data type 40, 283
select object for generation 266 declare
syncronization variable 349 referential integrity 265
syncronize archive PDM 274 template item 213
syncronize creation script 279 DEF
syncronize ODBC data source 276 import from PowerDesigner 6 318
target 245 default
user 140 column 59
variable 347 constraint name 75, 76
Datacom physical option 136, 336
column default 59 define
date abstract data type 47
data type 41, 284 alternate key 69
DB2 check parameter 129
column default 59 code option 79
DBMS 353 column 58, 60
categories 313 constraint name 322
choose 316 data source 241
copy 316 data type 328
create 316 database 10
create from list 316 DBMS 312
customize 319 default physical option 336
data type 328 domain 35, 36
define 312, 316 foreign key 69
definition editor 312 function 215
edit 312 index 100
field 313 join 84, 85
format 322 key 69
361
keyword 329 primary key 31
list of physical option values 336 query 125
option 331 reference 96, 97, 98, 99
PDM 4 referential integrity 96
PDM options 6 SQL 125
physical option 135, 332 table 31
primary key 69 view 127
procedure 215, 216 warning message 149
reference 77, 82 diverge
referential integrity 94 from domain 6
storage 251 domain 354
table 24 access list 36
tablespace 251 attach column 63
template 322 auto-migrate 71
template item 168, 200 business rule 44
trigger 168 check parameter 44, 129, 132
trigger template 168 check parameter variable 341
validation rule 134 coherence 44
view 110 column 44
view query 115 create 36
DEFINE 219 create from Browser 36
DEFINEIF 220 data type 37, 38, 39, 40, 43, 44, 329
definition define 35, 36
business rule 18 diverge from 6
delete enforce 8, 44
confirm 8 enforce coherence 6
constraint 93, 203 length 37, 40
index 109 mandatory 44
reference 89 modify 43
trigger template 185 non-divergence 44
detach precision 37, 40
PDM from workspace 6 property 35
diagram use 44
create table 25 validation rule 132
insert table symbol 25 value 329
disconnect variable 132, 343
data source 244 drag
display reference 98
alternate key 31 drop
code 31 abstract data type 264
column 31 data type 263
constraint name 96 database 263
data 248, 249 foreign key 262
data type 31 index 262
database information 244 join index 262
error message 149 primary key 261
index 31 storage 263
index number 31 table 260
key number 31 tablespace 263
name 31 temporary table 272
362
view 261 owner 161
duplicate qualifier 161
column 65 reverse engineer 161
FKCOLN 220
float
data type 40, 283
E FOREACH_CHILD 221
edit FOREACH_COLUMN 222
DBMS 312 FOREACH_PARENT 223
function 216 foreign key 3, 354
procedure 216 auto-migrate 8, 71
script 255, 258 change column 86
trigger 177 column 59, 70
end constraint 74, 75
script 255, 258, 260, 262, 263 define 69
enforce designate 70
domain 44 drop 262
non-divergence 44 generate 260, 262, 298
error generate index 106
check model 145 index 100, 101, 103, 262
ERROR 220 name 101, 298
error message 220 number 32, 33
display 149 referential integrity 91
parameter 229 variable 75, 225
PDM 145, 147, 150, 151 foreign key index 298
user-defined 234, 235 format
ERwin cardinalty 93
import 154 character 228, 264, 273
example DBMS 322
procedure 199 script 228, 264, 273
trigger template 199 variable 171, 187, 204, 259, 326, 351
execute formula
query 249 business rule 18
export view 127
PowerDesigner 6 156 function
expression create 216
business rule 21, 132 custom 215, 216
client 21, 132 DBMS 322
server 21, 132 define 215
function insert 216
macro insert 216
operator insert 216
F template 215
fact variable insert 216
business rule 18
field
DBMS 313
fiilter G
constraint name 73 general
filter DBMS 313
363
generate
alternate key 260, 261
H
HAVING
alternate key index 106
insert in query 123
CDM 286, 287, 288
CDM from PDM 288
check parameter 260, 261, 263
column 260, 261 I
constraint 73 identify
data type 263 template item 202
database 255, 260, 263, 268, 269, 273 trigger template 184
error message 234, 235 identity 31
foreign key 260, 262, 298 column 59
foreign key index 106 SQL Server 59
index 73, 106, 260, 261, 262 Sybase 59
join index 261, 262 image
key 261 data type 41, 285
modified database 272, 274, 276, 279 implement
new OOM 302 trigger referential integruty 173
new PDM 286, 295 import
OOM 302, 303, 307 DBMS 316, 318
OOM object 300 DEF file 318
PDM 282, 295 ERwin 154
PDM from database 161, 162 model 154
PDM from script 166 PDM 154
PDM to OOM 304 INCOLN 223
physical option 260, 262, 263 index 3, 354
preserve data parameters 272 alternate key 100, 101, 262
primary key 260, 261, 298 clear 106
primary key index 106 cluster 100, 101
procedure 227 clustered 353
reference 89 column variable 344
referential integrity 91, 260, 264, 265 create 101, 102, 103, 260
script 228, 231, 260, 263, 264, 268, 273 define 100
select object 230, 265 delete 109
storage 263 display 31
table 260 drop 262
tablespace 263 drop join 262
trigger 227, 228, 231, 233, 265 foreign key 100, 101, 262, 298
validation rule 132, 260, 261, 263 generate 73, 106, 260, 261, 262
view 260, 261 key constraint 103
generated code link to key/reference 103
variable 323, 340 linked to key 101
global model list 29, 109
CDM 288 number 32
check 147 primary key 100, 101, 262, 298
check model 146 property 100
PDM 147 rebuild 106
rebuild index 107 rebuild from global model 107
GROUP BY rebuild from package 108
insert in query 123 rebuild option 106
364
remove column 105 reference 82, 96
table 31, 101 reuse column 85
types 101 JOIN 224
unique 73, 100, 101, 355 justify
user define 102 variable 171, 187, 204, 259, 326, 351
user-defined 101
variable 344
index number 32
display 31 K
indicate key
trigger order 180 add column 71
Ingres alternate 69
column default 59 define 69
insert foreign 69
clause 121 generate 261
GROUP BY in query 123 index 101
HAVING in query 123 link column 85
ORDER BY in query 124 primary 69
procedure in template 199 variable 346
table in list 26 KEY
table symbol 25 ConstName 324
trigger template 184, 199 key number
WHERE in query 122 alternate key 32
install display 31
java class 264 foreign key 32, 33
integer keyword
data type 40, 283 DBMS 329
interface default 329
impact of physical option value 337 define 329
physical option 334
J
Java L
link class 48 label
java class constraint name 96
remove 264 referential integrity 96
Java class link
access from PDM 55 DBMS 4
link 51 Java class 48, 55
reverse engineer 55 Object-Oriented Model 51
join reference 82
change child column 86 reverse Java class 48
create 84 list
default 84 alternate key 29
define 84, 85 arrange 29
index 262 column 29, 67
index generate 261, 262 create table 26
migrate column 85 DBMS 316
primary key 84 index 29, 109
365
order 29 table 27, 28
physical option 336 template item 211
reference 88 trigger 177
sort 67, 88 trigger from table 177
standard data types 39 trigger template 195
table 25, 28, 29 view 114
variable 171, 187, 204 money
LISTVAL data type 40, 283
check parameter 131 move
local reference to table 99
DBMS 4 multiple
trigger 180
M
macro N
trigger 218 name
trigger template 218 constraint 30, 74, 75, 76
variable 171, 187, 204 convention 198
manual display 31
create trigger 175 foreign key 298
message package 12
error 234 preference 31
metadata primary key 298
variable 349 reference 96
MINMAX trigger 198
check parameter 131 trigger template 188
mode variable 323
CODASYL 99 namespace
reference 98, 99 package 12
relational 99 new
model DBMS 316
ERwin 154 NMFCOL 225
import 154 non-divergence
script 255, 263 enforce 44
trigger template 184 number
model option 6 alternate key 76
column 6 data type 40, 283
domain 6 reference 75
modify
CDM 286
database 260, 272, 273, 274, 276, 279
DBMS 319 O
DBMS template item 212 object
DBMS trigger template 196 attach to user 141
domain property 43 owner 140
foreign key column 86 PDM 3
model trigger template 197, 213 Object-Oriented Model See OOM
PDM 282, 302 link 51
reference 98 link Java class 48
366
ODBC 161, 354 check model 146
administrator 241 code 12
archive PDM 276 comment 12
driver 354 generate CDM 288
interface 240 name 12
ODBC namespace 12
syncronize generation 276 property 12
OLE rebuild index 108
data type 41, 285 table 29
OOM See Object-Oriented Model Palette
data type 301 PDM tools 14
generate 302, 303 release tool 14
generate from PDM 304 select tool 14
generate object 300 parameter
generate option 302 create procedure 228
generate options 303 create trigger 228
generate update 307 error 229
generation options 302 generate CDM 286
modify 302 generate PDM 295
object 300 generate trigger 228
preserve 302 modify database 272
update 302 parent
open table 75
database 263 parent table
PDM 4 change 87
option PDM 354
check model 145, 147 archive 271
DBMS 322, 331 business rule 20
define 331 check 147, 151
define PDM 6 check model 143, 145, 150
physical 260, 262, 263 close 6
referential integrity 264, 265 correct 150, 152
reverse engineer 162 create 2, 4
script 228, 264, 273 data type 328
order define 4
trigger 180 detach from workspace 6
ORDER BY error 145, 147, 150, 151
insert in query 124 generate 282, 295
overview generate from database 161, 162
DBMS 312 generate from script 166
owner generation options 286, 295
define 140 graphic tools 14
table 140 import 154
using 140 modify 9, 282
view 140 object 3, 300
open 4
option 331
Palette 14
P preserve 282, 286
package property 9
367
role 2 constraint 74
save 6 define 69
update 282 designate 70
validate 143 display 31
verify 144 drop 261
warning 145, 147, 150, 151 generate 260, 261, 298
PDM objects generate index 106
translate to OOM 300 index 100, 101, 103, 262
physical option join 84
alternate key 261 name 101, 298
combine keywords 334 physical option 261
composite 332 referential integrity 91
DBMS 332 variable 74, 225
default 136 primary key index 298
default value 336 procedure
define 135, 332 create 216, 228
impact on interface 337 custom 215, 216
list of values 336 DBMS 322
primary key 261 define 215, 216
specify value 334 example 199
storage 136, 337 function insert 216
tablespace 136, 337 generate 227, 228
WITH 333 macro insert 216
PKCOLN 225 operator insert 216
PKEY parameter 228
ConstName 324 stored 215, 216
PowerDesigner 6 template 215, 322
export 156 trigger template 199
save as 156 user-defined 216
precision 37, 40 variable 347, 350
preference variable insert 216
code 31 property
name 31 abstract data type 49
reference 96, 98, 99 business rule 17
table 31 check parameter 129
view 127 column 59
preserve domain 35
CDM 286 index 100
data parameters 272 package 12
database object 245 reference 78
modification 282, 286, 302 referential integrity 92
OOM 302 table 24, 27
PDM 282 template item 204
preview trigger 170
SQL 13 trigger template 186
storage command 253 view 110, 114
tablespace command 253 property sheet 354
trigger 182 PDM 9
primary key 3, 354
column 59, 70
368
preference 96, 98, 99
Q property 78
query
rebuild 89
display 125
relational 99
execute 249
reuse column 80
SQL 249
select for view 118
syntax 125
sort 88
quotation mark
straighten 98
generate 134
text 96
unique code 8, 79
variable 75, 344
R view 115
rebuild referential integrity 91, 354
index 106 cardinality 92
reference 89 declarative 265
rebuild triggers define 94
create trigger automatically 171 delete 93
delete and rebuild 171 display 96
delete trigger 171 generate 91, 92, 260, 264, 265
insert trigger 171 implement by trigger 173
select trigger template 171 label 96
template item 171, 186 option 264, 265
trigger referential integrity 173 property 92
trigger template 171, 186 trigger 173, 265
update trigger 171 update 93
user-defined trigger 171 REFR
reference 3, 354 ConstName 325
auto-migration 80 relational mode 99
bend 98 remove
cardinality 92, 96, 97 column from index 105
change table 87 java class 264
child table 92 retrieve
CODASYL 99 WarehouseArchitect object 153
code 79 reverse
column variable 345 link Java class 48
create 82 reverse engineer
define 77, 82 automatic archive 163
delete 89 data source 160
display 96, 97, 98, 99 filter 161
drag 98 generate PDM from database 161, 162
generate 89 generate PDM from script 166
join 82, 96 Java class 55
link 82 merge models 162
list 88 option 162
mode 98, 99 owner filter 161
modify 98 qualifier filter 161
move to table 99 script file 160
name 96 variable 348
number 75 RULES
number of children 92 check parameter 131
369
reference 88
S specify
save
physical option value 334
as PowerDesigner 6 156
SQL
DBMS 318
clause 121
PDM 6
display 125
script
GROUP BY 123
alter 273
HAVING 123
begin 255, 258, 260, 262, 263
insert 121
comment 228, 264, 273
ORDER BY 124
create database 255, 268
preview 13
create table 255
query 125, 249
create trigger 231
syntax 125
customize 255, 258, 260, 263
view expression 122
database create 255, 263
WHERE 122
database creation 166
SQL Server
DBMS 313
identity 59
edit 255, 258
variable 349
end 255, 258, 260, 262, 263
SQLBase
format 228, 264, 273
column default 59
generate 228, 231, 260, 263, 264, 268, 273
standard data type
generate PDM 166
list 40
model 255, 263
standard data types
modify creation 274, 276, 279
list 39
modify database 273
storage 354
option 228, 264, 273
command 250, 253
preview 13
configure 250
table 258, 260
create 263
text color code 13
define 136, 251
title 228, 264, 273
drop 263
variable 255, 258
generate 263
select
physical option 337
column for view 115
preview 253
data type 38, 61
select 136
data type for domain 38, 39
straighten
DBMS 316
reference 98
generate objects 266
Sybase
object for check model 146
identity 59
object to generate 230, 265, 266
System 10 59
reference for view 115, 118
System 11 59
table for view 115
Sybase SQL Anywhere
target database 245
data type 283
serial
symbol
data type 40, 283
insert table 25
server
table 25
business rule 21
syncronize
expression 21, 132
archive PDM 274
sort
creation script file 279
column 67
database generation 272
list 67, 88
syntax
370
object compatibility 245 command 250, 253
physical option 332 configure 250
query 125 create 263
variable 171, 187, 204, 259, 326, 351 define 136, 251
drop 263
generate 263
physical option 337
T preview 253
table 3, 354 select 136
alias assign 120 template
alternate key 29, 73 constraint name 322
check parameter 260 DBMS 322
child 75 define 322
column 29, 31 template item 200
comment 260 add to trigger 178, 196
constraint 30 add to trigger template 187
create 25, 255, 260 create 205
create from Browser 26 create from existing template item 205, 208
create trigger 175 create new 208, 210
define 24 declare in trigger 213
delete index 109 define 168, 200
display 31 function 215
drop 260 identify 202
foreign key 70, 71 insert in trigger 201
generate 260 insert in trigger template 201
index 29, 31, 101 modify 211
insert in list 26 modify DBMS 212
list 25, 28, 29 procedure 215
message 234 property 204
modify 27, 28 rebuild triggers 186
modify trigger 177 trigger add 178, 196
owner 140 variable 204
package 29 text
parent 75 reference 96
physical option 260, 262 table 31
preference 31 view 127
primary key 70 time
property 24, 27 data type 41, 284
script 258, 260 title
select for view 115 script 228, 264, 273
symbol 25 tool
temporary create 272 release 14
temporary drop 272 select 14
text 31 translate
validation rule 260 data type 283, 328
variable 74, 75, 76, 341 PDM to OOM 301
view 115, 127 trigger 355
TABLE access property 177
ConstName 323 add template item 178, 196
tablespace 354 create 168, 228, 231, 233
371
create automatically 168, 171 macro 218
create manually 168, 175 model 184
create overview 169 modify 195
declare template item 213 modify DBMS 196
define 168 modify model 197, 213
edit 177 name 188, 198
function insert 177, 178, 195, 211 procedure 199
generate 227, 228, 231, 233, 265 property 186
insert template item 201 rebuild triggers 186
macro 218 template item 186
macro insert 177, 178, 195, 211 type 184
modify 177 update 185
modify from table 177 user-defined 184
multiple 180 variable 171, 187, 204
name convention 198
operator insert 177, 178, 195, 211
order 180
overview 168 U
overview in PowerDesigner 168 undefined
parameter 228 data type 38, 40, 43, 61
preview 182 unique
property 170 constraint 73
rebuild See rebuild triggers index 73, 100, 101
referential integrity 265 reference 8
same type 180 update
script 231 CDM 286, 291
template See trigger template column 7, 44
template item See template item constraint 93, 203
template item add 178, 196 OOM 302, 307
user-defined 175 PDM 282
variable 347 trigger template 185
variable insert 177, 178, 195, 211 user 355
trigger template 183 attach object 141
add template item 187 create 141
available to other models 169 define 140
copy 189, 193 user-defined
create 187, 193, 194 error message 234
create DBMS 189, 192 generate 235
create from duplicate 189, 193 index 101, 102
create from scratch 192 trigger template 184
create user-defined 193, 194
DBMS 183, 187, 322
declare template item 213
define 168, 193 V
delete 185 validate
duplicate 189, 193 PDM 143
example 199 validation
identify 184 business rule 18
insert 184, 199 validation rule 129
insert template item 201 apply 132
372
auto-migrate 71 table 74, 75, 76, 341
business rule 132 template item 171, 187, 204
check parameter 132 trigger 347
column 132, 261 trigger template 171, 187, 204
define 134 view 346
domain 132 verify
generate 132, 260, 261, 263 objects in PDM 144
table 260 PDM 144
value view 3, 355
specify physical option 334 column 115, 127
variable comment 261
procedure 347 create 111, 113, 260, 261
variable data type 127
abstract data type 343 DBMS field 313
abstract data type attribute 343 define 110
Adaptive Server Anywhere 349 define query 115
all named objects 340 display 127
all objects 340 drop 261
business rule 343 formula 127
code 323, 340 generate 260, 261
column 132, 221, 342 GROUP BY 123
column check parameter 341 HAVING 123
common 340 modify 114
constraint 323, 324, 325 ORDER BY 124
constraint name 74, 75, 76 owner 140
database 347 preference 127
database options 349 property 110, 114
database syncronization 349 reference 115
DBMS 322 select reference 118
domain 132, 343 select table 111, 115
domain check parameter 341 table 115, 127
foreign key 225 text 127
format 171, 187, 204, 259, 326, 351 variable 346
generated code 323, 340 WHERE 122
index 344
index column 344
justify 171, 187, 204, 259, 326, 351
key 346 W
list 171, 187, 204, 340 WAM See WarehouseArchitect
macro 171, 187, 204 WarehouseArchitect
metadata 349 retrieve object 153
name 323 warning
primary key 225 PDM 145, 147, 150, 151
procedure 350 warning message
reference 75, 344 display 149
reference column 345 WHERE
reverse engineer 348 insert in query 122
script 255, 258 WITH
SQL Server 349 physical option 333
syntax 171, 187, 204, 259, 326, 351
373
X
Xdb
column default 59
374