On Sat, Aug 1, 2009 at 8:54 PM, Miguel Lopes<[email protected]> wrote:
> On Sat, Aug 1, 2009 at 7:45 PM, Ed Leafe<[email protected]> wrote:
>> On Aug 1, 2009, at 1:16 PM, Miguel Lopes wrote:
>>> How can we deal with multiple tables commits?
>>
>> I assume that by this you mean multiple *unrelated* tables? Because
>> related tables are handled as I mentioned above. For unrelated tables,
>> you would need to create a special method in one of the bizobjs to
>> manually start the transaction by calling beginTransaction(), and then
>> call the save of itself and the other bizobjs involved, and then call
>> the commit/rollback as required.
>>
>
> Like you say *unrelated*!
>
> How can I get a pk from one of those tables and use it in *some* (but
> most certainly not all) of the other records being commited in
> different tables?
>
> Miguel
>
Let me explain better:
if I do - at a bizobj method:
### Code
self.startTransaction()
if someCondition:
anotherBizobj = self.Application.biz.AnotherOtherBizobj(self.Connection)
anotherBizobj.save(startTransaction=False)
anotherPk = another.Record.pk
self.save(startTransaction=False)
for rec in someDSGotAsArgument:
if rec == whatever:
rec['field'] = anotherPk
else:
rec['field'] = self.Record.pk
...
if not self.commitTransaction():
self.rollbackTransaction()
### End code
Is this the proper way to access pks of records that might be created?
Miguel
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message:
http://leafe.com/archives/byMID/[email protected]