From: Chris Hilton Date: Wed, 29 Jun 2005 22:02:29 +0000 (+0000) Subject: Made sure defined scalar references are passed to _compare_objects(). Removed is_vali... X-Git-Tag: v0.11008~510 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4598b71c61d9fcb8a91ee6174a68a34d6f0eae24;p=dbsrgits%2FSQL-Translator.git Made sure defined scalar references are passed to _compare_objects(). Removed is_valid comparisons from equals(). --- diff --git a/lib/SQL/Translator/Schema/Constraint.pm b/lib/SQL/Translator/Schema/Constraint.pm index 89f3403..e601947 100644 --- a/lib/SQL/Translator/Schema/Constraint.pm +++ b/lib/SQL/Translator/Schema/Constraint.pm @@ -1,7 +1,7 @@ package SQL::Translator::Schema::Constraint; # ---------------------------------------------------------------------- -# $Id: Constraint.pm,v 1.17 2005-06-28 22:55:19 duality72 Exp $ +# $Id: Constraint.pm,v 1.18 2005-06-29 22:02:17 duality72 Exp $ # ---------------------------------------------------------------------- # Copyright (C) 2002-4 SQLFairy Authors # @@ -51,7 +51,7 @@ use base 'SQL::Translator::Schema::Object'; use vars qw($VERSION $TABLE_COUNT $VIEW_COUNT); -$VERSION = sprintf "%d.%02d", q$Revision: 1.17 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.18 $ =~ /(\d+)\.(\d+)/; my %VALID_CONSTRAINT_TYPE = ( PRIMARY_KEY, 1, @@ -276,7 +276,7 @@ avoid the overload magic of the Field objects returned by the fields method. =cut my $self = shift; - return wantarray ? @{ $self->{'fields'} || [] } : $self->{'fields'}; + return wantarray ? @{ $self->{'fields'} || [] } : ($self->{'fields'} || ''); } # ---------------------------------------------------------------------- @@ -543,18 +543,18 @@ Determines if this constraint 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; return 0 unless $self->deferrable eq $other->deferrable; - return 0 unless $self->is_valid eq $other->is_valid; + #return 0 unless $self->is_valid eq $other->is_valid; return 0 unless $case_insensitive ? uc($self->table->name) eq uc($other->table->name) : $self->table->name eq $other->table->name; return 0 unless $self->expression eq $other->expression; return 0 unless $self->_compare_objects(scalar $self->field_names, scalar $other->field_names); return 0 unless $self->reference_table eq $other->reference_table; - return 0 unless $self->_compare_objects($self->reference_fields, $other->reference_fields); + return 0 unless $self->_compare_objects(scalar $self->reference_fields, scalar $other->reference_fields); return 0 unless $self->match_type eq $other->match_type; return 0 unless $self->on_delete eq $other->on_delete; return 0 unless $self->on_update eq $other->on_update; - return 0 unless $self->_compare_objects($self->options, $other->options); - return 0 unless $self->_compare_objects($self->extra, $other->extra); + return 0 unless $self->_compare_objects(scalar $self->options, scalar $other->options); + return 0 unless $self->_compare_objects(scalar $self->extra, scalar $other->extra); return 1; } diff --git a/lib/SQL/Translator/Schema/Field.pm b/lib/SQL/Translator/Schema/Field.pm index 7e8fe3e..9b53d06 100644 --- a/lib/SQL/Translator/Schema/Field.pm +++ b/lib/SQL/Translator/Schema/Field.pm @@ -1,7 +1,7 @@ package SQL::Translator::Schema::Field; # ---------------------------------------------------------------------- -# $Id: Field.pm,v 1.23 2005-06-27 21:59:19 duality72 Exp $ +# $Id: Field.pm,v 1.24 2005-06-29 22:02:18 duality72 Exp $ # ---------------------------------------------------------------------- # Copyright (C) 2002-4 SQLFairy Authors # @@ -50,7 +50,7 @@ use base 'SQL::Translator::Schema::Object'; use vars qw($VERSION $TABLE_COUNT $VIEW_COUNT); -$VERSION = sprintf "%d.%02d", q$Revision: 1.23 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.24 $ =~ /(\d+)\.(\d+)/; # Stringify to our name, being careful not to pass any args through so we don't # accidentally set it to undef. We also have to tweak bool so the object is @@ -567,7 +567,7 @@ Determines if this field 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; - return 0 unless $self->is_valid eq $other->is_valid; + #return 0 unless $self->is_valid eq $other->is_valid; return 0 unless $self->data_type eq $other->data_type; return 0 unless $self->size eq $other->size; return 0 unless defined $self->default_value eq defined $other->default_value; @@ -578,7 +578,7 @@ Determines if this field is the same as another return 0 unless $self->is_foreign_key eq $other->is_foreign_key; return 0 unless $self->is_auto_increment eq $other->is_auto_increment; # return 0 unless $self->comments eq $other->comments; - return 0 unless $self->_compare_objects($self->extra, $other->extra); + return 0 unless $self->_compare_objects(scalar $self->extra, scalar $other->extra); return 1; } diff --git a/lib/SQL/Translator/Schema/Index.pm b/lib/SQL/Translator/Schema/Index.pm index 9d08db8..78d9b2b 100644 --- a/lib/SQL/Translator/Schema/Index.pm +++ b/lib/SQL/Translator/Schema/Index.pm @@ -1,7 +1,7 @@ package SQL::Translator::Schema::Index; # ---------------------------------------------------------------------- -# $Id: Index.pm,v 1.12 2005-06-28 22:56:22 duality72 Exp $ +# $Id: Index.pm,v 1.13 2005-06-29 22:02:29 duality72 Exp $ # ---------------------------------------------------------------------- # Copyright (C) 2002-4 SQLFairy Authors # @@ -53,7 +53,7 @@ use base 'SQL::Translator::Schema::Object'; use vars qw($VERSION $TABLE_COUNT $VIEW_COUNT); -$VERSION = sprintf "%d.%02d", q$Revision: 1.12 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.13 $ =~ /(\d+)\.(\d+)/; my %VALID_INDEX_TYPE = ( UNIQUE, 1, @@ -255,8 +255,8 @@ Determines if this index is the same as another return 0 unless $self->is_valid eq $other->is_valid; return 0 unless $self->type eq $other->type; return 0 unless $self->_compare_objects(scalar $self->fields, scalar $other->fields); - return 0 unless $self->_compare_objects($self->options, $other->options); - return 0 unless $self->_compare_objects($self->extra, $other->extra); + return 0 unless $self->_compare_objects(scalar $self->options, scalar $other->options); + return 0 unless $self->_compare_objects(scalar $self->extra, scalar $other->extra); return 1; } diff --git a/lib/SQL/Translator/Schema/Procedure.pm b/lib/SQL/Translator/Schema/Procedure.pm index a7fde3e..e15082c 100644 --- a/lib/SQL/Translator/Schema/Procedure.pm +++ b/lib/SQL/Translator/Schema/Procedure.pm @@ -1,7 +1,7 @@ package SQL::Translator::Schema::Procedure; # ---------------------------------------------------------------------- -# $Id: Procedure.pm,v 1.5 2005-06-27 21:59:20 duality72 Exp $ +# $Id: Procedure.pm,v 1.6 2005-06-29 22:02:29 duality72 Exp $ # ---------------------------------------------------------------------- # Copyright (C) 2002-4 SQLFairy Authors # @@ -54,7 +54,7 @@ use base 'SQL::Translator::Schema::Object'; use vars qw($VERSION); -$VERSION = sprintf "%d.%02d", q$Revision: 1.5 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.6 $ =~ /(\d+)\.(\d+)/; # ---------------------------------------------------------------------- @@ -105,7 +105,7 @@ Gets and set the parameters of the stored procedure. $self->{'parameters'} = \@unique; } - return wantarray ? @{ $self->{'parameters'} || [] } : $self->{'parameters'}; + return wantarray ? @{ $self->{'parameters'} || [] } : ($self->{'parameters'} || ''); } # ---------------------------------------------------------------------- @@ -259,10 +259,10 @@ Determines if this procedure is the same as another return 0 unless $self->SUPER::equals($other); return 0 unless $self->name eq $other->name; return 0 unless $self->sql eq $other->sql; - return 0 unless $self->_compare_objects($self->parameters, $other->parameters); + return 0 unless $self->_compare_objects(scalar $self->parameters, scalar $other->parameters); # return 0 unless $self->comments eq $other->comments; return 0 unless $self->owner eq $other->owner; - return 0 unless $self->_compare_objects($self->extra, $other->extra); + return 0 unless $self->_compare_objects(scalar $self->extra, scalar $other->extra); return 1; } diff --git a/lib/SQL/Translator/Schema/Table.pm b/lib/SQL/Translator/Schema/Table.pm index 1214e16..7bef851 100644 --- a/lib/SQL/Translator/Schema/Table.pm +++ b/lib/SQL/Translator/Schema/Table.pm @@ -1,7 +1,7 @@ package SQL::Translator::Schema::Table; # ---------------------------------------------------------------------- -# $Id: Table.pm,v 1.32 2005-06-28 22:58:06 duality72 Exp $ +# $Id: Table.pm,v 1.33 2005-06-29 22:02:29 duality72 Exp $ # ---------------------------------------------------------------------- # Copyright (C) 2002-4 SQLFairy Authors # @@ -51,7 +51,7 @@ use base 'SQL::Translator::Schema::Object'; use vars qw( $VERSION $FIELD_ORDER ); -$VERSION = sprintf "%d.%02d", q$Revision: 1.32 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.33 $ =~ /(\d+)\.(\d+)/; # Stringify to our name, being careful not to pass any args through so we don't @@ -844,7 +844,7 @@ an array or array reference. push @{ $self->{'options'} }, @$options; if ( ref $self->{'options'} ) { - return wantarray ? @{ $self->{'options'} || [] } : $self->{'options'}; + return wantarray ? @{ $self->{'options'} || [] } : ($self->{'options'} || ''); } else { return wantarray ? () : []; @@ -919,8 +919,8 @@ Determines if this table is the same as another return 0 unless $self->SUPER::equals($other); return 0 unless $self->name eq $other->name; - return 0 unless $self->_compare_objects($self->options, $other->options); - return 0 unless $self->_compare_objects($self->extra, $other->extra); + return 0 unless $self->_compare_objects(scalar $self->options, scalar $other->options); + return 0 unless $self->_compare_objects(scalar $self->extra, scalar $other->extra); # Fields # Go through our fields diff --git a/lib/SQL/Translator/Schema/Trigger.pm b/lib/SQL/Translator/Schema/Trigger.pm index 204e834..e93fc6b 100644 --- a/lib/SQL/Translator/Schema/Trigger.pm +++ b/lib/SQL/Translator/Schema/Trigger.pm @@ -1,7 +1,7 @@ package SQL::Translator::Schema::Trigger; # ---------------------------------------------------------------------- -# $Id: Trigger.pm,v 1.6 2005-06-27 21:59:20 duality72 Exp $ +# $Id: Trigger.pm,v 1.7 2005-06-29 22:02:29 duality72 Exp $ # ---------------------------------------------------------------------- # Copyright (C) 2002-4 SQLFairy Authors # @@ -54,7 +54,7 @@ use base 'SQL::Translator::Schema::Object'; use vars qw($VERSION $TABLE_COUNT $VIEW_COUNT); -$VERSION = sprintf "%d.%02d", q$Revision: 1.6 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.7 $ =~ /(\d+)\.(\d+)/; # ---------------------------------------------------------------------- @@ -324,12 +324,12 @@ Determines if this trigger is the same as another return 0 unless $self->SUPER::equals($other); return 0 unless $self->name eq $other->name; - return 0 unless $self->is_valid eq $other->is_valid; + #return 0 unless $self->is_valid eq $other->is_valid; return 0 unless $self->perform_action_when eq $other->perform_action_when; return 0 unless $self->database_event eq $other->database_event; return 0 unless $self->on_table eq $other->on_table; return 0 unless $self->action eq $other->action; - return 0 unless $self->_compare_objects($self->extra, $other->extra); + return 0 unless $self->_compare_objects(scalar $self->extra, scalar $other->extra); return 1; } diff --git a/lib/SQL/Translator/Schema/View.pm b/lib/SQL/Translator/Schema/View.pm index 8893d15..29364eb 100644 --- a/lib/SQL/Translator/Schema/View.pm +++ b/lib/SQL/Translator/Schema/View.pm @@ -1,7 +1,7 @@ package SQL::Translator::Schema::View; # ---------------------------------------------------------------------- -# $Id: View.pm,v 1.10 2005-06-27 21:59:20 duality72 Exp $ +# $Id: View.pm,v 1.11 2005-06-29 22:02:29 duality72 Exp $ # ---------------------------------------------------------------------- # Copyright (C) 2002-4 SQLFairy Authors # @@ -50,7 +50,7 @@ use base 'SQL::Translator::Schema::Object'; use vars qw($VERSION $TABLE_COUNT $VIEW_COUNT); -$VERSION = sprintf "%d.%02d", q$Revision: 1.10 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.11 $ =~ /(\d+)\.(\d+)/; # ---------------------------------------------------------------------- @@ -103,7 +103,7 @@ names and keep them in order by the first occurrence of a field name. $self->{'fields'} = \@unique; } - return wantarray ? @{ $self->{'fields'} || [] } : $self->{'fields'}; + return wantarray ? @{ $self->{'fields'} || [] } : ($self->{'fields'} || ''); } # ---------------------------------------------------------------------- @@ -227,10 +227,10 @@ Determines if this view is the same as another return 0 unless $self->SUPER::equals($other); return 0 unless $self->name eq $other->name; - return 0 unless $self->is_valid eq $other->is_valid; + #return 0 unless $self->is_valid eq $other->is_valid; return 0 unless $self->sql eq $other->sql; - return 0 unless $self->_compare_objects($self->fields, $other->fields); - return 0 unless $self->_compare_objects($self->extra, $other->extra); + return 0 unless $self->_compare_objects(scalar $self->fields, scalar $other->fields); + return 0 unless $self->_compare_objects(scalar $self->extra, scalar $other->extra); return 1; }