.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "SQL::Translator::Schema::Trigger 3pm" .TH SQL::Translator::Schema::Trigger 3pm 2024-01-20 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME SQL::Translator::Schema::Trigger \- SQL::Translator trigger object .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 11 \& use SQL::Translator::Schema::Trigger; \& my $trigger = SQL::Translator::Schema::Trigger\->new( \& name => \*(Aqfoo\*(Aq, \& perform_action_when => \*(Aqbefore\*(Aq, # or after \& database_events => [qw/update insert/], # also update, update_on, delete \& fields => [], # if event is "update" \& on_table => \*(Aqfoo\*(Aq, # table name \& action => \*(Aq...\*(Aq, # text of trigger \& schema => $schema, # Schema object \& scope => \*(Aqrow\*(Aq, # or statement \& ); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" \&\f(CW\*(C`SQL::Translator::Schema::Trigger\*(C'\fR is the trigger object. .SH METHODS .IX Header "METHODS" .SS new .IX Subsection "new" Object constructor. .PP .Vb 1 \& my $trigger = SQL::Translator::Schema::Trigger\->new; .Ve .SS perform_action_when .IX Subsection "perform_action_when" Gets or sets whether the event happens "before" or "after" the \&\f(CW\*(C`database_event\*(C'\fR. .PP .Vb 1 \& $trigger\->perform_action_when(\*(Aqafter\*(Aq); .Ve .SS database_event .IX Subsection "database_event" Obsolete please use database_events! .SS database_events .IX Subsection "database_events" Gets or sets the events that triggers the trigger. .PP .Vb 1 \& my $ok = $trigger\->database_events(\*(Aqinsert\*(Aq); .Ve .SS fields .IX Subsection "fields" Gets and set which fields to monitor for \f(CW\*(C`database_event\*(C'\fR. .PP .Vb 5 \& $view\->fields(\*(Aqid\*(Aq); \& $view\->fields(\*(Aqid\*(Aq, \*(Aqname\*(Aq); \& $view\->fields( \*(Aqid, name\*(Aq ); \& $view\->fields( [ \*(Aqid\*(Aq, \*(Aqname\*(Aq ] ); \& $view\->fields( qw[ id name ] ); \& \& my @fields = $view\->fields; .Ve .SS table .IX Subsection "table" Gets or set the table on which the trigger works, as a SQL::Translator::Schema::Table object. \f(CW$trigger\fR\->table($triggered_table); .SS on_table .IX Subsection "on_table" Gets or set the table name on which the trigger works, as a string. \f(CW$trigger\fR\->on_table('foo'); .SS action .IX Subsection "action" Gets or set the action of the trigger. .PP .Vb 8 \& $trigger\->action( \& q[ \& BEGIN \& select ...; \& update ...; \& END \& ] \& ); .Ve .SS is_valid .IX Subsection "is_valid" Determine whether the trigger is valid or not. .PP .Vb 1 \& my $ok = $trigger\->is_valid; .Ve .SS name .IX Subsection "name" Get or set the trigger's name. .PP .Vb 1 \& my $name = $trigger\->name(\*(Aqfoo\*(Aq); .Ve .SS order .IX Subsection "order" Get or set the trigger's order. .PP .Vb 1 \& my $order = $trigger\->order(3); .Ve .SS scope .IX Subsection "scope" Get or set the trigger's scope (row or statement). .PP .Vb 1 \& my $scope = $trigger\->scope(\*(Aqstatement\*(Aq); .Ve .SS schema .IX Subsection "schema" Get or set the trigger's schema object. .PP .Vb 2 \& $trigger\->schema( $schema ); \& my $schema = $trigger\->schema; .Ve .SS compare_arrays .IX Subsection "compare_arrays" Compare two arrays. .SS equals .IX Subsection "equals" Determines if this trigger is the same as another .PP .Vb 1 \& my $is_identical = $trigger1\->equals( $trigger2 ); .Ve .SH AUTHORS .IX Header "AUTHORS" Anonymous, Ken Youens-Clark .