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

Bug #532 insert() with key=0
Submitted: 2004-01-07 11:27 UTC
From: garbage at openfutura dot com Assigned: alan_k
Status: Closed Package: DB_DataObject
PHP Version: Irrelevant OS: Irrelevant
Roadmaps: (Not assigned)    

 [2004-01-07 11:27 UTC] garbage at openfutura dot com
Description: ------------ To create a new record (MySQL) in which i'll put new data, i used to try the following syntax: $item = new DBO_MyDBObject(); $item->id = 0; //id is the key with auto_increment flag on $newid = $item->insert(); I have my own class which encapsulates DB_DataObject, and there's a class function (method nuevo()) in which i put the above code (more or less) returning the newly created primary key. I then redefine the methods when needed. But since i do not know the definition of the objects which will inherit this nuevo() method (id is standard and every table i create has its primary key named like that), i cannot state a field to be filled with initial data to insert. I just need EMPTY data, with an auto_incremented key written to this new record. This method used to work fine until DB_DataObject 1.3 i guess. Now it is broken. Is there any way you can fix this annoying behaviour?


 [2004-01-09 06:47 UTC] alan_k
can you try CVS - this might be fixed there.
 [2004-01-09 19:02 UTC] garbage at openfutura dot com
Nope. No fix using CVS. But release 1.3 works fine.
 [2004-01-10 01:18 UTC] alan_k
ok -- needs further investigation..
 [2004-01-10 02:02 UTC] alan_k
Could not reproduce here. Can you download the test in CVS - (modify the dsn to connect to your test database. php -r simple.phpt .... at the end the output looks like this.. CONNECT : USING CACHED CONNECTION QUERY : INSERT INTO testproxy2 (id ) VALUES ( 2 ) query : QUERY DONE IN 0.00072801113128662 seconds 1 : Clearing Cache for myproject_dataobject_testproxy2 2--GET--
 [2004-01-10 04:52 UTC] alan_k
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on In case this was a website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better. finally tracked this one down...
 [2004-01-10 10:40 UTC] garbage at openfutura dot com
Certainly fixed. Just wanted to thank you for your work & time.