Author: Paul McNett
Posted: 2012-05-03 at 12:04:40
On 5/3/12 5:09 AM, Charles Brunet wrote:
> 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.
You can't ask the database for the last insert id until the database has inserted the
record. The database won't insert the record until you call biz.save(), which you
don't want to do inside the loop. You also don't want to guess at what the database
will assign for the key because another user could have beaten you to it, among other
reasons.
Do you want me to tell you how to use uuid's for your key fields? This would require
redefining the database to use char(40) keys and not auto-increment.
Paul
_______________________________________________
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/4FA2BAA8.6080004@ulmcnett.com