Advantage Database Server

Creating or Modifying a Trigger

Advantage Data Architect

Creating or Modifying a Trigger

Advantage Data Architect

Previous topic Next topic  

Creating or Modifying a Trigger

Advantage Data Architect

Previous topic Next topic  

A trigger is a piece of code (similar to a stored procedure) that is executed on the server. Triggers differ from stored procedures because triggers are not called by the client, but instead are executed automatically in response to an insert, update, or delete operation.

See Triggers for topics containing detailed trigger information.

To create or modify a trigger, open a database. See Opening a Database for details. You must login to the database as a user with ALTER permissions on the associated table in order to add or modify triggers in a database.

To add a new trigger, from the tree view within the Connection Repository, right-click the table you want to add the trigger to and select Triggers. Fill in the trigger options and then click OK.

To modify a trigger, from the tree view within the Connection Repository, right-click the table that owns the trigger you want to modify and select Triggers. Select the trigger in question from the Name combo box. Make your modifications, and then click OK.

Note If a trigger container is in use, and modifications are made to a trigger definition (including trigger addition or deletion), the changes will not take effect until all users who have used a trigger in that container disconnect from the database.

Currently trigger creation and deletion will not affect tables already opened by the server. For example, if table1 is opened by active clients, and the administrator adds a new trigger to table1, the trigger will not activate until all active users have closed table1 and it has been re-opened.

Advantage Trigger Field Descriptions

Name

Name of the trigger being modified or created. If creating a new trigger the value in this field will be <new>.

Trigger Type

The type of trigger to create. The trigger type will specify when the trigger should fire. See Triggers for detailed trigger type information.

Event Type

The event that will cause the trigger to fire. See Triggers for detailed trigger event information.

Priority

The trigger’s firing priority. If multiple triggers exist for the same event this value can be used to specify what order the triggers will fire in.

Description (optional)

Text description of the trigger.

Trigger Container

Script

Enter the SQL script here. The script can contain any number of SQL statements separated by semi-colons.

Windows DLL or Linux Shared Object

Container Path and Filename

The path and filename of the trigger container.

Function Name in Container

The name of the function to call in the container.

COM Object or .NET Assembly

Program ID (ProgID)

The ProgID of the COM object or .NET assembly that contains the trigger function.

Method Name in Class

The name of the function to call in the container.

Options

Trigger options. See Triggers for detailed trigger option information.

Delete

This button can be used to delete an existing trigger.

Verify Syntax

This button can be used when entering a script trigger to verify the SQL syntax before saving the trigger.

Save

This button is used to save the current trigger.

Close

This button closed the trigger screen.