Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page: CUBRID 8.2.1 |  CUBRID 8.3.0 |  CUBRID 8.3.1 |  CUBRID 8.4.0 |  CUBRID 8.4.1 |  CUBRID 8.4.3 |  CUBRID 9.0.0 | 

DB_TRIG

Represents information of a trigger that has the class for which the current user has access authorization to a database, or its attribute as the target.

Attribute Name

Data Type

Description

trigger_name

VARCHAR(255)

Trigger name

target_class_name

VARCHAR(255)

Target class

target_attr_name

VARCHAR(255)

Target attribute. If not specified in the trigger, NULL

target_attr_type

VARCHAR(8)

Target attribute type. If specified, 'INSTANCE' is used for an instance attribute, and 'CLASS' is used for a class attribute.

action_type

INTEGER

1 for one of INSERT, UPDATE, DELETE, and CALL, 2 for REJECT, 3 for INVALIDATE_TRANSACTION, and 4 for PRINT.

action_time

INTEGER

1 for BEFORE, 2 for AFTER, and 3 for DEFERRED.

Example

The following example shows how to display information of the trigger that has the class for which the current user has access authorization, or its attribute as the target.

CREATE VCLASS db_trig (

trigger_name, target_class_name, target_attr_name, target_attr_type, action_type, action_time)

AS

SELECT CAST(t.name AS VARCHAR(255)), c.class_name,

        CAST(t.target_attribute AS VARCHAR(255)),

        CASE WHEN t.target_class_attribute = 0 THEN 'INSTANCE' ELSE 'CLASS' END,

        t.action_type, t.action_time

FROM _db_class c, db_trigger t

WHERE t.target_class = c.class_of AND

        (CURRENT_USER = 'DBA' OR

        {c.owner.name} subseteq (

                SELECT set{CURRENT_USER} + coalesce(sum(set{t.g.name}), set{})

                from db_user u, table(groups) as t(g)

                where u.name = CURRENT_USER ) OR

        {c} subseteq (

SELECT sum(set{au.class_of})

                FROM _db_auth au

                WHERE {au.grantee.name} subseteq (

                            SELECT set{CURRENT_USER} + coalesce(sum(set{t.g.name}), set{})

                            from db_user u, table(groups) as t(g)

                            where u.name = CURRENT_USER ) AND

                                    au.auth_type = 'SELECT'));