Re: [dabo-users] Importing data to linked tables

Author: Charles Brunet

Posted: 2012-05-03 at 07:09:56

2012/5/2 Paul McNett <p@ulmcnett.com>

> On 5/2/12 6:24 PM, Charles Brunet wrote:

> > My problem is that it performs commits at each row, instead of one big

> > commit at the end of the importation.I tried to remove the save() in the

> > loop, but then it set Attribute.Contact to a negative ID, which is wrong.

>

> The negative id is only temporary. Take the save() out of the loop, and

> move it to

> the end. When save() is called, all the temporary (negative) id's will get

> filled

> from the backend, including the foreign keys in the child table.

>

> Actually, that's how it should work but now that I think about it I'm not

> sure it

> actually works that way. Personally, I generate UUID's for my PK's at the

> dabo layer

> instead of delegating it to the db.

>

No, it seems foreign keys aren't updated on the children rows and keep the

temp negative value. I will try to manually set the PK value, as you

suggest. But how can I get the last insert ID? This function exists in the

cursor class, but not in the bizobj class. Or should I query the DB to get

the max value for the PK field? Even that I'm not sure how to do it.

Charles.

--- StripMime Report -- processed MIME parts ---

multipart/alternative

text/plain (text body -- kept)

text/html

---

_______________________________________________

Post Messages to: Dabo-users@leafe.com

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/CAJPgzxmvsUWwi84OHs8NvSAL0Q23zoN3QdX9yJWTYU-FrHVsVw@mail.gmail.com

©2012 Charles Brunet