From: Ken Youens-Clark Date: Wed, 15 Apr 2009 18:30:33 +0000 (+0000) Subject: Database events now returns a list. X-Git-Tag: v0.11008~189 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=df78f12bb518cf9c7e7961c62cf5301bd4fc3993;p=dbsrgits%2FSQL-Translator.git Database events now returns a list. --- diff --git a/lib/SQL/Translator/Producer/DB2.pm b/lib/SQL/Translator/Producer/DB2.pm index d9691a4..a343674 100644 --- a/lib/SQL/Translator/Producer/DB2.pm +++ b/lib/SQL/Translator/Producer/DB2.pm @@ -386,12 +386,13 @@ sub create_trigger my ($trigger) = @_; # create: CREATE TRIGGER trigger_name before type /ON/i table_name reference_b(?) /FOR EACH ROW/i 'MODE DB2SQL' triggered_action + my $db_events = join ', ', $trigger->database_events; my $out = sprintf('CREATE TRIGGER %s %s %s ON %s %s %s MODE DB2SQL %s', $trigger->name, $trigger->perform_action_when || 'AFTER', - $trigger->database_event =~ /update_on/i ? + $db_events =~ /update_on/i ? ('UPDATE OF '. join(', ', $trigger->fields)) : - $trigger->database_event || 'UPDATE', + $db_events || 'UPDATE', $trigger->table->name, $trigger->extra->{reference} || 'REFERENCING OLD AS oldrow NEW AS newrow', $trigger->extra->{granularity} || 'FOR EACH ROW',