On Thursday 14 June 2007 05:27, Ed Leafe wrote: > On Jun 13, 2007, at 10:58 PM, <[EMAIL PROTECTED]> > > <[EMAIL PROTECTED]> wrote: > > We have two tables in a parent-child relationship. On a form, we are > > adding a new record to the parent and then adding child records > > without > > first saving the parent record. Upon saving (Form.saveAll) we were > > expecting the following....the parent record would be saved and the > > pkid for > > new record retrieved, then the child records would be updated with the > > parent pkid as the foreign key and then saved. > > > > However, we are not seeing this. It appears that the child fk > > value is > > getting assigned an unexpected number that is absolutely not the pk > > of the > > parent. > > This answer is more for John Fabiani, since he has more experience > with PostgreSQL. > > Looking at the code, dbPostgreSQL doesn't override > dBackend.getLastInsertID(), so that means it is relying on the dbapi- > level cursor's 'lastrowid' attribute. Could you verify that this is > correct, and is working properly? If not, we'll have to provide a way > of retrieving that new PK. > > Larry, can you try this? Add this code to the bizobj for the parent > table: > > def onSaveNew(self): > print "LASTROWID:", self._CurrentCursor.lastrowid > print "NEW PK:", self.getPK() > > If things are working correctly, both of those lines should print > the same value. If not, then that's a sign that we need to update the > PK-fetching routine. > > -- Ed Leafe > -- http://leafe.com > -- http://dabodev.com
I'll look into this immediately. John Fabiani _______________________________________________ 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/dabo-users/[EMAIL PROTECTED]
