Mercurial > pub > Impl
diff Lib/IMPL/SQL/Schema/Constraint/ForeignKey.pm @ 167:1f7a6d762394
SQL schema in progress
author | sourcer |
---|---|
date | Thu, 12 May 2011 08:57:19 +0400 |
parents | 76515373dac0 |
children | 6148f89bb7bf |
line wrap: on
line diff
--- a/Lib/IMPL/SQL/Schema/Constraint/ForeignKey.pm Sat Apr 23 23:12:06 2011 +0400 +++ b/Lib/IMPL/SQL/Schema/Constraint/ForeignKey.pm Thu May 12 08:57:19 2011 +0400 @@ -1,13 +1,17 @@ package IMPL::SQL::Schema::Constraint::ForeignKey; use strict; +use warnings; + +use IMPL::lang qw(:declare :constants is); + use parent qw(IMPL::SQL::Schema::Constraint); -use IMPL::Class::Property; + use IMPL::Class::Property::Direct; BEGIN { - public _direct property referencedPrimaryKey => prop_get; - public _direct property OnDelete => prop_get; - public _direct property OnUpdate => prop_get; + public _direct property referencedPrimaryKey => PROP_GET; + public _direct property OnDelete => PROP_GET; + public _direct property OnUpdate => PROP_GET; } __PACKAGE__->PassThroughArgs; @@ -25,10 +29,10 @@ scalar (@ReferencedColumns) == scalar(@{$this->columns}) or die new Exception('A foreing key columns doesn\'t match refenced columns'); my @ColumnsCopy = @ReferencedColumns; - die new Exception('A foreing key columns doesn\'t match refenced columns') if grep { not $_->type->isSame((shift @ColumnsCopy)->type)} @{$this->columns}; + die new Exception('A foreing key columns doesn\'t match refenced columns') if grep { not $_->type->SameValue((shift @ColumnsCopy)->type)} @{$this->columns}; @ColumnsCopy = @ReferencedColumns; - die new Exception('The foreign key must match to the primary key of the referenced table',$this->name) if grep { not $_->type->isSame(shift(@ColumnsCopy)->type)} @{$ForeingPK->columns}; + die new Exception('The foreign key must match to the primary key of the referenced table',$this->name) if grep { not $_->type->SameValue(shift(@ColumnsCopy)->type)} @{$ForeingPK->columns}; $this->{$referencedPrimaryKey} = $ForeingPK; @@ -44,13 +48,13 @@ $this->SUPER::Dispose; } -sub isSame { +sub SameValue { my ($this,$other) = @_; uc $this->OnDelete eq uc $other->OnDelete or return 0; uc $this->OnUpdate eq uc $other->OnUpdate or return 0; - return $this->SUPER::isSame($other); + return $this->SUPER::SameValue($other); }