Oleg Broytmann wrote: > I don't understand what do you want to do and to avoid. What usage > pattern do you want to follow, and what to prevent? The code you posted in > the beginning of the thread looks good: > > InsertOne = TableA(VarA = 'foo') > InsertTwo = TableB(VarC=200, VarD=InsertOne.id) > > That's ok. You can even do > InsertTwo = TableB(VarC=200, VarD=InsertOne) > (in 0.7.1)
I'm "jumping" in the middle of the discussion, but from what I understood he wants to make it mandatory to have "InsertTwo" after InsertOne, otherwise rollback the transaction... Using contraints you may achieve that -- in PostgreSQL I'd make the FK "not null" and "deferred" until the end of the transaction. In SQLObject "not null" is achieved with a "notNone = True" parameter on the column declaration. Unfortunately, not all databases support the "deferred" idea, so you (the OP) would have to find out how to make your program's logic so that one of the tables can be added before the other and wrap both inserts in a transaction. This will make it possible to use the syntax Oleg used above and will require the FK to exist before inserting the new record. -- Jorge Godoy <[EMAIL PROTECTED]> "Quidquid latine dictum sit, altum sonatur." - Qualquer coisa dita em latim soa profundo. - Anything said in Latin sounds smart. ------------------------------------------------------- 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
