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         );
19

DESCRIPTION

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

METHODS

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

AUTHORS

105       Anonymous, Ken Youens-Clark <kclark@cpan.org>.
106
107
108
109perl v5.12.0                      2009-08-18SQL::Translator::Schema::Trigger(3)
Impressum