>  > Is there a way in Torque to handle foreign key like this:
>  >
>  > FOREIGN KEY (A, B) references TABLE2 (A, B)
>  >
>  > if yes, how should I describe it in XML schema?
>  > Does it make sense to make Foreign keys entities on their own, not just
>  > attributes? This would allow for more flexibility, because FKs _are_
>  > actually entities...
>  >
>  >Opinions?
>  >
>  >fedor.
>  
>In newtorque foreign keys are only allowed to be one column, but it can
>reference a different column in the foreign table.  That is FOREIGN KEY (A)
>references TABLE2 (B).  This is about as far as the flexibility goes at the
>moment.
>  
>Maybe you can think of a nice way of representing this in the xml 
>schema file. 

I think the way to do it is to think of Foreign keys as entities. They
actually are entities - look at DB diagrams. They have attributes which
probably constitutes an entity.

so thing like
cREATE TABLE TABLE1 (
...
...
FOREIGN KEY (A, B) REFERENCES TABLE2 (C, D)
)

would look like this in XML schema:

<table name='TABLE1'>
...
</table>
<table name='TABLE2'>
...
</table>
<foreign-key name='...'>
 <primary-key-table name='TABLE2'>
  <column name='C'/>
  <column name='D'/>
 </primary-key-table>
 <foreign-key-table name='TABLE1'>
  <column name='A'/>
  <column name='B'/>
 </foreign-key-table>
</foreign-key>

Not sure about the names (as always), but you got the idea...

>We'll also need to be able to add this to MapBuilder 
>so that Peers are aware of multi-column foreign keys.

sure.

fedor.





_______________________________________________________
Say Bye to Slow Internet!
http://www.home.com/xinbox/signup.html



------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to