comparison Lib/IMPL/SQL/Schema/Constraint.pm @ 194:4d0e1962161c

Replaced tabs with spaces IMPL::Web::View - fixed document model, new features (control classes, document constructor parameters)
author cin
date Tue, 10 Apr 2012 20:08:29 +0400
parents 6148f89bb7bf
children 5c82eec23bb6
comparison
equal deleted inserted replaced
193:8e8401c0aea4 194:4d0e1962161c
18 my %aliases; 18 my %aliases;
19 19
20 sub CTOR { 20 sub CTOR {
21 my ($this,%args) = @_; 21 my ($this,%args) = @_;
22 is( $args{table}, typeof IMPL::SQL::Schema::Table ) or 22 is( $args{table}, typeof IMPL::SQL::Schema::Table ) or
23 die new IMPL::InvalidArgumentException("table argument must be a table object"); 23 die new IMPL::InvalidArgumentException("table argument must be a table object");
24 $this->{$name} = $args{'name'}; 24 $this->{$name} = $args{'name'};
25 $this->{$table} = $args{'table'}; 25 $this->{$table} = $args{'table'};
26 $this->columns( [map { ResolveColumn($this->table,$_) } @{$args{'columns'}}] ); 26 $this->columns( [map { ResolveColumn($this->table,$_) } @{$args{'columns'}}] );
27 } 27 }
28 28
58 58
59 $this->SUPER::Dispose; 59 $this->SUPER::Dispose;
60 } 60 }
61 61
62 sub SameValue { 62 sub SameValue {
63 my ($this,$other) = @_; 63 my ($this,$other) = @_;
64 64
65 return 0 unless $this->columns->Count == $other->columns->Count; 65 return 0 unless $this->columns->Count == $other->columns->Count;
66 66
67 for ( my $i=0; $i < $this->columns->Count; $i++ ) { 67 for ( my $i=0; $i < $this->columns->Count; $i++ ) {
68 return 0 unless $this->columns->[$i]->name eq $other->columns->[$i]->name; 68 return 0 unless $this->columns->[$i]->name eq $other->columns->[$i]->name;
69 } 69 }
70 70
71 return 1; 71 return 1;
72 } 72 }
73 73
74 sub ResolveAlias { 74 sub ResolveAlias {
75 my ($self,$alias) = @_; 75 my ($self,$alias) = @_;
76 76
77 return is($alias, typeof IMPL::SQL::Schema::Constraint) ? $alias : $aliases{$alias}; 77 return is($alias, typeof IMPL::SQL::Schema::Constraint) ? $alias : $aliases{$alias};
78 } 78 }
79 79
80 sub RegisterAlias { 80 sub RegisterAlias {
81 my ($self,$alias) = @_; 81 my ($self,$alias) = @_;
82 82
83 $aliases{$alias} = $self->typeof; 83 $aliases{$alias} = $self->typeof;
84 } 84 }
85 85
86 1; 86 1;