johnf wrote: > On Thursday 23 August 2007 14:39, Ed Leafe wrote: >> On Aug 23, 2007, at 5:02 PM, johnf wrote: >>> I have a parent and several child waiting to be saved. >>> isTransactionManager = True >>> >>> parent is inserted into the DB >>> >>> then getLastInsertID() is called because the children need the PKID >>> of the >>> parent >>> >>> But no commit has occurred. >>> >>> getLastInsertID() fails because of no commit. >>> >>> I don't think this can work? Anybody have a suggestion on how I >>> might fix >>> this? >> Is there any other way to query the value without committing? > Yes nextval() will return the next value of the sequence. >> If >> not, you should probably use sequence instead, and pre-fetch it using >> the dbPostgreSQL.pregenPK() method (which doesn't exist yet). > > Writing the code for pregenPK() would not be that big of a deal. Assume that > the code is available. How does Dabo use the method? >> -- Ed Leafe >> -- http://leafe.com >> -- http://dabodev.com > > However, it would be a very big deal to change the code for our current > forms. > Any form that uses children (and I have one that uses grandchildren) depends > on the self.FillLinkFromParent = True. Please explain how the current Dabo > is suppose to deal with the Saveall(). >
Dabos dbFirebird module does use pregenPK in a way that works as expected. I did a quick search on what the default way in postgresql is and found out that there is a currval() method which gets the last inserted sequence id for the given connection. >From the postgresql faq: 4.11.3) Doesn't currval() lead to a race condition with other users? No. currval() returns the current value assigned by your session, not by all sessions. _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev Searchable Archives: http://leafe.com/archives/search/dabo-dev This message: http://leafe.com/archives/byMID/dabo-dev/[EMAIL PROTECTED]
