comparison Lib/IMPL/SQL/Schema/Table.pm @ 315:77df11605d3a

code cleanup
author cin
date Tue, 07 May 2013 02:19:24 +0400
parents 4ddb27ff4a0b
children
comparison
equal deleted inserted replaced
314:109f28643025 315:77df11605d3a
152 sub AddConstraint { 152 sub AddConstraint {
153 my $this = shift; 153 my $this = shift;
154 if (@_ == 1) { 154 if (@_ == 1) {
155 my ($Constraint) = @_; 155 my ($Constraint) = @_;
156 156
157 die new IMPL::InvalidArgumentException('The invalid parameter') if not is($Constraint,typeof IMPL::SQL::Schema::Constraint); 157 die new IMPL::InvalidArgumentException('The invalid parameter') if not is($Constraint,'IMPL::SQL::Schema::Constraint');
158 158
159 $Constraint->table == $this or die new IMPL::InvalidOperationException('The constaint must belong to the target table'); 159 $Constraint->table == $this or die new IMPL::InvalidOperationException('The constaint must belong to the target table');
160 160
161 if (exists $this->{$constraints}->{$Constraint->name}) { 161 if (exists $this->{$constraints}->{$Constraint->name}) {
162 die new IMPL::InvalidOperationException('The table already has the specified constraint',$Constraint->name); 162 die new IMPL::InvalidOperationException('The table already has the specified constraint',$Constraint->name);
244 } 244 }
245 245
246 sub SameValue { 246 sub SameValue {
247 my ($this,$other) = @_; 247 my ($this,$other) = @_;
248 248
249 return 0 unless is $other, typeof $this; 249 return 0 unless is($other, typeof($this));
250 250
251 return 0 unless $this->name eq $other->name; 251 return 0 unless $this->name eq $other->name;
252 return 0 unless $this->ColumnsCount eq $other->ColumnsCount; 252 return 0 unless $this->ColumnsCount eq $other->ColumnsCount;
253 253
254 for (my $i = 0; $i < $this->ColumsCount; $i ++) { 254 for (my $i = 0; $i < $this->ColumsCount; $i ++) {