Remove copyright headers from individual scripts
[dbsrgits/SQL-Translator.git] / lib / SQL / Translator / Schema / Trigger.pm
index 0f26325..e52ea6e 100644 (file)
@@ -1,23 +1,5 @@
 package SQL::Translator::Schema::Trigger;
 
-# ----------------------------------------------------------------------
-# Copyright (C) 2002-2009 SQLFairy Authors
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; version 2.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-# 02111-1307  USA
-# -------------------------------------------------------------------
-
 =pod
 
 =head1 NAME
@@ -244,9 +226,9 @@ sub action {
 
 =head2 action
 
-Gets or set the actions of the trigger.
+Gets or set the action of the trigger.
 
-  $trigger->actions(
+  $trigger->action(
       q[
         BEGIN
           select ...;
@@ -402,22 +384,39 @@ Determines if this trigger is the same as another
     
     return 0 unless $self->SUPER::equals($other);
 
-    return 0
-      unless $case_insensitive
-        ? uc( $self->name ) eq uc( $other->name )
-        : $self->name eq $other->name;
+    my %names;
+    for my $name ( $self->name, $other->name ) { 
+        $name = lc $name if $case_insensitive;
+        $names{ $name }++;
+    }
+
+    if ( keys %names > 1 ) {
+        return $self->error('Names not equal');
+    }
 
-    return 0 unless $self->perform_action_when eq $other->perform_action_when;
+    if ( !$self->perform_action_when eq $other->perform_action_when ) {
+        return $self->error('perform_action_when differs');
+    }
 
-    return 0
-      unless compare_arrays( $self->database_events, $other->database_events );
+    if ( 
+        !compare_arrays( [$self->database_events], [$other->database_events] ) 
+    ) {
+        return $self->error('database_events differ');
+    }
 
-    return 0 unless $self->on_table eq $other->on_table;
+    if ( $self->on_table ne $other->on_table ) {
+        return $self->error('on_table differs');
+    }
 
-    return 0 unless $self->action   eq $other->action;
+    if ( $self->action ne $other->action ) {
+        return $self->error('action differs');
+    }
 
-    return 0 unless $self->_compare_objects( scalar $self->extra,
-              scalar $other->extra );
+    if ( 
+        !$self->_compare_objects( scalar $self->extra, scalar $other->extra )
+    ) {
+        return $self->error('extras differ');
+    }
 
     return 1;
 }