Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.11.5

Bug #507 non-native sequences are broken
Submitted: 2003-12-31 22:46 UTC
From: ieure at debian dot org Assigned: alan_k
Status: Closed Package: DB_DataObject
PHP Version: 4.3.3 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2003-12-31 22:46 UTC] ieure at debian dot org
Description: ------------ The implementation of non-native sequences is broken in DB_DataObject 1.4. When trying to use non-native sequences (explicitly set with $object->sequenceKey('id', FALSE)), the primary key is not set in the INSERT query. The PostgreSQL 'serial' datatype defaults to the next free value from a sequence; inserting a row with a blank primary key increments the sequence for that field. The upshot is that the DataObject has an id of 107, but the record in the database has an id of 108. DB_DataObject 1.3 does not exhibit this behavior. Reproduce code: --------------- $object->sequenceKey('id', false); $object->setFrom($values); $newId = $object->insert(); Expected result: ---------------- $object->id should contain the same value as the 'id' field in the database. Actual result: -------------- $object->id contains an incorrect value, which does not reference any row in the database.

Comments

 [2004-01-01 00:36 UTC] alan_k
will try and check/fix this weekend.
 [2004-01-01 02:42 UTC] alan_k
ok - should be fixed in cvs