24.12.2012 Views

ER/Studio - Embarcadero Technologies Product Documentation

ER/Studio - Embarcadero Technologies Product Documentation

ER/Studio - Embarcadero Technologies Product Documentation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

USING <strong>ER</strong>/STUDIO > DEVELOPING THE PHYSICAL MODEL<br />

Description tab<br />

Includes a text box where you can enter a Trigger description.<br />

Attachment Bindings tab<br />

Bind an external piece of information, or attachment to the trigger. You can also remove an attachment from an<br />

object, override an attachment binding’s default value, or change the position of a bound attachment. To override<br />

the value of the attachment you have moved to the Selected Attachments grid, double-click the Value field of the<br />

target attachment. <strong>ER</strong>/<strong>Studio</strong> opens the Value Override Editor or a list depending on the attachment datatype.<br />

Attachments are created in the Attachments folder of the Data Dictionary. For more information, see Attaching<br />

External Documents to the Data Model.<br />

Create a Templated User-Defined Trigger<br />

1 In the Data Model Explorer, expand the Physical Main Model, right-click the Triggers node, and then click New<br />

Trigger.<br />

2 Complete the Trigger Wizard and then click Finish to create the trigger.<br />

TIP: Once you have created the auxiliary table, you can edit it by right-clicking the auxiliary table you<br />

want to change, and then selecting Edit Auxiliary Table.<br />

The following describe options that require additional explanation:<br />

• The Trigger Editor includes find and replace functionality for working with SQL text strings.<br />

• In order for code to be generated for procedural logic such as triggers and procedures, the results of the<br />

trigger must be stored in a variable called resultstring. For example, in the Northwind.dm1 sample model,<br />

the Data Dictionary lists a reusable trigger, SYSUPDATE, for the the Oracle platform. The code for this trigger<br />

includes the following statement, which is required for code to be generated for the trigger:<br />

resultstring = trigBody<br />

Description page/tab<br />

Enter or edit a definition for the description. If the target database supports it, <strong>ER</strong>/<strong>Studio</strong> adds this definition as a<br />

comment when generating SQL code.<br />

Attachment Bindings tab<br />

Bind an external piece of information, or attachment to the trigger. You can also remove an attachment from an<br />

object, override an attachment binding’s default value, or change the position of a bound attachment. To override<br />

the value of the attachment you have moved to the Selected Attachments grid, double-click the Value field of the<br />

target attachment. <strong>ER</strong>/<strong>Studio</strong> opens the Value Override Editor or a list depending on the attachment datatype.<br />

Attachments are created in the Attachments folder of the Data Dictionary. For more information, see Attaching<br />

External Documents to the Data Model.<br />

Create a Reusable User-Defined Trigger<br />

Reusable user-defined triggers are created in the Data Dictionary. For more information, see Create and Edit<br />

Reusable Triggers<br />

Creating and Editing Functions<br />

Functions are subroutines that you define. Functions can be written in a programming language such as C, COBOL,<br />

or Java that returns a scalar value or a complete table, or they can call another function, or they can be written in SQL<br />

and return a scalar value. Functions are useful for reusable application logic. You can use functions to determine the<br />

best methods for controlling access and manipulation of the underlying data contained in an object. Functions accept<br />

a number of parameters and pass a single value back to the calling program. Functions can be used in the database<br />

to check the validity of the data being entered. For example, functions can be used to validate zip codes. By invoking a<br />

routine with the zip code, the function can return a true or false value based on if the zip code is valid.<br />

EMBARCAD<strong>ER</strong>O TECHNOLOGIES > <strong>ER</strong>/STUDIO® 8.0.3 US<strong>ER</strong> GUIDE 191

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!