Hello,

I am learning SQLObject and I am wondering how, once a join is created
between two tables to actually INSERT items into the joined table while
respecting referential integrity. Here is my simplified code:

class TableA(SQLObject):
        VarA = StringCol(length=10, default="test")
        VarB = SingleJoin ("TableB")

class TableB(SQLObject):
        VarC = StringCol()
        VarD = ForeignKey("TableA")

TableA.createTable()
TableB.createTable()

InsertOne = TableA(VarA = 'foo')
InsertTwo = TableB(VarC=200, VarD=InsertOne.id)

I want it so that if I enter info into TableA, there must also be a
corresponding record in TableB. I would imagine that the value of the
foreign key should automatically be put in whatever values the primary
key is in TableA. Theoretically, I can put anything in VarD, which makes
me somewhat squeemish.

- Steve




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to