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_event      => 'insert', # or update, update_on, delete
14             fields              => [],       # 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
26       Object constructor.
27
28         my $schema = SQL::Translator::Schema::Trigger->new;
29
30       perform_action_when
31
32       Gets or sets whether the event happens "before" or "after" the "data‐
33       base_event".
34
35         $trigger->perform_action_when('after');
36
37       database_event
38
39       Gets or sets the event that triggers the trigger.
40
41         my $ok = $trigger->database_event('insert');
42
43       fields
44
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
57       Gets or set the table on which the trigger works, as a SQL::Transla‐
58       tor::Schema::Table object.
59         $trigger->table($triggered_table);
60
61       on_table
62
63       Gets or set the table name on which the trigger works, as a string.
64         $trigger->on_table('foo');
65
66       action
67
68       Gets or set the actions of the trigger.
69
70         $trigger->actions(
71             q[
72               BEGIN
73                 select ...;
74                 update ...;
75               END
76             ]
77         );
78
79       is_valid
80
81       Determine whether the trigger is valid or not.
82
83         my $ok = $trigger->is_valid;
84
85       name
86
87       Get or set the trigger's name.
88
89         my $name = $trigger->name('foo');
90
91       order
92
93       Get or set the trigger's order.
94
95         my $order = $trigger->order(3);
96
97       schema
98
99       Get or set the trigger's schema object.
100
101         $trigger->schema( $schema );
102         my $schema = $trigger->schema;
103
104       equals
105
106       Determines if this trigger is the same as another
107
108         my $isIdentical = $trigger1->equals( $trigger2 );
109

AUTHOR

111       Ken Y. Clark <kclark@cpan.org>.
112
113
114
115perl v5.8.8                       2007-10-24SQL::Translator::Schema::Trigger(3)
Impressum