![]() | ![]() |
Home |
|
|
WarehouseArchitect - User's Guide |
|
| Part 3 WarehouseArchitect Model |
|
| Chapter 21: Triggers and Procedures |
|
| Generating triggers and procedures |
Generation parameters indicate the following:
The availability of generation parameters depends on the target database. Unavailable parameters display in gray and are not selectable.
The tables below indicate the generation that results from the selection of generation parameters.
| Parameter
| Resulting generation command
|
|---|---|
| Triggers: All
| Apply generation parameters to all triggers, both default and user-defined
|
| Triggers: By default
| Apply generation parameters to default triggers only
|
| Triggers: User-defined
| Apply generation parameters to user-defined triggers only
|
| Tables: All tables
| Apply generation parameters to triggers and procedures for all tables
|
| Tables: Selected
| Apply generation parameters to triggers and procedures only for tables selected graphically in model
|
| Tables: List
| Apply generation parameters to triggers and procedures only for tables selected from a list of tables in model
|
| Procedures: All
| Apply generation parameters to all procedures
|
| Procedures: List
| Apply generation parameters to selected procedures only
|
| Parameter
| Resulting generation command
|
|---|---|
| Create procedure
| Create procedure
|
| Create trigger
| Create trigger
|
| For insert
| Generate insert triggers
|
| For update
| Generate update triggers
|
| For delete
| Generate delete triggers
|
| Parameter
| Resulting generation command
|
|---|---|
| Drop procedure
| Delete procedure
|
| Drop trigger
| Delete trigger
|
| Parameter
| Resulting generation command
|
|---|---|
| Open database
| Open existing database
|
| Close database
| Close existing database
|
| Parameter
| Resulting generation command
|
|---|---|
| Standard
| Generate standard error messages
|
| User-defined
| Generate user-defined error messages
|
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 target database. Unavailable options display in gray and you cannot select them.
| Option
| Result of selection
|
|---|---|
| Uppercase
| Script contains all uppercase characters
|
| Lowercase
| Script contains all lowercase characters
|
| No accent
| Non-accented characters replace accented characters in script
|
| Codes
| Script refers to objects by their codes
|
| Names
| Script refers to objects by their names
|
| Windows (ANSI)
| Script uses ANSI character set
|
| DOS (OEM)
| Script uses DOS character set
|
| Add titles
| Each section of the script includes commentary in the form of titles (for example, Database Name: TUTORIAL)
|
| Check model
| Check the WAM before generating the database or script, and stop generation if an error is found
|
| Option
| Result of selection
|
|---|---|
| Trigger
| Generates a trigger
|
| Declarative
| Generates a declarative statement in a script
|
PowerDesigner generates trigger and procedure scripts that you can run in your DBMS environment.
The Generation Parameters dialog box appears.
The Options page appears.
PowerDesigner can generate triggers directly. To do so, you must connect to a data source via an ODBC driver.
The Generation Parameters dialog box appears.
The Options page appears.
A dialog box asks you to identify a data source and connection parameters.
A message window shows the progress of the generation process.
You can create user-defined error messages. The error messages are stored in a message table which you need to create in your database. When you select trigger generation parameters, you can choose to generate an error message from this table.
In the generated trigger script, the message table is called in a SELECT command. If an error number in the script corresponds to an error number value in the table column, then the standard error message is replaced by the message defined in the table.
You create a message table which stores error message information.
| Column to store...
| Description
|
|---|---|
| Error number
| Number of the error message that is referenced in the trigger script
|
| Message text
| Text of message
|
A dialog box asks you to identify a data source and connection parameters.
An SQL query editor box appears.
For example:
insert into ERR_MSG values (1004,'The value that you are trying to insert does not exist in the referenced table')
You can choose to generate a user-defined error message from the trigger generation parameters box.
The generation parameters dialog box appears.
A dialog box appears.
You return to the generation parameters dialog box.
Click the Generate Script button.
or
Click the Create Triggers button.
|
|