Re: DB_DataObject::insert() not returning ID
| From: | Alan Knowles | Date: | Wed, 01 Dec 2004 01:12:13 +0000 |
| Subject: | Re: DB_DataObject::insert() not returning ID | ||
| References: | 1 2 3 4 5 6 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-15926@lists.php.net to get a copy of this message | ||
can you narrow it down to a small bit of code to reproduce the problem - then file it as a bug (pear.php.net/DB_DataObject -> select bugs.)
Regards
Alan
Ken Restivo wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tue, Nov 30, 2004 at 02:33:53PM +0800, Alan Knowles wrote:Well then, I think I have found a bug. The schema is correct AFAICT, there is one primary key and it is an auto_increment not-null field. The ID does get correctly returned by manually getting last_insert_id() via raw SQL as my utility hack does. However, DBDO's insert() always returns 1. I'm using:$do->insert() should always return last_insert_id(), unless the schema data is wrong (eg. not uptodate or something) Otherwise you have found a bug..On Sun, Nov 14, 2004 at 07:36:41PM -0800, Ken Restivo wrote:One more: inserts succeed but always return 1 as an ID. I supposed I can hack around this with a raw query for last_insert_id(), but the docs say insert() should return this.
DB_DataObject 1.7.2 stableOn PHP 4.3.8 on Debian Woody. - -ken - -- - --------------- The world's most affordable web hosting. http://www.nearlyfreespeech.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) iD8DBQFBrLnOe8HF+6xeOIcRAuSMAKCFwGStPmlIClDzonZJrzEJ2x2xrACgtT9e wvVnSaZiX9g9d1hSK45OgVY= =xLPK -----END PGP SIGNATURE-----