diff Lib/IMPL/SQL/Schema/Constraint.pm @ 168:6148f89bb7bf

IMPL::SQL::Schema::Traits::Diff alfa version IMPL::lang added hash traits
author sourcer
date Mon, 16 May 2011 04:30:38 +0400
parents 1f7a6d762394
children 4d0e1962161c
line wrap: on
line diff
--- a/Lib/IMPL/SQL/Schema/Constraint.pm	Thu May 12 08:57:19 2011 +0400
+++ b/Lib/IMPL/SQL/Schema/Constraint.pm	Mon May 16 04:30:38 2011 +0400
@@ -15,6 +15,8 @@
 
 public property columns => PROP_GET | PROP_LIST | PROP_OWNERSET;
 
+my %aliases;
+
 sub CTOR {
     my ($this,%args) = @_;
     is( $args{table}, typeof IMPL::SQL::Schema::Table ) or
@@ -29,7 +31,7 @@
     
     my $cn = UNIVERSAL::isa($Column,'IMPL::SQL::Schema::Column') ? $Column->name : $Column;
     
-    my $resolved = $Table->Column($cn);
+    my $resolved = $Table->GetColumn($cn);
     die new IMPL::InvalidOperationException("The column is not found in the table", $cn, $Table->name) if not $resolved;
     return $resolved;
 }
@@ -39,7 +41,7 @@
     
     my %Columns = map { $_, 1} @Columns;
     
-    return scalar(grep { $Columns{$_->name} } @{$this->columns}) == scalar(@Columns);
+    return scalar(grep { $Columns{$_->name} } $this->columns ) == scalar(@Columns);
 }
 
 sub uniqName {
@@ -68,4 +70,17 @@
 	
 	return 1;
 }
+
+sub ResolveAlias {
+	my ($self,$alias) = @_;
+	
+	return is($alias, typeof IMPL::SQL::Schema::Constraint) ? $alias : $aliases{$alias};
+}
+
+sub RegisterAlias {
+	my ($self,$alias) = @_;
+	
+	$aliases{$alias} = $self->typeof;
+}
+
 1;