On Sep 22, 2008, at 10:13 AM, Sibylle Koczian wrote:

> I can't find any way to get new records into the database. This  
> seems to be a
> problem with manually entered primary keys, it doesn't happen with
> autoincrement PK fields. Will try this next with a Firebird  
> database, because
> I really need this with one of my Firebird databases.


        OK, I've had time to look this over, and you're close.

        As Paul mentioned, you need to set biz.AutoPopulatePK to False for  
Dabo to send PK values back to the server. But that should cause Dabo  
to send the full record, including the PK to the backend server.

        If you have the time to do some debugging, can you replace the  
__saverow() method of dCursorMixin with the version below, that  
includes some debug output? Run your app using scenario 4 in your  
original email, and when you try to save the record, there should be a  
couple of lines of debug output. Copy that output and paste it into a  
reply email. This may not give us the answer, but it will help point  
us in the right direction.


dCursorMixin.py, starting around line 1166:

        def __saverow(self, row):
                rec = self._records[row]
                recKey = self.pkExpression(rec)
                newrec = self._newRecords.has_key(recKey)
                newPKVal = None
                if newrec and self.AutoPopulatePK:
                        # Some backends do not provide a means to retrieve
                        # auto-generated PKs; for those, we need to create the
                        # PK before inserting the record so that we can pass it 
on
                        # to any linked child records. NOTE: if you are using
                        # compound PKs, this cannot be done.
                        newPKVal = self.pregenPK()
                        if newPKVal and not self._compoundKey:
                                self.setFieldVal(self.KeyField, newPKVal, row)

                print "newrec = ", newrec
                if newrec:
                        diff = self._getNewRecordDiff(row)
                else:
                        diff = self.getRecordStatus(row)
                print "diff = ", diff
                aq = self.AutoQuoteNames
                if diff:


-- Ed Leafe





_______________________________________________
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]

Reply via email to