Mercurial > pub > Impl
comparison Lib/IMPL/SQL/Schema/Table.pm @ 33:0004faa276dc
small fixes, some new tests
| author | Sergey |
|---|---|
| date | Mon, 09 Nov 2009 16:49:39 +0300 |
| parents | 56cef8e3cda6 |
| children | 16ada169ca75 |
comparison
equal
deleted
inserted
replaced
| 32:56cef8e3cda6 | 33:0004faa276dc |
|---|---|
| 151 | 151 |
| 152 sub LinkTo { | 152 sub LinkTo { |
| 153 my ($this,$table,@ColumnList) = @_; | 153 my ($this,$table,@ColumnList) = @_; |
| 154 $table->PrimaryKey or die new IMPL::InvalidOperationException('The referenced table must have a primary key'); | 154 $table->PrimaryKey or die new IMPL::InvalidOperationException('The referenced table must have a primary key'); |
| 155 my $constraintName = $this->{$Name}.'_'.$table->Name.'_FK_'.join('_',map {ref $_ ? $_->Name : $_} @ColumnList); | 155 my $constraintName = $this->{$Name}.'_'.$table->Name.'_FK_'.join('_',map {ref $_ ? $_->Name : $_} @ColumnList); |
| 156 $this->AddConstraint(new IMPL::SQL::Schema::Constraint::ForeignKey(Name => $constraintName, Table => $this,Columns => \@ColumnList, ReferencedTable => $table, ReferencedColumns => scalar($table->PrimaryKey->Columns))); | 156 $this->AddConstraint(new IMPL::SQL::Schema::Constraint::ForeignKey(Name => $constraintName, Table => $this,Columns => \@ColumnList, ReferencedTable => $table, ReferencedColumns => $table->PrimaryKey->Columns)); |
| 157 } | 157 } |
| 158 | 158 |
| 159 sub Dispose { | 159 sub Dispose { |
| 160 my ($this) = @_; | 160 my ($this) = @_; |
| 161 | 161 |
