1SQL::Translator::SchemaU:s:eTrriCgognetrr(i3b)uted PerlSDQoLc:u:mTernatnastliaotnor::Schema::Trigger(3)
2
3
4

NAME

6       SQL::Translator::Schema::Trigger - SQL::Translator trigger object
7

SYNOPSIS

9         use SQL::Translator::Schema::Trigger;
10         my $trigger = SQL::Translator::Schema::Trigger->new(
11           name                => 'foo',
12           perform_action_when => 'before', # or after
13           database_events     => [qw/update insert/], # also update, update_on, delete
14           fields              => [],       # if event is "update"
15           on_table            => 'foo',    # table name
16           action              => '...',    # text of trigger
17           schema              => $schema,  # Schema object
18           scope               => 'row',    # or statement
19         );
20

DESCRIPTION

22       "SQL::Translator::Schema::Trigger" is the trigger object.
23

METHODS

25   new
26       Object constructor.
27
28         my $schema = SQL::Translator::Schema::Trigger->new;
29
30   perform_action_when
31       Gets or sets whether the event happens "before" or "after" the
32       "database_event".
33
34         $trigger->perform_action_when('after');
35
36   database_event
37       Obsolete please use database_events!
38
39   database_events
40       Gets or sets the events that triggers the trigger.
41
42         my $ok = $trigger->database_events('insert');
43
44   fields
45       Gets and set which fields to monitor for "database_event".
46
47         $view->fields('id');
48         $view->fields('id', 'name');
49         $view->fields( 'id, name' );
50         $view->fields( [ 'id', 'name' ] );
51         $view->fields( qw[ id name ] );
52
53         my @fields = $view->fields;
54
55   table
56       Gets or set the table on which the trigger works, as a
57       SQL::Translator::Schema::Table object.
58         $trigger->table($triggered_table);
59
60   on_table
61       Gets or set the table name on which the trigger works, as a string.
62         $trigger->on_table('foo');
63
64   action
65       Gets or set the action of the trigger.
66
67         $trigger->action(
68             q[
69               BEGIN
70                 select ...;
71                 update ...;
72               END
73             ]
74         );
75
76   is_valid
77       Determine whether the trigger is valid or not.
78
79         my $ok = $trigger->is_valid;
80
81   name
82       Get or set the trigger's name.
83
84         my $name = $trigger->name('foo');
85
86   order
87       Get or set the trigger's order.
88
89         my $order = $trigger->order(3);
90
91   scope
92       Get or set the trigger's scope (row or statement).
93
94           my $scope = $trigger->scope('statement');
95
96   schema
97       Get or set the trigger's schema object.
98
99         $trigger->schema( $schema );
100         my $schema = $trigger->schema;
101
102   compare_arrays
103       Compare two arrays.
104
105   equals
106       Determines if this trigger is the same as another
107
108         my $is_identical = $trigger1->equals( $trigger2 );
109

AUTHORS

111       Anonymous, Ken Youens-Clark <kclark@cpan.org>.
112
113
114
115perl v5.28.0                      2015-06-25SQL::Translator::Schema::Trigger(3)
Impressum