SQL::Tr...Trigger(3)
πΈ NAME πΈ
SQL::Translator::Schema::Trigger β SQL::Translator trigger object. This is SQL::Tr...Trigger(3) from the User Contributed Perl Documentation, and yes bestie, it is literally the trigger object. π
β¨ SYNOPSIS β¨
use SQL::Translator::Schema::Trigger;
my $trigger = SQL::Translator::Schema::Trigger->new(
name => 'foo',
perform_action_when => 'before', # or after
database_events => [qw/update insert/], # also update, update_on, delete
fields => [], # if event is "update"
on_table => 'foo', # table name
action => '...', # text of trigger
schema => $schema, # Schema object
scope => 'row', # or statement
);
π¦ DESCRIPTION π¦
SQL::Translator::Schema::Trigger is the trigger object. That's the whole description, and honestly? It ate. π
π METHODS π
Okay bestie, here's the method tour β every single one, no skipping. π«Ά
π new π
Object constructor. Fresh trigger, new vibe. β¨
my $trigger = SQL::Translator::Schema::Trigger->new;
π« perform_action_when π«
Gets or sets whether the event happens before or after the database_event. It's giving timing, it's giving order of operations. β°
$trigger->perform_action_when('after');
π database_event π
π¨ Obsolete, bestie β please use database_events instead!
π database_events π
Gets or sets the events that trigger the trigger. Yes, that sentence is a little unhinged, but the method is iconic. π
my $ok = $trigger->database_events('insert');
π fields π
Gets and sets which fields to monitor for database_event. Look at all these ways to pass fields β main character flexibility. π§
$view->fields('id');
$view->fields('id', 'name');
$view->fields( 'id, name' );
$view->fields( [ 'id', 'name' ] );
$view->fields( qw[ id name ] );
my @fields = $view->fields;
π table π
Gets or sets the table on which the trigger works, as a SQL::Translator::Schema::Table object. Table object realness. πͺ©
$trigger->table($triggered_table);
πΈ on_table πΈ
Gets or sets the table name on which the trigger works, as a string. Just the name, just the string, no cap. π
$trigger->on_table('foo');
π₯ action π₯
Gets or sets the action of the trigger. This is where the trigger does its little thing. π
$trigger->action(
q[
BEGIN
select ...;
update ...;
END
]
);
β is_valid β
Determines whether the trigger is valid or not. Vibe check, but for validity. β
my $ok = $trigger->is_valid;
π name π
Get or set the trigger's name. Every trigger needs a name, bestie. π
my $name = $trigger->name('foo');
π¦ order π¦
Get or set the trigger's order. It's giving sequence, it's giving lineup. π’
my $order = $trigger->order(3);
π scope π
Get or set the trigger's scope (row or statement). Pick your scope era. π
my $scope = $trigger->scope('statement');
π§ schema π§
Get or set the trigger's schema object. Schema object in, schema object out. π«Ά
$trigger->schema( $schema );
my $schema = $trigger->schema;
π― compare_arrays π―
Compare two arrays. That's it. That's the method. Simple, effective, slay. β¨
π equals π
Determines if this trigger is the same as another. Twin check, but make it schema. π―
my $is_identical = $trigger1->equals( $trigger2 );
π AUTHORS π
Anonymous, Ken Youens-Clark <kclark@cpan.org>.
xoxo, your local manpage bestie π
β brought to you by perl v5.42.0, dated 2024-12-12 π«Ά
π¦ where this page comes from
- opensuse-leap 16.0: perl-SQL-Translator 1.660.0-bp160.1.11 Β· (Artistic-1.0 OR GPL-1.0-or-later) AND GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms